Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Survey manager execute goals script #103

Merged
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
67f9c50
making spawn changes and adding double handed cargo
marinagmoreira Jun 22, 2023
719b744
Merge branch 'develop' of github.com:nasa/isaac into develop
marinagmoreira Jun 27, 2023
58176a9
Merge branch 'develop' of github.com:nasa/isaac into develop
marinagmoreira Jul 19, 2023
dfb9ad7
adding a proof of concept example of the executor
marinagmoreira Nov 9, 2023
796695b
running through isort
marinagmoreira Nov 9, 2023
e16eefe
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Nov 13, 2023
8456b90
committing before changing things around
marinagmoreira Nov 15, 2023
ad57def
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Nov 16, 2023
255143d
sockets working
marinagmoreira Nov 27, 2023
a7c09ca
fix lint
marinagmoreira Nov 27, 2023
e63ff36
adding example action node
marinagmoreira Dec 7, 2023
626a51f
update to scripts with new requirements
marinagmoreira Dec 11, 2023
1686c12
thread join safeguard
marinagmoreira Dec 12, 2023
30c761d
running isort
marinagmoreira Dec 12, 2023
c84eff2
Plansys2 on Astrobee Noetic (#107)
Bckempa Dec 12, 2023
4508014
bug fixes
marinagmoreira Dec 14, 2023
649ea5c
fixes
marinagmoreira Dec 14, 2023
2647bac
Update ci_pr.yml
marinagmoreira Dec 14, 2023
a881ffa
Merge branch 'survey_manager' of github.com:nasa/isaac into survey_ma…
marinagmoreira Dec 14, 2023
d7ea2f5
moving executor to different package hierarchy
marinagmoreira Dec 21, 2023
e58c7f4
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Jan 5, 2024
b8ae5aa
consolidating packages; action compiling
marinagmoreira Jan 5, 2024
2376fc6
tested action
marinagmoreira Jan 8, 2024
fb0c57c
submodule update
marinagmoreira Jan 9, 2024
adf0b81
move scripts into package
marinagmoreira Jan 9, 2024
d724113
changing static config to be more general
marinagmoreira Jan 9, 2024
a11b640
fixing config name + install data folder
marinagmoreira Jan 9, 2024
af52e73
restoring comms to readline
marinagmoreira Jan 10, 2024
362763b
getting details sorted
marinagmoreira Jan 10, 2024
d3d3228
making output more readable
marinagmoreira Jan 10, 2024
5e89aa4
installing script to be found in robot install
marinagmoreira Jan 12, 2024
8038c1f
adding move action starting correct process
marinagmoreira Jan 15, 2024
ab97e93
adding parameters for easy testing
marinagmoreira Jan 15, 2024
55d4402
fixes on command astrobee
marinagmoreira Jan 15, 2024
9a3e191
add remaining actions + documentation
marinagmoreira Jan 17, 2024
86b7990
running isort
marinagmoreira Jan 17, 2024
8d4f72a
Use exec and waitpid instead of reading output.
bcoltin Jan 18, 2024
6a18416
Change all action nodes to use the same class.
bcoltin Jan 18, 2024
8ef602d
install all nodes
marinagmoreira Jan 18, 2024
efd9ac7
adding remote option with no parameter adjusting, we'll do panoramas …
marinagmoreira Jan 19, 2024
903105c
reset progress after one action
marinagmoreira Jan 19, 2024
adf6eb2
adding inspection lib; fixing output
marinagmoreira Jan 20, 2024
4ad2bdd
fixing robot install
marinagmoreira Jan 20, 2024
64e8bf5
tested all 5 actions in the granite table
marinagmoreira Jan 20, 2024
12663c3
remote plansys2 submodules from doxygen
marinagmoreira Jan 20, 2024
8b61b23
splitting documentation
marinagmoreira Jan 20, 2024
49add14
addressing tons of comments on PR, lab tested
marinagmoreira Jan 20, 2024
c5c76a7
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Jan 20, 2024
a5ca4c8
more PR reviews
marinagmoreira Jan 20, 2024
d1522ba
more PR reviews
marinagmoreira Jan 20, 2024
29ff61b
more PR reviews
marinagmoreira Jan 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion astrobee/behaviors/inspection/tools/inspection_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ DEFINE_double(deadline, -1.0, "Action deadline timeout");
// Match the internal states and responses with the message definition
using STATE = isaac_msgs::InspectionState;
bool stopflag_ = false;
std::string feedback_old = "";

bool has_only_whitespace_or_comments(const std::string & str) {
for (std::string::const_iterator it = str.begin(); it != str.end(); it++) {
Expand Down Expand Up @@ -185,7 +186,7 @@ geometry_msgs::PoseArray ReadPosesFile(std::string file) {
quat_robot.setRPY(euler_roll * DEG2RAD, euler_pitch * DEG2RAD, euler_yaw * DEG2RAD);

} else {
std::cout << "Ignoring invalid line: " << line << std::endl;
// std::cout << "Ignoring invalid line: " << line << std::endl;
continue;
}
}
Expand All @@ -209,6 +210,8 @@ void FeedbackCallback(isaac_msgs::InspectionFeedbackConstPtr const& feedback) {
+ " -> " + feedback->state.fsm_state
+ " (" + feedback->state.fsm_subevent
+ " -> " + feedback->state.fsm_substate + ")";
if (s == feedback_old) return;
feedback_old = s;
if (s.size() < 70) s.append(70 - s.size(), ' ');
std::cout << "\r" << s.substr(0, 70) << "|Input: " << std::flush;
}
Expand Down
47 changes: 44 additions & 3 deletions astrobee/survey_manager/survey_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,64 @@
# License for the specific language governing permissions and limitations
# under the License.

cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(survey_planner)

add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)

find_package(catkin REQUIRED)
SET(catkin2_DIR "${CMAKE_SOURCE_DIR}/../../../cmake")
find_package(catkin2 REQUIRED COMPONENTS
roscpp
ff_msgs
lifecycle
plansys2_executor
)

catkin_package(
CATKIN_DEPENDS
)

foreach( dir pddl launch)
###########
## Build ##
###########

# Specify additional locations of header files
# Your package locations should be listed before other locations
include_directories(
${catkin_INCLUDE_DIRS}
)

# Action for move
add_executable(move_action_node src/move_action_node.cpp)
target_link_libraries(move_action_node ${catkin_LIBRARIES} )
# Action for dock
add_executable(dock_action_node src/dock_action_node.cpp)
target_link_libraries(dock_action_node ${catkin_LIBRARIES} )
# Action for undock
add_executable(undock_action_node src/undock_action_node.cpp)
target_link_libraries(undock_action_node ${catkin_LIBRARIES} )
# Action for panorama
add_executable(panorama_action_node src/panorama_action_node.cpp)
target_link_libraries(panorama_action_node ${catkin_LIBRARIES} )
# Action for stereo
add_executable(stereo_action_node src/stereo_action_node.cpp)
target_link_libraries(stereo_action_node ${catkin_LIBRARIES} )

#############
## Install ##
#############

# Allow other packages to use python scripts from this package
catkin_python_setup()

catkin_package()

# Install actions
install(TARGETS move_action_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

foreach( dir pddl launch data)
install( DIRECTORY ${dir}/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir} )
endforeach(dir)

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,51 @@ bays:
jem_bay6: [11.0, -9.0, 4.8]
jem_bay7: [11.0, -9.7, 4.8]

bays_move:
jem_bay1: "-pos '11 -4 4.8'"
jem_bay2: "-pos '11 -5 4.8'"
jem_bay3: "-pos '11 -6 4.8'"
jem_bay4: " -pos '11 -7 4.8'"
jem_bay5: "-pos '11 -8 4.8'"
jem_bay6: "-pos '11 -9 4.8'"
jem_bay7: "-pos '11 -9.7 4.8'"
jem_hatch_to_nod2: "-move -pos '11 -3.5 4.8' -att '0 0 1 90'"
jem_hatch_from_nod2: "-move -pos '11 -3.5 4.8' -att '0 0 1 -90'"
nod2_hatch_from_jem: "-move -pos '11 -1.0 4.8' -att '0 0 1 90'"
nod2_hatch_to_jem: "-move -pos '11 -1.0 4.8' -att '0 0 1 -90'"
nod2_bay2: "-pos '11 0 4.8'"
nod2_bay3: "-pos '10 0 4.8'"
nod2_bay4: "-pos '9 0 4.8'"
nod2_hatch_to_usl: "-move -pos '7.8 -3.5 4.8' -att '0 0 1 180'"
nod2_hatch_from_usl: "-move -pos '7.8 -3.5 4.8' -att '0 0 1 0'"
usl_hatch_from_nod2: "-move -pos '5.3 -1.0 4.8' -att '0 0 1 180'"
usl_hatch_to_nod2: "-move -pos '5.3 -1.0 4.8' -att '0 0 1 0'"
usl_bay1: "-pos '4.7 0 4.8'"
usl_bay2: "-pos '3.65 0 4.8'"
usl_bay3: "-pos '2.6 0 4.8'"
usl_bay4: " -pos '1.55 0 4.8'"
usl_bay5: "-pos '0.5 0 4.8'"
usl_bay6: "-pos '-0.5 0 4.8'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section is implementing features that are out of scope, so I don't want to encourage more work on this right now.

But here are some thoughts for improvements if we are able to add inter-module motion as a stretch goal:

It's too bad many of the positions declared here are copy/paste of position data declared in bays above. Probably a cleaner way overall would be to:

  • Separate the complete list of known location pose declarations from the (subset) list of locations that should be included in the PDDL problem instance. This is potentially important because including irrelevant locations can hurt planner performance.
  • The location pose declarations can be split into position and (optional) attitude fields.
  • The correct move arguments for a location can be generated from the pose declaration.
  • The current problem generator has a dumb way to infer which locations are connected, relying on everything being sorted by bay number, that would need to be revisited if there are multiple modules involved.
  • The current PDDL domain model can't readily represent different attitudes required for moving in different directions. But that's ok. The action executor receives both from and to position for each move action and could use this info to implement an attitude constraint without exposing this level of detail to the planner.


# Granite testing
# jem_hatch_to_nod2: "-move -pos '-0.3 -0.1 -0.68' -att '0 0 0'"
# jem_hatch_from_nod2: "-move -pos '-0.3 -0.1 -0.68' -att '0 0 180'"
# nod2_hatch_from_jem: "-move -pos '0.3 -0.1 -0.68' -att '0 0 0'"
# nod2_hatch_to_jem: "-move -pos '0.3 -0.1 -0.68' -att '0 0 180'"

maps:
jem: "iss.map"
nod2: "isaac.map"
usl: "usl_only.map"

exposure:
jem: 175
nod2: 300
usl: 300
berth:
berth1: "1"
berth2: "2"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would note this whole section seems intended for managing inter-module moves using the survey manager, which is outside our agreed scope. Let's not get too wrapped up in working on this yet. Good to note it's isolated into fields of the YAML file that are not used elsewhere yet, so it shouldn't break anything.

bogus_bays: [jem_bay0, jem_bay8]
berths: [berth1, berth2]
robots: [bumble, honey]
Expand All @@ -53,6 +98,6 @@ stereo:
# check purposes.
bound_location: jem_bay4 # The survey flies into bay4 even though it only covers up to bay3
jem_bay4_to_bay7:
marinagmoreira marked this conversation as resolved.
Show resolved Hide resolved
fplan: "jem_stereo_mapping_bay4_to_bay7.fplan"
fplan: "jem_stereo_mapping_bay7_to_bay4.fplan"
base_location: jem_bay7
bound_location: jem_bay4
12 changes: 12 additions & 0 deletions astrobee/survey_manager/survey_planner/launch/survey_domain.launch
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,17 @@
<node name="lifecycle_manager_node" pkg="plansys2_lifecycle_manager" type="lifecycle_manager_node" output="screen">
</node>

<!-- Actions -->
<node name="move_action_node" pkg="survey_planner" type="move_action_node" output="screen">
</node>
<node name="dock_action_node" pkg="survey_planner" type="dock_action_node" output="screen">
</node>
<node name="undock_action_node" pkg="survey_planner" type="undock_action_node" output="screen">
</node>
<node name="panorama_action_node" pkg="survey_planner" type="panorama_action_node" output="screen">
</node>
<node name="stereo_action_node" pkg="survey_planner" type="stereo_action_node" output="screen">
</node>

</launch>

11 changes: 7 additions & 4 deletions astrobee/survey_manager/survey_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
ISAAC Flight Software
</maintainer>

<buildtool_depend>catkin</buildtool_depend>

<depend>roscpp</depend>
<depend>std_srvs</depend>
<depend>lifecycle_msgs</depend>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>lifecycle</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>lifecycle</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>lifecycle</exec_depend>

<depend>plansys2_domain_expert</depend>
<depend>plansys2_problem_expert</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
;; Command was: ./tools/problem_generator.py
;; Working directory was: /home/vagrant/isaac/astrobee/survey_manager/survey_planner
;; Problem template: pddl/jem_survey_template.pddl
;; Config 1: data/jem_survey_static.yaml
;; Config 1: data/survey_static.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remember it's not currently in scope to manage inter-module moves with the survey manager. It would be viable to use different static config files for the JEM and USL surveys, and might be simpler. At least we should keep that in mind as an open option.

;; Config 2: data/jem_survey_dynamic.yaml

(define (problem jem-survey)
Expand Down Expand Up @@ -246,7 +246,7 @@
;; # conditions and initial state. A likely conops is that the initial version of this file for a
;; # specific activity would be hand-generated, but it might later be automatically regenerated by the
;; # survey manager when a replan is needed (remove completed/failed goals, add retry goals, update
;; # initial state to match actual current state, etc.) See also jem_survey_static.yaml.
;; # initial state to match actual current state, etc.) See also survey_static.yaml.
;;
;; goals:
;;
Expand Down
124 changes: 124 additions & 0 deletions astrobee/survey_manager/survey_planner/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,127 @@
Planning and scheduling of queued survey actions using Playsys2 for PDDL solutions and behavior trees for execution.

Based on [preliminary work](https://github.com/traclabs/astrobee_task_planning_ws) by [Ana](https://github.com/ana-GT) at [Traclabs](https://traclabs.com).

## Starting suvey planner

The survey_planner as of now starts separately from the isaac fsw. This is necessary because the planner crashes very easily, so having the ability to easily restart this component is necessary.

To start the planner and the terminal interface (in the robot, add the prefix `/opt/isaac/env_wrapper.sh`):

roslaunch survey_planner survey_domain.launch
rosrun plansys2_terminal plansys2_terminal

To monitor an execution and to input commands to the execution:

rosrun survey_planner monitor_astrobee $ROBOTNAME

## Running actions manually

There are 5 different actions at the moment 'move', 'dock', 'undock', 'panorama', 'stereo'.
To run each action individually through the survey_planner you must add the correct predicates before sending the action command or else the plansys2 executor will crash. Also, if you want to re-send the action you'll want to re-send the predicates too.

Don't forget to change the commands to use the target robot's name (bumble is what is used in simulation)

If the survey_planner crashes sometimes the simulation has to be restarted, for it to restart in a good state.

### Move

set instance bumble robot
set instance jem_bay7 location
set instance jem_bay6 location
set instance jem_bay5 location

set predicate (robot-available bumble)
set predicate (robot-at bumble jem_bay7)
set predicate (location-available jem_bay6)

set predicate (move-connected jem_bay7 jem_bay6)
set predicate (location-real jem_bay6)
set predicate (locations-different jem_bay5 jem_bay7)
set predicate (move-connected jem_bay5 jem_bay6)
set predicate (location-available jem_bay5)


run action (move bumble jem_bay7 jem_bay6 jem_bay5)

### Dock

set instance bumble robot
set instance jem_bay7 location
set instance berth1 location

set predicate (robot-available bumble)
set predicate (robot-at bumble jem_bay7)
set predicate (dock-connected jem_bay7 berth1)
set predicate (location-available berth1)

run action (dock bumble jem_bay7 berth1)


### Undock


set instance bumble robot
set instance jem_bay6 location
set instance jem_bay7 location
set instance jem_bay8 location
set instance berth1 location

set predicate (robot-available bumble)
set predicate (robot-at bumble berth1)
set predicate (dock-connected jem_bay7 berth1)
set predicate (location-available jem_bay7)
set predicate (location-real jem_bay7)
set predicate (locations-different jem_bay8 jem_bay6)
set predicate (move-connected jem_bay8 jem_bay7)
set predicate (move-connected jem_bay6 jem_bay7)
set predicate (location-available jem_bay8)
set predicate (location-available jem_bay6)

run action (undock bumble berth1 jem_bay7 jem_bay8 jem_bay6)


### Panorama

set instance bumble robot
set instance jem_bay6 location
set instance o0 order

set predicate (robot-available bumble)

set function (= (order-identity o0) 0)
set function (= (robot-order bumble) -1)

set predicate (robot-at bumble jem_bay6)

run action (panorama bumble o0 jem_bay6)


### Stereo


set instance bumble robot
set instance jem_bay7 location
set instance jem_bay6 location
set instance jem_bay5 location
set instance jem_bay4 location
set instance jem_bay3 location
set instance o0 order


set predicate (robot-available bumble)
set predicate (robot-at bumble jem_bay7)
set predicate (location-real jem_bay4)
set predicate (need-stereo bumble o0 jem_bay7 jem_bay4)
set predicate (location-available jem_bay4)
set predicate (locations-different jem_bay5 jem_bay3)
set predicate (move-connected jem_bay5 jem_bay4)
set predicate (move-connected jem_bay3 jem_bay4)
set predicate (location-available jem_bay5)
set predicate (location-available jem_bay3)

set function (= (order-identity o0) 0)
set function (= (robot-order bumble) -1)


run action (stereo bumble o0 jem_bay7 jem_bay4 jem_bay5 jem_bay3)
7 changes: 7 additions & 0 deletions astrobee/survey_manager/survey_planner/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from distutils.core import setup

from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup(packages=["survey_planner"], package_dir={"": "tools"})

setup(**d)
Loading