diff --git a/astrobee/config/robots/sim.config b/astrobee/config/robots/sim.config
index 2510117a97..0bda16c4c4 100644
--- a/astrobee/config/robots/sim.config
+++ b/astrobee/config/robots/sim.config
@@ -108,7 +108,7 @@ agent_name = "sim"
heartbeat_queue_size = 20
-nodes_not_running = {"light_flow"}
+nodes_not_running = {"dds_ros_bridge", "astrobee_astrobee_bridge", "light_flow", "data_bagger", "handrail_detect", "image_sampler", "pico_driver", "planner_qp"}
bags_save_directory = "/tmp/bags"
diff --git a/astrobee/config/simulation/simulation.config b/astrobee/config/simulation/simulation.config
index 51bd34bb26..1e55bb2763 100644
--- a/astrobee/config/simulation/simulation.config
+++ b/astrobee/config/simulation/simulation.config
@@ -28,7 +28,7 @@ disable_cameras_on_speedup = true;
-- cost. Setting the rate to zero effectively disables the camera. By default
-- we only enable the haz_cam, because it's needed for obstacle detection.
-nav_cam_rate = 0.0;
-dock_cam_rate = 0.0;
+nav_cam_rate = 1.0;
+dock_cam_rate = 1.0;
perch_cam_rate = 5.0;
haz_cam_rate = 5.0;
diff --git a/astrobee/launch/astrobee.launch.py b/astrobee/launch/astrobee.launch.py
index c12a8cf905..cd8065f57f 100644
--- a/astrobee/launch/astrobee.launch.py
+++ b/astrobee/launch/astrobee.launch.py
@@ -17,7 +17,8 @@
from utilities.utilities import *
-
+from launch.actions import GroupAction
+from launch_ros.actions import PushRosNamespace
def generate_launch_description():
robot_description = Command(['xacro ', get_path('urdf/model.urdf.xacro', 'description'),
@@ -63,56 +64,71 @@ def generate_launch_description():
# Set the TF prefix, create a robot description and joint state publisher
Node(
package="robot_state_publisher",
- namespace="",
+ namespace=LaunchConfiguration("ns"),
executable="robot_state_publisher",
name="robot_state_publisher",
- parameters=[{'robot_description': ParameterValue(robot_description) }],
+ parameters=[
+ {'use_sim_time': True},
+ {'robot_description': ParameterValue(robot_description) }
+ ],
),
# If we need to load synthetic drivers (we are not running on a real robot)
# TODO(asymingt) - pass nodes, spurn and extra into gazebo
- IncludeLaunchDescription(
- get_launch_file("launch/controller/synthetic.launch.py"),
- launch_arguments={
- "world": LaunchConfiguration("world"), # Don't start driver nodes
- "ns" : LaunchConfiguration("ns"), # Prevent node
- "sim" : LaunchConfiguration("sim"), # Launch node group
- "pose" : LaunchConfiguration("pose"), # Inject extra nodes
- "bag" : LaunchConfiguration("bag"), # Debug a node set
- "robot_description" : robot_description, # Robot description
- }.items(),
- condition=UnlessCondition(LaunchConfiguration("drivers"))
+ GroupAction(
+ actions=[
+ PushRosNamespace(LaunchConfiguration('ns')),
+ IncludeLaunchDescription(
+ get_launch_file("launch/controller/synthetic.launch.py"),
+ launch_arguments={
+ "world": LaunchConfiguration("world"), # Don't start driver nodes
+ "ns" : LaunchConfiguration("ns"), # Prevent node
+ "sim" : LaunchConfiguration("sim"), # Launch node group
+ "pose" : LaunchConfiguration("pose"), # Inject extra nodes
+ "bag" : LaunchConfiguration("bag"), # Debug a node set
+ "robot_description" : robot_description, # Robot description
+ }.items(),
+ condition=UnlessCondition(LaunchConfiguration("drivers"))
+ )
+ ]
),
# LLP
-#
-#
-#
- IncludeLaunchDescription(
- get_launch_file("launch/robot/LLP.launch.py"),
- launch_arguments={
- "drivers": LaunchConfiguration("drivers"), # Don't start driver nodes
- "spurn" : LaunchConfiguration("spurn"), # Prevent node
- "nodes" : LaunchConfiguration("nodes"), # Launch node group
- "extra" : LaunchConfiguration("extra"), # Inject extra nodes
- "debug" : LaunchConfiguration("debug"), # Debug a node set
- "output" : LaunchConfiguration("output"),
- "gtloc" : LaunchConfiguration("gtloc"), # Use Ground Truth Localizer
- }.items(),
- condition=LaunchConfigurationNotEquals("llp", "disabled"),
+ #
+ #
+ #
+ GroupAction(
+ actions=[
+ PushRosNamespace(LaunchConfiguration('ns')),
+ IncludeLaunchDescription(
+ get_launch_file("launch/robot/LLP.launch.py"),
+ launch_arguments={
+ "drivers": LaunchConfiguration("drivers"), # Don't start driver nodes
+ "spurn" : LaunchConfiguration("spurn"), # Prevent node
+ "nodes" : LaunchConfiguration("nodes"), # Launch node group
+ "extra" : LaunchConfiguration("extra"), # Inject extra nodes
+ "debug" : LaunchConfiguration("debug"), # Debug a node set
+ "output" : LaunchConfiguration("output"),
+ "gtloc" : LaunchConfiguration("gtloc"), # Use Ground Truth Localizer
+ }.items(),
+ condition=LaunchConfigurationNotEquals("llp", "disabled"),
+ )
+ ]
),
-
# MLP
-#
-#
-#
- IncludeLaunchDescription(
- get_launch_file("launch/robot/MLP.launch.py"),
- launch_arguments={
+ #
+ #
+ #
+ GroupAction(
+ actions=[
+ PushRosNamespace(LaunchConfiguration('ns')),
+ IncludeLaunchDescription(
+ get_launch_file("launch/robot/MLP.launch.py"),
+ launch_arguments={
"drivers": LaunchConfiguration("drivers"), # Don't start driver nodes
"spurn" : LaunchConfiguration("spurn"), # Prevent node
"nodes" : LaunchConfiguration("nodes"), # Launch node group
@@ -120,9 +136,12 @@ def generate_launch_description():
"debug" : LaunchConfiguration("debug"), # Debug a node set
"output" : LaunchConfiguration("output"),
"gtloc" : LaunchConfiguration("gtloc"), # Use Ground Truth Localizer
- }.items(),
- condition=LaunchConfigurationNotEquals("llp", "disabled"),
- ),
+ }.items(),
+ condition=LaunchConfigurationNotEquals("llp", "disabled"),
+ )
+ ]
+ )
+
])
diff --git a/astrobee/launch/controller/rviz.launch.py b/astrobee/launch/controller/rviz.launch.py
index ff9f5bf27b..a1246b1dda 100644
--- a/astrobee/launch/controller/rviz.launch.py
+++ b/astrobee/launch/controller/rviz.launch.py
@@ -33,6 +33,7 @@ def generate_launch_description():
namespace="",
executable="rviz2",
name="rviz_node",
+ parameters=[{'use_sim_time': True}],
arguments=["-d", PathJoinSubstitution([get_package_share_directory("astrobee"),"resources/rviz",LaunchConfiguration("rviz_file")])],
respawn=True,
),
diff --git a/astrobee/launch/robot/LLP.launch.py b/astrobee/launch/robot/LLP.launch.py
index d2f5b94485..59959404ae 100644
--- a/astrobee/launch/robot/LLP.launch.py
+++ b/astrobee/launch/robot/LLP.launch.py
@@ -59,12 +59,14 @@ def generate_launch_description():
package='ctl',
plugin='ctl::CtlComponent',
name='ctl',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
ComposableNode(
package='fam',
plugin='fam::FamComponent',
name='fam',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
ComposableNodeContainer(
@@ -193,7 +195,8 @@ def generate_launch_description():
package='light_flow',
plugin='light_flow::LightFlowComponent',
name='light_flow',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
])
diff --git a/astrobee/launch/robot/MLP.launch.py b/astrobee/launch/robot/MLP.launch.py
index efb535109b..31259375ea 100644
--- a/astrobee/launch/robot/MLP.launch.py
+++ b/astrobee/launch/robot/MLP.launch.py
@@ -59,12 +59,14 @@ def generate_launch_description():
package='localization_manager',
plugin='localization_manager::LocalizationManagerComponent',
name='localization_manager',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
ComposableNode(
package='ground_truth_localizer',
plugin='ground_truth_localizer::GroundTruthLocalizerComponent',
name='ground_truth_localizer',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
# ComposableNode(
# package='image_sampler',
# plugin='image_sampler::ImageSampler',
@@ -85,7 +87,8 @@ def generate_launch_description():
package='localization_manager',
plugin='localization_manager::LocalizationManagerNodelet',
name='localization_manager',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
# ComposableNode(
# package='image_sampler',
# plugin='image_sampler::ImageSampler',
@@ -226,25 +229,28 @@ def generate_launch_description():
package='mapper',
plugin='mapper::MapperComponent',
name='mapper',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
ComposableNodeContainer(
name='mlp_management',
namespace='',
package='rclcpp_components',
- executable='component_container',
+ executable='component_container_mt',
composable_node_descriptions=[
- # ComposableNode(
- # package='executive',
- # plugin='executive::Executive',
- # name='executive',
- # extra_arguments=[{'use_intra_process_comms': True}]),
- # ComposableNode(
- # package='access_control',
- # plugin='access_control::AccessControl',
- # name='access_control',
- # extra_arguments=[{'use_intra_process_comms': True}]),
+ ComposableNode(
+ package='executive',
+ plugin='executive::Executive',
+ name='executive',
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
+ ComposableNode(
+ package='access_control',
+ plugin='access_control::AccessControl',
+ name='access_control',
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
ComposableNodeContainer(
@@ -291,11 +297,12 @@ def generate_launch_description():
executable='component_container',
condition=UnlessCondition(LaunchConfiguration("drivers")),
composable_node_descriptions=[
- # ComposableNode(
- # package='sys_monitor',
- # plugin='sys_monitor::SysMonitor',
- # name='sys_monitor',
- # extra_arguments=[{'use_intra_process_comms': True}]),
+ ComposableNode(
+ package='sys_monitor',
+ plugin='sys_monitor::SysMonitor',
+ name='sys_monitor',
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
ComposableNodeContainer(
@@ -348,17 +355,20 @@ def generate_launch_description():
package='choreographer',
plugin='choreographer::ChoreographerComponent',
name='choreographer',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
ComposableNode(
package='planner_trapezoidal',
plugin='planner_trapezoidal::PlannerTrapezoidalComponent',
name='planner_trapezoidal',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
ComposableNode(
package='framestore',
plugin='mobility::FrameStore',
name='framestore',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
ComposableNodeContainer(
@@ -370,7 +380,8 @@ def generate_launch_description():
ComposableNode(
package='arm',
plugin='arm::ArmComponent',
- name='arm'),
+ name='arm',
+ parameters=[{'use_sim_time': True}] ),
]
),
ComposableNodeContainer(
@@ -382,8 +393,10 @@ def generate_launch_description():
ComposableNode(
package='dock',
plugin='dock::DockComponent',
- name='dock'),
- #extra_arguments=[{'use_intra_process_comms': True}]),
+ name='dock',
+ parameters=[{'use_sim_time': True}]
+ #extra_arguments=[{'use_intra_process_comms': False}]
+ ),
]
),
ComposableNodeContainer(
@@ -395,8 +408,10 @@ def generate_launch_description():
ComposableNode(
package='perch',
plugin='perch::PerchComponent',
- name='perch'),
- #extra_arguments=[{'use_intra_process_comms': True}]),
+ name='perch',
+ parameters=[{'use_sim_time': True}],
+ #extra_arguments=[{'use_intra_process_comms': True}]
+ ),
]
),
ComposableNodeContainer(
@@ -423,7 +438,8 @@ def generate_launch_description():
package='states',
plugin='states::StatesComponent',
name='states',
- extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
+ parameters=[{'use_sim_time': True}],
+ extra_arguments=[{'use_intra_process_comms': False}]),
]
),
])
diff --git a/astrobee/resources/rviz/iss_ros2.rviz b/astrobee/resources/rviz/iss_ros2.rviz
index e3b59c5ba1..ea1d4f419b 100644
--- a/astrobee/resources/rviz/iss_ros2.rviz
+++ b/astrobee/resources/rviz/iss_ros2.rviz
@@ -7,8 +7,9 @@ Panels:
- /Global Options1
- /Status1
- /Debug1
+ - /Dock Cam1
Splitter Ratio: 0.5
- Tree Height: 564
+ Tree Height: 433
- Class: rviz_common/Selection
Name: Selection
- Class: rviz_common/Tool Properties
@@ -35,81 +36,81 @@ Visualization Manager:
Frame Timeout: 15
Frames:
All Enabled: true
- ar_tag:
+ bumble/ar_tag:
Value: true
- body:
+ bumble/body:
Value: true
- dock/berth1:
+ bumble/dock_cam:
Value: true
- dock/berth1/approach:
+ bumble/flashlight_aft:
Value: true
- dock/berth1/complete:
+ bumble/flashlight_front:
Value: true
- dock/berth2:
+ bumble/handrail/approach:
Value: true
- dock/berth2/approach:
+ bumble/handrail/body:
Value: true
- dock/berth2/complete:
+ bumble/handrail/complete:
Value: true
- dock/body:
+ bumble/haz_cam:
Value: true
- dock_cam:
+ bumble/imu:
Value: true
- flashlight_aft:
+ bumble/inertial_link:
Value: true
- flashlight_front:
+ bumble/laser:
Value: true
- granite/body:
+ bumble/nav_cam:
Value: true
- handrail/approach:
+ bumble/payload/bottom_aft:
Value: true
- handrail/body:
+ bumble/payload/bottom_front:
Value: true
- handrail/complete:
+ bumble/payload/top_aft:
Value: true
- haz_cam:
+ bumble/payload/top_front:
Value: true
- imu:
+ bumble/perch_cam:
Value: true
- inertial_link:
+ bumble/sci_cam:
Value: true
- iss/body:
+ bumble/top_aft:
Value: true
- laser:
+ bumble/top_aft_arm_distal_link:
Value: true
- nav_cam:
+ bumble/top_aft_arm_proximal_link:
Value: true
- payload/bottom_aft:
+ bumble/top_aft_gripper_left_distal_link:
Value: true
- payload/bottom_front:
+ bumble/top_aft_gripper_left_proximal_link:
Value: true
- payload/top_aft:
+ bumble/top_aft_gripper_right_distal_link:
Value: true
- payload/top_front:
+ bumble/top_aft_gripper_right_proximal_link:
Value: true
- perch/body:
+ bumble/truth:
Value: true
- perch_cam:
+ dock/berth1:
Value: true
- rviz:
+ dock/berth1/approach:
Value: true
- sci_cam:
+ dock/berth1/complete:
Value: true
- top_aft:
+ dock/berth2:
Value: true
- top_aft_arm_distal_link:
+ dock/berth2/approach:
Value: true
- top_aft_arm_proximal_link:
+ dock/berth2/complete:
Value: true
- top_aft_gripper_left_distal_link:
+ dock/body:
Value: true
- top_aft_gripper_left_proximal_link:
+ granite/body:
Value: true
- top_aft_gripper_right_distal_link:
+ iss/body:
Value: true
- top_aft_gripper_right_proximal_link:
+ perch/body:
Value: true
- truth:
+ rviz:
Value: true
world:
Value: true
@@ -120,6 +121,48 @@ Visualization Manager:
Show Names: false
Tree:
world:
+ bumble/body:
+ bumble/ar_tag:
+ {}
+ bumble/dock_cam:
+ {}
+ bumble/flashlight_aft:
+ {}
+ bumble/flashlight_front:
+ {}
+ bumble/haz_cam:
+ {}
+ bumble/imu:
+ {}
+ bumble/inertial_link:
+ {}
+ bumble/laser:
+ {}
+ bumble/nav_cam:
+ {}
+ bumble/payload/bottom_aft:
+ {}
+ bumble/payload/bottom_front:
+ {}
+ bumble/payload/top_aft:
+ {}
+ bumble/payload/top_front:
+ {}
+ bumble/perch_cam:
+ {}
+ bumble/sci_cam:
+ {}
+ bumble/top_aft:
+ bumble/top_aft_arm_proximal_link:
+ bumble/top_aft_arm_distal_link:
+ bumble/top_aft_gripper_left_proximal_link:
+ bumble/top_aft_gripper_left_distal_link:
+ {}
+ bumble/top_aft_gripper_right_proximal_link:
+ bumble/top_aft_gripper_right_distal_link:
+ {}
+ bumble/truth:
+ {}
dock/body:
dock/berth1:
dock/berth1/approach:
@@ -139,8 +182,6 @@ Visualization Manager:
{}
rviz:
{}
- truth:
- {}
Update Interval: 0
Value: true
- Class: rviz_common/Group
@@ -281,25 +322,20 @@ Visualization Manager:
History Policy: Keep Last
Reliability Policy: Reliable
Value: /handrail_21_5/robot_description
- Enabled: true
+ Enabled: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
- body:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
Mass Properties:
Inertia: false
Mass: false
Name: Handrail
TF Prefix: handrail
Update Interval: 0
- Value: true
+ Value: false
Visual Enabled: true
- Alpha: 1
Class: rviz_default_plugins/RobotModel
@@ -311,65 +347,21 @@ Visualization Manager:
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
- Value: /robot_description
- Enabled: true
+ Value: /honey/robot_description
+ Enabled: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
- body:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- inertial_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- top_aft:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
Mass Properties:
Inertia: false
Mass: false
Name: Honey
- TF Prefix: honey
+ TF Prefix: ""
Update Interval: 0
- Value: true
+ Value: false
Visual Enabled: true
- Alpha: 1
Class: rviz_default_plugins/RobotModel
@@ -381,65 +373,21 @@ Visualization Manager:
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
- Value: /robot_description
- Enabled: true
+ Value: /bumble/robot_description
+ Enabled: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
- body:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- inertial_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- top_aft:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
Mass Properties:
Inertia: false
Mass: false
Name: Bumble
- TF Prefix: bumble
+ TF Prefix: ""
Update Interval: 0
- Value: true
+ Value: false
Visual Enabled: true
- Alpha: 1
Class: rviz_default_plugins/RobotModel
@@ -451,65 +399,21 @@ Visualization Manager:
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
- Value: /robot_description
- Enabled: true
+ Value: /queen/robot_description
+ Enabled: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
- body:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- inertial_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- top_aft:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
Mass Properties:
Inertia: false
Mass: false
Name: Queen
- TF Prefix: queen
+ TF Prefix: ""
Update Interval: 0
- Value: true
+ Value: false
Visual Enabled: true
- Class: rviz_common/Group
Displays:
@@ -524,64 +428,20 @@ Visualization Manager:
History Policy: Keep Last
Reliability Policy: Reliable
Value: /robot_description
- Enabled: true
+ Enabled: false
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
- body:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- inertial_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- top_aft:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_arm_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_left_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_distal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
- top_aft_gripper_right_proximal_link:
- Alpha: 1
- Show Axes: false
- Show Trail: false
- Value: true
Mass Properties:
Inertia: false
Mass: false
Name: /
TF Prefix: ""
Update Interval: 0
- Value: true
+ Value: false
Visual Enabled: true
- Class: rviz_common/Group
Displays: ~
@@ -675,16 +535,16 @@ Visualization Manager:
Views:
Current:
Class: rviz_default_plugins/Orbit
- Distance: 2.0104706287384033
+ Distance: 2.5802009105682373
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
- X: 9.056347846984863
- Y: 10.248156547546387
- Z: -2.718514919281006
+ X: 8.70544147491455
+ Y: 8.735550880432129
+ Z: -2.141327142715454
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
@@ -700,12 +560,12 @@ Window Geometry:
collapsed: false
Dock Cam:
collapsed: false
- Height: 1245
+ Height: 1043
Hide Left Dock: false
Hide Right Dock: false
Nav Cam:
collapsed: false
- QMainWindow State: 000000ff00000000fd00000004000000000000025a00000443fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002bd000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb000000100044006f0063006b002000430061006d01000002fe000000a80000002800fffffffb0000000e004e00610076002000430061006d01000003ac000000d20000002800ffffff000000010000010f00000443fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b00000443000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000008700000003efc0100000002fb0000000800540069006d00650100000000000008700000024400fffffffb0000000800540069006d00650100000000000004500000000000000000000004fb0000044300000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+ QMainWindow State: 000000ff00000000fd00000004000000000000016700000379fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b0000023a000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb000000100044006f0063006b002000430061006d010000027b000000890000002800fffffffb0000000e004e00610076002000430061006d010000030a000000aa0000002800ffffff000000010000010f00000379fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b00000379000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007800000003efc0100000002fb0000000800540069006d00650100000000000007800000024400fffffffb0000000800540069006d00650100000000000004500000000000000000000004fe0000037900000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
@@ -714,6 +574,6 @@ Window Geometry:
collapsed: false
Views:
collapsed: false
- Width: 2160
- X: 241
- Y: 152
+ Width: 1920
+ X: 0
+ Y: 0
diff --git a/behaviors/dock/src/dock_component.cc b/behaviors/dock/src/dock_component.cc
index 14c538de36..63a344845c 100644
--- a/behaviors/dock/src/dock_component.cc
+++ b/behaviors/dock/src/dock_component.cc
@@ -778,7 +778,12 @@ class DockComponent : public ff_util::FreeFlyerComponent {
// Package up the desired end pose
geometry_msgs::PoseStamped msg;
msg.header.stamp = GetTimeNow();
- ff_util::ConfigClient cfg(node_, NODE_CHOREOGRAPHER);
+
+ // ConfigClient blocks when Setting parameters. Creating a new node prevent this
+ std::string platform = this->GetPlatform();
+ std::shared_ptr temp_node = std::make_shared("temporal_dock_node", platform, rclcpp::NodeOptions().use_global_arguments(false));
+ ff_util::ConfigClient cfg(temp_node, NODE_CHOREOGRAPHER);
+
// Set parameters for the choreographer
cfg.Set("enable_collision_checking", false);
cfg.Set("enable_validation", false);
diff --git a/localization/ground_truth_localizer/include/ground_truth_localizer/ground_truth_localizer_component.h b/localization/ground_truth_localizer/include/ground_truth_localizer/ground_truth_localizer_component.h
index a029966f19..4a1b185c95 100644
--- a/localization/ground_truth_localizer/include/ground_truth_localizer/ground_truth_localizer_component.h
+++ b/localization/ground_truth_localizer/include/ground_truth_localizer/ground_truth_localizer_component.h
@@ -64,7 +64,7 @@ class GroundTruthLocalizerComponent : public ff_util::FreeFlyerComponent {
private:
void Initialize(NodeHandle &nh);
- void SubscribeAndAdvertise(NodeHandle &nh);
+ void SubscribeAndAdvertise();
bool SetMode(const std::shared_ptr req,
std::shared_ptr res);
@@ -78,7 +78,6 @@ class GroundTruthLocalizerComponent : public ff_util::FreeFlyerComponent {
void PublishLocState(const localization_common::Time& timestamp);
- NodeHandle node_;
std::string platform_name_;
rclcpp::Time last_time_;
boost::optional pose_;
diff --git a/localization/ground_truth_localizer/src/ground_truth_localizer_component.cc b/localization/ground_truth_localizer/src/ground_truth_localizer_component.cc
index 7dbaef2d1c..43dcf82834 100644
--- a/localization/ground_truth_localizer/src/ground_truth_localizer_component.cc
+++ b/localization/ground_truth_localizer/src/ground_truth_localizer_component.cc
@@ -34,36 +34,35 @@ GroundTruthLocalizerComponent::GroundTruthLocalizerComponent(const rclcpp::NodeO
void GroundTruthLocalizerComponent::Initialize(NodeHandle &nh) {
platform_name_ = GetPlatform();
platform_name_ = (platform_name_.empty() ? "" : platform_name_ + "/");
- SubscribeAndAdvertise(nh);
+ SubscribeAndAdvertise();
// Initialize the transform broadcaster
transform_pub_ = std::make_unique(*nh);
}
-void GroundTruthLocalizerComponent::SubscribeAndAdvertise(NodeHandle &nh) {
- node_ = nh;
- pose_pub_ = FF_CREATE_PUBLISHER(nh, geometry_msgs::PoseStamped, TOPIC_LOCALIZATION_POSE, 1);
- twist_pub_ = FF_CREATE_PUBLISHER(nh, geometry_msgs::TwistStamped, TOPIC_LOCALIZATION_TWIST, 1);
- state_pub_ = FF_CREATE_PUBLISHER(nh, ff_msgs::EkfState, TOPIC_GNC_EKF, 1);
- heartbeat_pub_ = FF_CREATE_PUBLISHER(nh, ff_msgs::Heartbeat, TOPIC_HEARTBEAT, 5);
- reset_pub_ = FF_CREATE_PUBLISHER(nh, std_msgs::Empty, TOPIC_GNC_EKF_RESET, 10);
+void GroundTruthLocalizerComponent::SubscribeAndAdvertise() {
+ pose_pub_ = FF_CREATE_PUBLISHER(node_, geometry_msgs::PoseStamped, TOPIC_LOCALIZATION_POSE, 1);
+ twist_pub_ = FF_CREATE_PUBLISHER(node_, geometry_msgs::TwistStamped, TOPIC_LOCALIZATION_TWIST, 1);
+ state_pub_ = FF_CREATE_PUBLISHER(node_, ff_msgs::EkfState, TOPIC_GNC_EKF, 1);
+ heartbeat_pub_ = FF_CREATE_PUBLISHER(node_, ff_msgs::Heartbeat, TOPIC_HEARTBEAT, 5);
+ reset_pub_ = FF_CREATE_PUBLISHER(node_, std_msgs::Empty, TOPIC_GNC_EKF_RESET, 10);
- pose_sub_ = FF_CREATE_SUBSCRIBER(nh, geometry_msgs::PoseStamped,
+ pose_sub_ = FF_CREATE_SUBSCRIBER(node_, geometry_msgs::PoseStamped,
TOPIC_LOCALIZATION_TRUTH, 1,
std::bind(&GroundTruthLocalizerComponent::PoseCallback, this, std::placeholders::_1));
- twist_sub_ = FF_CREATE_SUBSCRIBER(nh, geometry_msgs::TwistStamped,
+ twist_sub_ = FF_CREATE_SUBSCRIBER(node_, geometry_msgs::TwistStamped,
TOPIC_LOCALIZATION_TRUTH_TWIST, 1,
std::bind(&GroundTruthLocalizerComponent::TwistCallback, this, std::placeholders::_1));
- input_mode_srv_ = nh->create_service(
+ input_mode_srv_ = node_->create_service(
SERVICE_GNC_EKF_SET_INPUT,
std::bind(&GroundTruthLocalizerComponent::SetMode, this, std::placeholders::_1, std::placeholders::_2));
- bias_srv_ = FF_CREATE_SERVICE(nh, std_srvs::Empty, SERVICE_GNC_EKF_INIT_BIAS,
+ bias_srv_ = FF_CREATE_SERVICE(node_, std_srvs::Empty, SERVICE_GNC_EKF_INIT_BIAS,
std::bind(&GroundTruthLocalizerComponent::DefaultServiceResponse,
this, std::placeholders::_1, std::placeholders::_2));
- bias_from_file_srv_ = FF_CREATE_SERVICE(nh, std_srvs::Empty, SERVICE_GNC_EKF_INIT_BIAS_FROM_FILE,
+ bias_from_file_srv_ = FF_CREATE_SERVICE(node_, std_srvs::Empty, SERVICE_GNC_EKF_INIT_BIAS_FROM_FILE,
std::bind(&GroundTruthLocalizerComponent::DefaultServiceResponse,
this, std::placeholders::_1, std::placeholders::_2));
- reset_srv_ = FF_CREATE_SERVICE(nh, std_srvs::Empty, SERVICE_GNC_EKF_RESET,
+ reset_srv_ = FF_CREATE_SERVICE(node_, std_srvs::Empty, SERVICE_GNC_EKF_RESET,
std::bind(&GroundTruthLocalizerComponent::DefaultServiceResponse,
this, std::placeholders::_1, std::placeholders::_2));
}
diff --git a/localization/localization_common/include/localization_common/time.h b/localization/localization_common/include/localization_common/time.h
index 6e1c62d83e..d01d7717c4 100644
--- a/localization/localization_common/include/localization_common/time.h
+++ b/localization/localization_common/include/localization_common/time.h
@@ -19,9 +19,11 @@
#ifndef LOCALIZATION_COMMON_TIME_H_
#define LOCALIZATION_COMMON_TIME_H_
+#include
+
namespace localization_common {
using Time = double;
-Time GetTime(const int seconds, const int nanoseconds);
+Time GetTime(const int seconds, const unsigned int nanoseconds);
} // namespace localization_common
#endif // LOCALIZATION_COMMON_TIME_H_
diff --git a/localization/localization_common/src/time.cc b/localization/localization_common/src/time.cc
index faae1fab89..ff7d517bdb 100644
--- a/localization/localization_common/src/time.cc
+++ b/localization/localization_common/src/time.cc
@@ -19,5 +19,5 @@
#include
namespace localization_common {
-Time GetTime(const int seconds, const int nanoseconds) { return seconds + 1e-9 * nanoseconds; }
+Time GetTime(const int seconds, const unsigned int nanoseconds) { return (Time) seconds + 1e-9 * (Time) nanoseconds; }
} // namespace localization_common
diff --git a/localization/localization_common/src/utilities.cc b/localization/localization_common/src/utilities.cc
index 157db93275..705063c39c 100644
--- a/localization/localization_common/src/utilities.cc
+++ b/localization/localization_common/src/utilities.cc
@@ -80,7 +80,12 @@ Time TimeFromHeader(const std_msgs::Header& header) { return GetTime(header.stam
Time TimeFromRosTime(const rclcpp::Time& time) { return GetTime(time.seconds(), time.nanoseconds()); }
-void TimeToHeader(const Time timestamp, std_msgs::Header& header) { header.stamp = rclcpp::Time(timestamp); }
+rclcpp::Time TimeToRosTime(const Time timestamp) {
+ int sec = (int)(floor(timestamp)); int nanosec = (timestamp - floor(timestamp))*1e9;
+ return rclcpp::Time(sec, nanosec, RCL_ROS_TIME);
+}
+
+void TimeToHeader(const Time timestamp, std_msgs::Header& header) { header.stamp = TimeToRosTime(timestamp); }
gtsam::Pose3 PoseFromMsg(const geometry_msgs::PoseStamped& msg) { return PoseFromMsg(msg.pose); }
diff --git a/management/access_control/CMakeLists.txt b/management/access_control/CMakeLists.txt
index 9994424934..1a8da8bdd4 100644
--- a/management/access_control/CMakeLists.txt
+++ b/management/access_control/CMakeLists.txt
@@ -23,7 +23,7 @@ if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
-set( CMAKE_CXX_FLAGS "${CMAKE_CXXX_FLAGS} -Wall -Werror -O3 -fPIC" )
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O3 -fPIC" )
## Find ament and libraries
find_package(ament_cmake REQUIRED)
diff --git a/management/executive/CMakeLists.txt b/management/executive/CMakeLists.txt
index 78722e80d1..3640ddd792 100644
--- a/management/executive/CMakeLists.txt
+++ b/management/executive/CMakeLists.txt
@@ -15,45 +15,33 @@
# License for the specific language governing permissions and limitations
# under the License.
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.5)
project(executive)
## Compile as C++14, supported in ROS Kinetic and newer
+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
add_compile_options(-std=c++14)
-add_definitions(-DROS1)
-
-## Find catkin macros and libraries
-find_package(catkin2 REQUIRED COMPONENTS
- roscpp
- ff_msgs
- ff_hw_msgs
- nodelet
- config_reader
- ff_util
- jsonloader
-)
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O3 -fPIC" )
+
+## Find ament and libraries
+find_package(ament_cmake REQUIRED)
+find_package(rclcpp REQUIRED)
+find_package(rclcpp_components REQUIRED)
+find_package(ff_msgs REQUIRED)
+find_package(ff_hw_msgs REQUIRED)
+find_package(config_reader REQUIRED)
+find_package(ff_util REQUIRED)
+find_package(jsonloader REQUIRED)
# System dependencies are found with CMake's conventions
-find_package(cmake_modules REQUIRED)
find_package(Boost REQUIRED COMPONENTS system iostreams)
# Find jsoncpp
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../cmake")
find_package(JsonCpp REQUIRED)
-catkin_package(
- LIBRARIES
- executive
- sequencer
- CATKIN_DEPENDS
- roscpp
- ff_msgs
- ff_hw_msgs
- nodelet
- ff_util
- jsonloader
-)
-
###########
## Build ##
###########
@@ -61,21 +49,20 @@ catkin_package(
# Specify additional locations of header files
include_directories(
include
- ${catkin_INCLUDE_DIRS}
${JSONCPP_INCLUDE_DIR}
)
# Declare C++ libraries
-add_library(sequencer
+add_library(sequencer SHARED
src/utils/sequencer/command_conversion.cc
src/utils/sequencer/plan_io.cc
src/utils/sequencer/sequencer.cc
)
-add_dependencies(sequencer ${catkin_EXPORTED_TARGETS})
-target_link_libraries(sequencer ${Boost_IOSTREAMS_LIBRARY} ${catkin_LIBRARIES})
+target_link_libraries(sequencer ${Boost_LIBRARIES})
+ament_target_dependencies(sequencer rclcpp rclcpp_components ff_common ff_msgs ff_hw_msgs config_reader ff_util jsonloader Boost)
# Declare C++ libraries
-add_library(executive
+add_library(executive SHARED
src/executive.cc
src/op_state.cc
src/op_state_auto_return.cc
@@ -85,100 +72,94 @@ add_library(executive
src/op_state_repo.cc
src/op_state_teleop.cc
)
-add_dependencies(executive ${catkin_EXPORTED_TARGETS})
-target_link_libraries(executive sequencer ${Boost_SYSTEM_LIBRARY} ${catkin_LIBRARIES})
-
+target_link_libraries(executive sequencer)
+target_compile_definitions(executive PRIVATE "COMPOSITION_BUILDING_DLL")
+ament_target_dependencies(executive rclcpp rclcpp_components ff_common ff_msgs ff_hw_msgs config_reader ff_util jsonloader)
+rclcpp_components_register_nodes(executive "executive::Executive")
## Declare a C++ executable: data_to_disk_pub
add_executable(data_to_disk_pub tools/data_to_disk_pub.cc)
-add_dependencies(data_to_disk_pub ${catkin_EXPORTED_TARGETS})
-target_link_libraries(data_to_disk_pub
- executive gflags ${catkin_LIBRARIES})
-
-## Declare a C++ executable: ekf_switch_mux
-add_executable(ekf_switch_mux tools/ekf_switch_mux.cc)
-add_dependencies(ekf_switch_mux ${catkin_EXPORTED_TARGETS})
-target_link_libraries(ekf_switch_mux
- executive gflags ${catkin_LIBRARIES})
+ament_target_dependencies(data_to_disk_pub rclcpp ff_common ff_msgs Boost)
+target_link_libraries(data_to_disk_pub executive gflags)
## Declare a C++ executable: plan_pub
add_executable(plan_pub tools/plan_pub.cc)
-add_dependencies(plan_pub ${catkin_EXPORTED_TARGETS})
-target_link_libraries(plan_pub
- executive gflags ${catkin_LIBRARIES} ${Boost_LIBRARIES})
+ament_target_dependencies(plan_pub rclcpp ff_common ff_msgs Boost)
+target_link_libraries(plan_pub executive gflags)
## Declare a C++ executable: simple_move
add_executable(simple_move tools/simple_move.cc)
-add_dependencies(simple_move ${catkin_EXPORTED_TARGETS})
-target_link_libraries(simple_move
- executive gflags ${catkin_LIBRARIES})
+ament_target_dependencies(simple_move rclcpp ff_common ff_msgs Boost)
+target_link_libraries(simple_move executive gflags)
## Declare a C++ executable: teleop_tool
add_executable(teleop_tool tools/teleop_tool.cc)
-add_dependencies(teleop_tool ${catkin_EXPORTED_TARGETS})
-target_link_libraries(teleop_tool
- executive gflags ${catkin_LIBRARIES})
+ament_target_dependencies(teleop_tool rclcpp ff_common ff_msgs Boost)
+target_link_libraries(teleop_tool executive gflags)
## Declare a C++ executable: zones_pub
add_executable(zones_pub tools/zones_pub.cc)
-add_dependencies(zones_pub ${catkin_EXPORTED_TARGETS})
-target_link_libraries(zones_pub
- executive gflags ${catkin_LIBRARIES} ${Boost_LIBRARIES})
+ament_target_dependencies(zones_pub rclcpp ff_common ff_msgs Boost)
+target_link_libraries(zones_pub executive gflags)
+
+if(BUILD_TESTING)
+ find_package(ament_cmake_gtest REQUIRED)
+ find_package(ros_testing REQUIRED)
-if(CATKIN_ENABLE_TESTING)
- find_package(rostest REQUIRED)
# Executive initialization fault tester
- add_rostest_gtest(test_init_executive
- test/test_init_executive.test
- test/test_init_executive.cc
- )
-
- target_link_libraries(test_init_executive
- ${catkin_LIBRARIES} glog
- )
+# ament_add_gtest_executable(test_init_executive
+# test/test_init_executive.cc
+# )
+# target_link_libraries(test_init_executive execute)
+# add_ros_test(test/test_init_executive.py TIMEOUT "30" ARGS "test_binary_dir:=${CMAKE_CURRENT_BINARY_DIR}")
endif()
#############
## Install ##
#############
+ament_export_include_directories(include)
+
# Mark libraries for installation
install(TARGETS sequencer
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
-)
-install(TARGETS ${PROJECT_NAME}
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
+ EXPORT sequencer
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include
)
-# Mark nodelet_plugin for installation
-install(FILES nodelet_plugins.xml
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+install(TARGETS ${PROJECT_NAME}
+ EXPORT executive
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include
)
# Install C++ executables
install(TARGETS data_to_disk_pub DESTINATION bin)
-install(TARGETS ekf_switch_mux DESTINATION bin)
install(TARGETS plan_pub DESTINATION bin)
-install(TARGETS simple_move DESTINATION bin)
-install(TARGETS teleop_tool DESTINATION bin)
-install(TARGETS zones_pub DESTINATION bin)
-install(CODE "execute_process(
- COMMAND ln -s ../../bin/data_to_disk_pub share/${PROJECT_NAME}
- COMMAND ln -s ../../bin/ekf_switch_mux share/${PROJECT_NAME}
- COMMAND ln -s ../../bin/plan_pub share/${PROJECT_NAME}
- COMMAND ln -s ../../bin/simple_move share/${PROJECT_NAME}
- COMMAND ln -s ../../bin/teleop_tool share/${PROJECT_NAME}
- COMMAND ln -s ../../bin/zones_pub share/${PROJECT_NAME}
- WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
- OUTPUT_QUIET
- ERROR_QUIET
- )")
+install(TARGETS simple_move DESTINATION lib/${PROJECT_NAME})
+install(TARGETS teleop_tool RUNTIME DESTINATION lib/${PROJECT_NAME})
+#install(TARGETS zones_pub DESTINATION bin)
+#install(CODE "execute_process(
+# COMMAND ln -s ../../bin/data_to_disk_pub share/${PROJECT_NAME}
+# COMMAND ln -s ../../bin/ekf_switch_mux share/${PROJECT_NAME}
+# COMMAND ln -s ../../bin/plan_pub share/${PROJECT_NAME}
+# COMMAND ln -s ../../bin/simple_move share/${PROJECT_NAME}
+# COMMAND ln -s ../../bin/teleop_tool share/${PROJECT_NAME}
+# COMMAND ln -s ../../bin/zones_pub share/${PROJECT_NAME}
+# WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+# OUTPUT_QUIET
+# ERROR_QUIET
+# )")
# Mark launch files for installation
-install(DIRECTORY launch/
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
- PATTERN ".svn" EXCLUDE)
+install(DIRECTORY include/${PROJECT_NAME}
+ DESTINATION include
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+)
+
+ament_package()
diff --git a/management/executive/COLCON_IGNORE b/management/executive/COLCON_IGNORE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/management/executive/include/executive/executive.h b/management/executive/include/executive/executive.h
index 9d0ccbe338..633266737d 100644
--- a/management/executive/include/executive/executive.h
+++ b/management/executive/include/executive/executive.h
@@ -23,54 +23,54 @@
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
#include
+#include
#include
#include
#include
-#include
+#include
#include
-#include
-#include
-#include
-#include
-#include
+#include
#include
#include
@@ -80,7 +80,8 @@
#include
#include
-using ff_msgs::CommandConstants;
+using ff_msgs::msg::CommandConstants;
+using ff_util::FreeFlyerServiceClient;
namespace executive {
class OpState;
@@ -95,74 +96,78 @@ class OpState;
* ref: state & mediator design pattern
*
*/
-class Executive : public ff_util::FreeFlyerNodelet {
+class Executive : public ff_util::FreeFlyerComponent {
public:
- Executive();
+ explicit Executive(const rclcpp::NodeOptions& options);
~Executive();
// Message and timeout callbacks
- void CameraStatesCallback(ff_msgs::CameraStatesStampedConstPtr const& state);
- void CmdCallback(ff_msgs::CommandStampedPtr const& cmd);
- void DataToDiskCallback(ff_msgs::CompressedFileConstPtr const& data);
- void DockStateCallback(ff_msgs::DockStateConstPtr const& state);
- void FaultStateCallback(ff_msgs::FaultStateConstPtr const& state);
- void GuestScienceAckCallback(ff_msgs::AckStampedConstPtr const& ack);
- void GuestScienceConfigCallback(ff_msgs::GuestScienceConfigConstPtr const&
- config);
- void GuestScienceStateCallback(ff_msgs::GuestScienceStateConstPtr const&
- state);
- void GuestScienceCustomCmdTimeoutCallback(ros::TimerEvent const& te);
- void GuestScienceStartStopRestartCmdTimeoutCallback(ros::TimerEvent const&
- te);
- void InertiaCallback(geometry_msgs::InertiaStampedConstPtr const& inertia);
+ void CameraStatesCallback(
+ ff_msgs::msg::CameraStatesStamped::SharedPtr const state);
+ void CmdCallback(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ void DataToDiskCallback(ff_msgs::msg::CompressedFile::SharedPtr const data);
+ void DockStateCallback(ff_msgs::msg::DockState::SharedPtr const state);
+ void FaultStateCallback(ff_msgs::msg::FaultState::SharedPtr const state);
+ void GuestScienceAckCallback(ff_msgs::msg::AckStamped::SharedPtr const ack);
+ void GuestScienceConfigCallback(
+ ff_msgs::msg::GuestScienceConfig::SharedPtr const config);
+ void GuestScienceStateCallback(
+ ff_msgs::msg::GuestScienceState::SharedPtr const state);
+ void GuestScienceCustomCmdTimeoutCallback();
+ void GuestScienceStartStopRestartCmdTimeoutCallback();
+ void InertiaCallback(
+ geometry_msgs::msg::InertiaStamped::SharedPtr const inertia);
void LedConnectedCallback();
- void MotionStateCallback(ff_msgs::MotionStatePtr const& state);
- void PerchStateCallback(ff_msgs::PerchStateConstPtr const& state);
- void PlanCallback(ff_msgs::CompressedFileConstPtr const& plan);
- void SysMonitorHeartbeatCallback(ff_msgs::HeartbeatConstPtr const& heartbeat);
- void SysMonitorTimeoutCallback(ros::TimerEvent const& te);
- void WaitCallback(ros::TimerEvent const& te);
- void ZonesCallback(ff_msgs::CompressedFileConstPtr const& zones);
+ void MotionStateCallback(ff_msgs::msg::MotionState::SharedPtr const state);
+ void PerchStateCallback(ff_msgs::msg::PerchState::SharedPtr const state);
+ void PlanCallback(ff_msgs::msg::CompressedFile::SharedPtr const plan);
+ void SysMonitorHeartbeatCallback(
+ ff_msgs::msg::Heartbeat::SharedPtr const heartbeat);
+ void SysMonitorTimeoutCallback();
+ void WaitCallback();
+ void ZonesCallback(ff_msgs::msg::CompressedFile::SharedPtr const zones);
// Action based commands
bool AreActionsRunning();
void CancelAction(Action action, std::string cmd);
- bool FillArmGoal(ff_msgs::CommandStampedPtr const& cmd);
- bool FillDockGoal(ff_msgs::CommandStampedPtr const& cmd, bool return_to_dock);
+ bool FillArmGoal(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool FillDockGoal(ff_msgs::msg::CommandStamped::SharedPtr const cmd,
+ bool return_to_dock);
bool FillMotionGoal(Action action,
- ff_msgs::CommandStampedPtr const& cmd = nullptr);
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd = nullptr);
bool IsActionRunning(Action action);
bool StartAction(Action action, std::string const& cmd_id);
bool RemoveAction(Action action);
// Action callbacks
void ArmResultCallback(ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::ArmResultConstPtr const& result);
+ std::shared_ptr result);
void DockResultCallback(ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::DockResultConstPtr const& result);
+ std::shared_ptr const result);
void LocalizationResultCallback(
- ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::LocalizationResultConstPtr const& result);
+ ff_util::FreeFlyerActionState::Enum const& state,
+ std::shared_ptr result);
- void MotionFeedbackCallback(ff_msgs::MotionFeedbackConstPtr const& feedback);
+ void MotionFeedbackCallback(
+ std::shared_ptr feedback);
void MotionResultCallback(ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::MotionResultConstPtr const& result);
+ std::shared_ptr result);
void PerchResultCallback(ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::PerchResultConstPtr const& result);
+ std::shared_ptr result);
// Publishers
void PublishCmdAck(std::string const& cmd_id,
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK,
- std::string const& message = "",
- uint8_t status = ff_msgs::AckStatus::COMPLETED);
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK,
+ std::string const& message = "",
+ uint8_t status = ff_msgs::msg::AckStatus::COMPLETED);
void PublishPlan();
void PublishPlanStatus(uint8_t status);
// Getters
- ff_msgs::MobilityState GetMobilityState();
+ ff_msgs::msg::MobilityState GetMobilityState();
uint8_t GetPlanExecState();
std::string GetRunPlanCmdId();
@@ -174,159 +179,202 @@ class Executive : public ff_util::FreeFlyerNodelet {
void SetRunPlanCmdId(std::string cmd_id);
// Helper functions
- void AckMobilityStateIssue(ff_msgs::CommandStampedPtr const& cmd,
+ void AckMobilityStateIssue(ff_msgs::msg::CommandStamped::SharedPtr const cmd,
std::string const& current_mobility_state,
std::string const& accepted_mobility_state = "");
- bool ArmControl(ff_msgs::CommandStampedPtr const& cmd);
- bool CheckServiceExists(ros::ServiceClient& serviceIn,
+ bool ArmControl(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool CheckServiceExists(bool serviceExists,
std::string const& serviceName,
std::string const& cmd_in);
bool CheckStoppedOrDrifting(std::string const& cmd_id,
std::string const& cmd_name);
- bool ConfigureLed(ff_hw_msgs::ConfigureSystemLeds& led_srv);
+ bool ConfigureLed(
+ ff_util::FreeFlyerService& led_srv);
bool ConfigureMobility(bool move_to_start, std::string& err_msg);
- bool FailCommandIfMoving(ff_msgs::CommandStampedPtr const& cmd);
- bool LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd);
- ros::Time MsToSec(std::string timestamp);
- bool PowerItem(ff_msgs::CommandStampedPtr const& cmd, bool on);
- bool ProcessGuestScienceCommand(ff_msgs::CommandStampedPtr const& cmd);
+ bool FailCommandIfMoving(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool LoadUnloadNodelet(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ rclcpp::Time MsToSec(std::string timestamp);
+ bool PowerItem(ff_msgs::msg::CommandStamped::SharedPtr const cmd, bool on);
+ bool ProcessGuestScienceCommand(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd);
bool ResetEkf(std::string const& cmd_id);
- void StartWaitTimer(float duration);
+ void StartWaitTimer(double duration);
void StopWaitTimer();
+ // Output functions
+ void Debug(std::string output);
+ void Error(std::string output);
+ void Info(std::string output);
+ void Warn(std::string output);
+
// Plan related functions
bool AckCurrentPlanItem();
sequencer::ItemType GetCurrentPlanItemType();
- ff_msgs::CommandStampedPtr GetPlanCommand();
+ ff_msgs::msg::CommandStamped::SharedPtr GetPlanCommand();
bool GetSetPlanInertia(std::string const& cmd_id);
void GetSetPlanOperatingLimits();
// Commands
- bool ArmPanAndTilt(ff_msgs::CommandStampedPtr const& cmd);
- bool AutoReturn(ff_msgs::CommandStampedPtr const& cmd);
- bool CustomGuestScience(ff_msgs::CommandStampedPtr const& cmd);
- bool DeployArm(ff_msgs::CommandStampedPtr const& cmd);
- bool Dock(ff_msgs::CommandStampedPtr const& cmd);
- bool EnableAstrobeeIntercomms(ff_msgs::CommandStampedPtr const& cmd);
- bool Fault(ff_msgs::CommandStampedPtr const& cmd);
- bool GripperControl(ff_msgs::CommandStampedPtr const& cmd);
- bool IdlePropulsion(ff_msgs::CommandStampedPtr const& cmd);
- bool InitializeBias(ff_msgs::CommandStampedPtr const& cmd);
- bool LoadNodelet(ff_msgs::CommandStampedPtr const& cmd);
- bool NoOp(ff_msgs::CommandStampedPtr const& cmd);
- bool PausePlan(ff_msgs::CommandStampedPtr const& cmd);
- bool Perch(ff_msgs::CommandStampedPtr const& cmd);
- bool PowerItemOff(ff_msgs::CommandStampedPtr const& cmd);
- bool PowerItemOn(ff_msgs::CommandStampedPtr const& cmd);
- bool Prepare(ff_msgs::CommandStampedPtr const& cmd);
- bool ReacquirePosition(ff_msgs::CommandStampedPtr const& cmd);
- bool ResetEkf(ff_msgs::CommandStampedPtr const& cmd);
- bool RestartGuestScience(ff_msgs::CommandStampedPtr const& cmd);
- bool RunPlan(ff_msgs::CommandStampedPtr const& cmd);
- bool SetCamera(ff_msgs::CommandStampedPtr const& cmd);
- bool SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd);
- bool SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd);
- bool SetCheckObstacles(ff_msgs::CommandStampedPtr const& cmd);
- bool SetCheckZones(ff_msgs::CommandStampedPtr const& cmd);
- bool SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd);
- bool SetEnableAutoReturn(ff_msgs::CommandStampedPtr const& cmd);
- bool SetEnableImmediate(ff_msgs::CommandStampedPtr const& cmd);
- bool SetEnableReplan(ff_msgs::CommandStampedPtr const& cmd);
- bool SetFlashlightBrightness(ff_msgs::CommandStampedPtr const& cmd);
- bool SetHolonomicMode(ff_msgs::CommandStampedPtr const& cmd);
- bool SetInertia(ff_msgs::CommandStampedPtr const& cmd);
- bool SetOperatingLimits(ff_msgs::CommandStampedPtr const& cmd);
- bool SetPlan(ff_msgs::CommandStampedPtr const& cmd);
- bool SetPlanner(ff_msgs::CommandStampedPtr const& cmd);
- bool SetTelemetryRate(ff_msgs::CommandStampedPtr const& cmd);
- bool SetZones(ff_msgs::CommandStampedPtr const& cmd);
- bool SkipPlanStep(ff_msgs::CommandStampedPtr const& cmd);
- bool StartGuestScience(ff_msgs::CommandStampedPtr const& cmd);
- bool StartRecording(ff_msgs::CommandStampedPtr const& cmd);
- bool StopAllMotion(ff_msgs::CommandStampedPtr const& cmd);
- bool StopArm(ff_msgs::CommandStampedPtr const& cmd);
- bool StopRecording(ff_msgs::CommandStampedPtr const& cmd);
- bool StopGuestScience(ff_msgs::CommandStampedPtr const& cmd);
- bool StowArm(ff_msgs::CommandStampedPtr const& cmd);
- bool SwitchLocalization(ff_msgs::CommandStampedPtr const& cmd);
- bool Undock(ff_msgs::CommandStampedPtr const& cmd);
- bool UnloadNodelet(ff_msgs::CommandStampedPtr const& cmd);
- bool Unperch(ff_msgs::CommandStampedPtr const& cmd);
- bool Unterminate(ff_msgs::CommandStampedPtr const& cmd);
- bool Wait(ff_msgs::CommandStampedPtr const& cmd);
+ bool ArmPanAndTilt(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool AutoReturn(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool CustomGuestScience(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool DeployArm(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Dock(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool EnableAstrobeeIntercomms(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Fault(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool GripperControl(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool IdlePropulsion(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool InitializeBias(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool LoadNodelet(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool NoOp(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool PausePlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Perch(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool PowerItemOff(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool PowerItemOn(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Prepare(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool ReacquirePosition(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool ResetEkf(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool RestartGuestScience(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool RunPlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetCamera(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetCameraRecording(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetCameraStreaming(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetCheckObstacles(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetCheckZones(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetDataToDisk(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetEnableAutoReturn(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetEnableImmediate(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetEnableReplan(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetFlashlightBrightness(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetHolonomicMode(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetInertia(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetOperatingLimits(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetPlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetPlanner(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetTelemetryRate(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SetZones(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SkipPlanStep(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StartGuestScience(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StartRecording(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StopAllMotion(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StopArm(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StopGuestScience(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StopRecording(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool StowArm(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool SwitchLocalization(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Undock(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool UnloadNodelet(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Unperch(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Unterminate(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ bool Wait(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
protected:
- virtual void Initialize(ros::NodeHandle *nh);
+ virtual void Initialize(NodeHandle &nh);
bool ReadParams();
bool ReadMapperParams();
bool ReadCommand(config_reader::ConfigReader::Table *response,
- ff_msgs::CommandStampedPtr cmd);
+ ff_msgs::msg::CommandStamped::SharedPtr cmd);
void PublishAgentState();
OpState* state_;
- ExecutiveActionClient arm_ac_;
- ExecutiveActionClient dock_ac_;
- ExecutiveActionClient localization_ac_;
- ExecutiveActionClient motion_ac_;
- ExecutiveActionClient perch_ac_;
+ ExecutiveActionClient arm_ac_;
+ ExecutiveActionClient dock_ac_;
+ ExecutiveActionClient localization_ac_;
+ ExecutiveActionClient motion_ac_;
+ ExecutiveActionClient perch_ac_;
config_reader::ConfigReader config_params_, mapper_config_params_;
- ff_msgs::AgentStateStamped agent_state_;
-
- ff_msgs::AckStamped ack_;
-
- ff_msgs::CommandStampedPtr sys_monitor_init_fault_response_;
- ff_msgs::CommandStampedPtr sys_monitor_heartbeat_fault_response_;
-
- ff_msgs::CompressedFileAck cf_ack_;
- ff_msgs::CompressedFileConstPtr plan_, zones_, data_to_disk_;
-
- ff_msgs::CameraStatesStamped camera_states_;
- ff_msgs::DockStateConstPtr dock_state_;
- ff_msgs::FaultStateConstPtr fault_state_;
- ff_msgs::GuestScienceConfigConstPtr guest_science_config_;
- ff_msgs::MotionStatePtr motion_state_;
- ff_msgs::PerchStateConstPtr perch_state_;
-
- ff_msgs::ArmGoal arm_goal_;
- ff_msgs::DockGoal dock_goal_;
- ff_msgs::LocalizationGoal localization_goal_;
- ff_msgs::MotionGoal motion_goal_;
- ff_msgs::PerchGoal perch_goal_;
-
- ff_util::FreeFlyerServiceClient led_client_;
-
- geometry_msgs::InertiaStampedConstPtr current_inertia_;
-
- ros::NodeHandle nh_;
-
- ros::Publisher agent_state_pub_, cmd_ack_pub_, plan_pub_, plan_status_pub_;
- ros::Publisher cf_ack_pub_, gs_cmd_pub_;
-
- ros::ServiceClient zones_client_, laser_enable_client_;
- ros::ServiceClient front_flashlight_client_, back_flashlight_client_;
- ros::ServiceClient dock_cam_config_client_, dock_cam_enable_client_;
- ros::ServiceClient haz_cam_config_client_, haz_cam_enable_client_;
- ros::ServiceClient nav_cam_config_client_, nav_cam_enable_client_;
- ros::ServiceClient perch_cam_config_client_, perch_cam_enable_client_;
- ros::ServiceClient sci_cam_config_client_, sci_cam_enable_client_;
- ros::ServiceClient payload_power_client_, pmc_enable_client_;
- ros::ServiceClient set_inertia_client_, set_rate_client_;
- ros::ServiceClient set_data_client_, enable_recording_client_;
- ros::ServiceClient eps_terminate_client_;
- ros::ServiceClient enable_astrobee_intercommunication_client_;
- ros::ServiceClient unload_load_nodelet_client_;
- ros::ServiceClient set_collision_distance_client_;
-
- ros::Subscriber cmd_sub_, dock_state_sub_, fault_state_sub_, gs_ack_sub_;
- ros::Subscriber heartbeat_sub_, motion_sub_, plan_sub_, zones_sub_, data_sub_;
- ros::Subscriber gs_config_sub_, gs_state_sub_, camera_state_sub_;
- ros::Subscriber perch_state_sub_, inertia_sub_;
-
- ros::Timer gs_start_stop_restart_command_timer_, gs_custom_command_timer_;
- ros::Timer reload_params_timer_, wait_timer_, sys_monitor_heartbeat_timer_;
- ros::Timer sys_monitor_startup_timer_;
+ ff_msgs::msg::AgentStateStamped agent_state_;
+
+ ff_msgs::msg::AckStamped ack_;
+
+ ff_msgs::msg::CommandStamped::SharedPtr sys_monitor_init_fault_response_;
+ ff_msgs::msg::CommandStamped::SharedPtr sys_monitor_heartbeat_fault_response_;
+
+ ff_msgs::msg::CompressedFileAck::SharedPtr cf_ack_;
+ ff_msgs::msg::CompressedFile::SharedPtr plan_, zones_, data_to_disk_;
+
+ ff_msgs::msg::CameraStatesStamped::SharedPtr camera_states_;
+ ff_msgs::msg::DockState::SharedPtr dock_state_;
+ ff_msgs::msg::FaultState::SharedPtr fault_state_;
+ ff_msgs::msg::GuestScienceConfig::SharedPtr guest_science_config_;
+ ff_msgs::msg::MotionState::SharedPtr motion_state_;
+ ff_msgs::msg::PerchState::SharedPtr perch_state_;
+
+ ff_msgs::action::Arm::Goal arm_goal_;
+ ff_msgs::action::Dock::Goal dock_goal_;
+ ff_msgs::action::Localization::Goal localization_goal_;
+ ff_msgs::action::Motion::Goal motion_goal_;
+ ff_msgs::action::Perch::Goal perch_goal_;
+
+ geometry_msgs::msg::InertiaStamped::SharedPtr current_inertia_;
+
+ NodeHandle nh_;
+ std::shared_ptr cfg_node_;
+
+ Publisher agent_state_pub_;
+ Publisher cmd_ack_pub_;
+ Publisher plan_pub_;
+ Publisher plan_status_pub_;
+ Publisher cf_ack_pub_;
+ Publisher gs_cmd_pub_;
+
+ FreeFlyerServiceClient zones_client_;
+ FreeFlyerServiceClient laser_enable_client_;
+ FreeFlyerServiceClient
+ front_flashlight_client_;
+ FreeFlyerServiceClient
+ back_flashlight_client_;
+ FreeFlyerServiceClient dock_cam_config_client_;
+ FreeFlyerServiceClient dock_cam_enable_client_;
+ FreeFlyerServiceClient haz_cam_config_client_;
+ FreeFlyerServiceClient haz_cam_enable_client_;
+ FreeFlyerServiceClient nav_cam_config_client_;
+ FreeFlyerServiceClient nav_cam_enable_client_;
+ FreeFlyerServiceClient perch_cam_config_client_;
+ FreeFlyerServiceClient perch_cam_enable_client_;
+ FreeFlyerServiceClient sci_cam_config_client_;
+ FreeFlyerServiceClient sci_cam_enable_client_;
+ FreeFlyerServiceClient
+ payload_power_client_;
+ FreeFlyerServiceClient pmc_enable_client_;
+ FreeFlyerServiceClient set_inertia_client_;
+ FreeFlyerServiceClient set_rate_client_;
+ FreeFlyerServiceClient set_data_client_;
+ FreeFlyerServiceClient
+ enable_recording_client_;
+ FreeFlyerServiceClient eps_terminate_client_;
+ FreeFlyerServiceClient
+ enable_astrobee_intercommunication_client_;
+ FreeFlyerServiceClient unload_load_nodelet_client_;
+ FreeFlyerServiceClient set_collision_distance_client_;
+ FreeFlyerServiceClient led_client_;
+
+
+ Subscriber camera_state_sub_;
+ Subscriber cmd_sub_;
+ Subscriber data_sub_;
+ Subscriber dock_state_sub_;
+ Subscriber fault_state_sub_;
+ Subscriber gs_ack_sub_;
+ Subscriber gs_config_sub_;
+ Subscriber gs_state_sub_;
+ Subscriber heartbeat_sub_;
+ Subscriber inertia_sub_;
+ Subscriber motion_sub_;
+ Subscriber perch_state_sub_;
+ Subscriber plan_sub_;
+ Subscriber zones_sub_;
+
+ ff_util::FreeFlyerTimer gs_start_stop_restart_command_timer_;
+ ff_util::FreeFlyerTimer gs_custom_command_timer_;
+ ff_util::FreeFlyerTimer reload_params_timer_;
+ ff_util::FreeFlyerTimer wait_timer_;
+ ff_util::FreeFlyerTimer sys_monitor_heartbeat_timer_;
+ ff_util::FreeFlyerTimer sys_monitor_startup_timer_;
sequencer::Sequencer sequencer_;
diff --git a/management/executive/include/executive/executive_action_client.h b/management/executive/include/executive/executive_action_client.h
index d0531fd6c7..3ecd1c9385 100644
--- a/management/executive/include/executive/executive_action_client.h
+++ b/management/executive/include/executive/executive_action_client.h
@@ -20,7 +20,7 @@
#ifndef EXECUTIVE_EXECUTIVE_ACTION_CLIENT_H_
#define EXECUTIVE_EXECUTIVE_ACTION_CLIENT_H_
-#include
+#include
#include
#include
diff --git a/management/executive/include/executive/op_state.h b/management/executive/include/executive/op_state.h
index dc4c5383c6..c96f2188a5 100644
--- a/management/executive/include/executive/op_state.h
+++ b/management/executive/include/executive/op_state.h
@@ -19,21 +19,19 @@
#ifndef EXECUTIVE_OP_STATE_H_
#define EXECUTIVE_OP_STATE_H_
-#include
-
#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
#include
#include
-using ff_msgs::CommandConstants;
+using ff_msgs::msg::CommandConstants;
namespace executive {
class Executive;
@@ -46,8 +44,8 @@ class OpState {
public:
virtual ~OpState() {}
virtual OpState* StartupState(std::string const& cmd_id = "");
- virtual OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
- OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd,
+ virtual OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
+ OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd,
bool& completed,
bool& successful);
@@ -60,12 +58,12 @@ class OpState {
virtual OpState* HandleWaitCallback();
virtual OpState* HandleGuestScienceAck(
- ff_msgs::AckStampedConstPtr const& ack);
+ ff_msgs::msg::AckStamped::SharedPtr const ack);
virtual void AckCmd(std::string const& cmd_id,
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK,
- std::string const& message = "",
- uint8_t status = ff_msgs::AckStatus::COMPLETED);
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK,
+ std::string const& message = "",
+ uint8_t status = ff_msgs::msg::AckStatus::COMPLETED);
std::string GenerateActionFailedMsg(
ff_util::FreeFlyerActionState::Enum const& state,
@@ -74,10 +72,9 @@ class OpState {
std::string GetActionString(Action const& action);
- virtual bool PausePlan(ff_msgs::CommandStampedPtr const& cmd);
+ virtual bool PausePlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
OpState* TransitionToState(unsigned char id);
-
std::string const& name() const {return name_;}
unsigned char const& id() const {return id_;}
diff --git a/management/executive/include/executive/op_state_auto_return.h b/management/executive/include/executive/op_state_auto_return.h
index a243602253..33d87e3b5a 100644
--- a/management/executive/include/executive/op_state_auto_return.h
+++ b/management/executive/include/executive/op_state_auto_return.h
@@ -28,7 +28,7 @@ class OpStateAutoReturn : public OpState {
public:
~OpStateAutoReturn() {}
- OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
+ OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
protected:
explicit OpStateAutoReturn(std::string const& name, unsigned char id) :
diff --git a/management/executive/include/executive/op_state_fault.h b/management/executive/include/executive/op_state_fault.h
index dfb39a92a1..9e50507769 100644
--- a/management/executive/include/executive/op_state_fault.h
+++ b/management/executive/include/executive/op_state_fault.h
@@ -27,10 +27,10 @@ class OpStateFault : public OpState {
public:
~OpStateFault() {}
- OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
+ OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
// Guest Science Ack
- OpState* HandleGuestScienceAck(ff_msgs::AckStampedConstPtr const& ack);
+ OpState* HandleGuestScienceAck(ff_msgs::msg::AckStamped::SharedPtr const ack);
OpState* HandleResult(ff_util::FreeFlyerActionState::Enum const& state,
std::string const& result_response,
diff --git a/management/executive/include/executive/op_state_plan_exec.h b/management/executive/include/executive/op_state_plan_exec.h
index 6e85f86cf4..9aa0a29dc9 100644
--- a/management/executive/include/executive/op_state_plan_exec.h
+++ b/management/executive/include/executive/op_state_plan_exec.h
@@ -22,7 +22,7 @@
#include
#include "executive/op_state.h"
#include "executive/utils/sequencer/sequencer.h"
-#include "ff_msgs/AckCompletedStatus.h"
+#include "ff_msgs/msg/ack_completed_status.hpp"
namespace executive {
class OpStatePlanExec : public OpState {
@@ -30,7 +30,7 @@ class OpStatePlanExec : public OpState {
~OpStatePlanExec() {}
OpState* StartupState(std::string const& cmd_id);
- OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
+ OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
OpState* HandleResult(ff_util::FreeFlyerActionState::Enum const& state,
std::string const& result_response,
@@ -39,16 +39,16 @@ class OpStatePlanExec : public OpState {
OpState* HandleWaitCallback();
- OpState* HandleGuestScienceAck(ff_msgs::AckStampedConstPtr const& ack);
+ OpState* HandleGuestScienceAck(ff_msgs::msg::AckStamped::SharedPtr const ack);
void AckCmd(std::string const& cmd_id,
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK,
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK,
std::string const& message = "",
- uint8_t status = ff_msgs::AckStatus::COMPLETED);
+ uint8_t status = ff_msgs::msg::AckStatus::COMPLETED);
void AckPlanCmdFailed(uint8_t completed_status, std::string const& message);
- bool PausePlan(ff_msgs::CommandStampedPtr const& cmd);
+ bool PausePlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
protected:
explicit OpStatePlanExec(std::string const& name, unsigned char id) :
diff --git a/management/executive/include/executive/op_state_ready.h b/management/executive/include/executive/op_state_ready.h
index f56c3d0fe8..61fa0e9012 100644
--- a/management/executive/include/executive/op_state_ready.h
+++ b/management/executive/include/executive/op_state_ready.h
@@ -28,10 +28,10 @@ class OpStateReady : public OpState {
public:
~OpStateReady() {}
- OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
+ OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
// Guest Science Ack
- OpState* HandleGuestScienceAck(ff_msgs::AckStampedConstPtr const& ack);
+ OpState* HandleGuestScienceAck(ff_msgs::msg::AckStamped::SharedPtr const ack);
protected:
explicit OpStateReady(std::string const& name, unsigned char id) :
diff --git a/management/executive/include/executive/op_state_repo.h b/management/executive/include/executive/op_state_repo.h
index 11f929dda2..83f47511b2 100644
--- a/management/executive/include/executive/op_state_repo.h
+++ b/management/executive/include/executive/op_state_repo.h
@@ -19,8 +19,6 @@
#ifndef EXECUTIVE_OP_STATE_REPO_H_
#define EXECUTIVE_OP_STATE_REPO_H_
-#include
-
#include "executive/op_state.h"
#include "executive/op_state_auto_return.h"
#include "executive/op_state_fault.h"
@@ -28,7 +26,7 @@
#include "executive/op_state_ready.h"
#include "executive/op_state_teleop.h"
-#include "ff_msgs/OpState.h"
+#include "ff_msgs/msg/op_state.hpp"
namespace executive {
/**
diff --git a/management/executive/include/executive/op_state_teleop.h b/management/executive/include/executive/op_state_teleop.h
index caaf8d6a6a..e322ce0bd2 100644
--- a/management/executive/include/executive/op_state_teleop.h
+++ b/management/executive/include/executive/op_state_teleop.h
@@ -28,7 +28,7 @@ class OpStateTeleop : public OpState {
public:
~OpStateTeleop() {}
- OpState* HandleCmd(ff_msgs::CommandStampedPtr const& cmd);
+ OpState* HandleCmd(ff_msgs::msg::CommandStamped::SharedPtr const cmd);
OpState* HandleResult(ff_util::FreeFlyerActionState::Enum const& state,
std::string const& result_response,
@@ -42,7 +42,7 @@ class OpStateTeleop : public OpState {
private:
// allow creation only by repo
friend class OpStateRepo;
- ff_msgs::CommandStampedPtr move_cmd_;
+ ff_msgs::msg::CommandStamped::SharedPtr move_cmd_;
};
} // namespace executive
#endif // EXECUTIVE_OP_STATE_TELEOP_H_
diff --git a/management/executive/include/executive/utils/sequencer/command_conversion.h b/management/executive/include/executive/utils/sequencer/command_conversion.h
index 14e2e6011b..df8c3da359 100644
--- a/management/executive/include/executive/utils/sequencer/command_conversion.h
+++ b/management/executive/include/executive/utils/sequencer/command_conversion.h
@@ -20,6 +20,8 @@
#ifndef EXECUTIVE_UTILS_SEQUENCER_COMMAND_CONVERSION_H_
#define EXECUTIVE_UTILS_SEQUENCER_COMMAND_CONVERSION_H_
+#include
+
#include
#include
#include
@@ -44,7 +46,7 @@ namespace internal {
// a function that takes plan command and generates a DDS-based command
// if the conversion is successful, return true. otherwise... don't.
using GenerateFn = bool (*)(const jsonloader::Command * plan_cmd,
- ff_msgs::CommandStamped * dds_cmd);
+ ff_msgs::msg::CommandStamped * dds_cmd);
struct CommandInfo {
std::string name;
diff --git a/management/executive/include/executive/utils/sequencer/plan_io.h b/management/executive/include/executive/utils/sequencer/plan_io.h
index 1213db29bf..f343806a92 100644
--- a/management/executive/include/executive/utils/sequencer/plan_io.h
+++ b/management/executive/include/executive/utils/sequencer/plan_io.h
@@ -21,7 +21,7 @@
#ifndef EXECUTIVE_UTILS_SEQUENCER_PLAN_IO_H_
#define EXECUTIVE_UTILS_SEQUENCER_PLAN_IO_H_
-#include
+#include
#include
#include
diff --git a/management/executive/include/executive/utils/sequencer/sequencer.h b/management/executive/include/executive/utils/sequencer/sequencer.h
index 71b71d4142..6e95116cb4 100644
--- a/management/executive/include/executive/utils/sequencer/sequencer.h
+++ b/management/executive/include/executive/utils/sequencer/sequencer.h
@@ -20,17 +20,17 @@
#ifndef EXECUTIVE_UTILS_SEQUENCER_SEQUENCER_H_
#define EXECUTIVE_UTILS_SEQUENCER_SEQUENCER_H_
-#include
-#include
+#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
-#include
+#include
#include
#include
@@ -52,20 +52,20 @@ class Sequencer {
// because unions can't even :/ OMG.
ItemType CurrentType(bool reset_time = true) noexcept;
- ff_msgs::CommandStamped::Ptr CurrentCommand() noexcept;
+ ff_msgs::msg::CommandStamped::SharedPtr CurrentCommand() noexcept;
jsonloader::Segment CurrentSegment() noexcept;
// give feedback about the end of the current item (command/segment)
// this advances the current item if it is a successful ack.
//
// returns true if there are more command/segments in the plan.
- bool Feedback(ff_msgs::AckCompletedStatus const& ack) noexcept;
+ bool Feedback(ff_msgs::msg::AckCompletedStatus const& ack) noexcept;
// give feedback about an index in the current segment
- void Feedback(ff_msgs::ControlFeedback const& progress) noexcept;
+ void Feedback(ff_msgs::msg::ControlFeedback const& progress) noexcept;
// get the current plan status
- ff_msgs::PlanStatusStamped const& plan_status() noexcept;
+ ff_msgs::msg::PlanStatusStamped const& plan_status() noexcept;
// I can haz validity?
bool valid() const noexcept;
@@ -76,24 +76,28 @@ class Sequencer {
bool HaveOperatingLimits() const noexcept;
// get the goods
- geometry_msgs::InertiaStamped GetInertia() const noexcept;
- bool GetOperatingLimits(ff_msgs::AgentStateStamped &state) const noexcept;
+ geometry_msgs::msg::InertiaStamped GetInertia() const noexcept;
+ bool GetOperatingLimits(ff_msgs::msg::AgentStateStamped &state) const noexcept;
+
+ void SetNodeHandle(NodeHandle nh);
private:
- int AppendStatus(ff_msgs::Status const& msg) noexcept;
+ int AppendStatus(ff_msgs::msg::Status const& msg) noexcept;
void Reset() noexcept;
- friend bool LoadPlan(ff_msgs::CompressedFile::ConstPtr const& cf,
+ friend bool LoadPlan(ff_msgs::msg::CompressedFile::SharedPtr const& cf,
Sequencer * seq);
bool valid_;
jsonloader::Plan plan_;
- ff_msgs::PlanStatusStamped status_;
+ ff_msgs::msg::PlanStatusStamped status_;
+
+ NodeHandle nh_;
// when we started the current item
- ros::Time start_;
+ rclcpp::Time start_;
// milestone is a station or segment within a plan
int current_milestone_;
@@ -111,9 +115,9 @@ class Sequencer {
// load a plan from a compressed file.
// returns true if everything be cool, otherwise not.
-bool LoadPlan(ff_msgs::CompressedFile::ConstPtr const& cf, Sequencer *seq);
+bool LoadPlan(ff_msgs::msg::CompressedFile::SharedPtr const& cf, Sequencer *seq);
-std::vector
+std::vector
Segment2Trajectory(jsonloader::Segment const& segment);
} // end namespace sequencer
diff --git a/management/executive/launch/executive.launch b/management/executive/launch/executive.launch
deleted file mode 100644
index dbf6574d5d..0000000000
--- a/management/executive/launch/executive.launch
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/management/executive/nodelet_plugins.xml b/management/executive/nodelet_plugins.xml
deleted file mode 100644
index a88893902c..0000000000
--- a/management/executive/nodelet_plugins.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Nodelet to keep track of the state of the robot and decide which commands
- to execute.
-
-
-
diff --git a/management/executive/package.xml b/management/executive/package.xml
index 4428a2275c..3671ca0997 100644
--- a/management/executive/package.xml
+++ b/management/executive/package.xml
@@ -1,5 +1,5 @@
-
+
executive
0.0.0
@@ -14,22 +14,23 @@
Astrobee Flight Software
- catkin
- roscpp
+ ament_cmake
+ rclcpp
+ rclcpp_component
ff_msgs
ff_hw_msgs
- nodelet
config_reader
ff_util
jsonloader
- roscpp
- ff_msgs
- ff_hw_msgs
- nodelet
- config_reader
- ff_util
- jsonloader
+
+ rclcpp
+ rclcpp_component
+ ff_msgs
+ ff_hw_msgs
+ config_reader
+ ff_util
+ jsonloader
-
+ ament_cmake
diff --git a/management/executive/src/executive.cc b/management/executive/src/executive.cc
index b958aba475..9af1afad89 100644
--- a/management/executive/src/executive.cc
+++ b/management/executive/src/executive.cc
@@ -22,13 +22,16 @@
#include "executive/op_state.h"
#include "executive/op_state_repo.h"
+FF_DEFINE_LOGGER("executive");
+
namespace executive {
-Executive::Executive() :
- ff_util::FreeFlyerNodelet(NODE_EXECUTIVE, true),
+Executive::Executive(const rclcpp::NodeOptions& options) :
+ ff_util::FreeFlyerComponent(options, NODE_EXECUTIVE, true),
state_(OpStateRepo::Instance()->ready()),
- sys_monitor_init_fault_response_(new ff_msgs::CommandStamped()),
- sys_monitor_heartbeat_fault_response_(new ff_msgs::CommandStamped()),
+ sys_monitor_init_fault_response_(new ff_msgs::msg::CommandStamped()),
+ sys_monitor_heartbeat_fault_response_(new ff_msgs::msg::CommandStamped()),
+ camera_states_(new ff_msgs::msg::CameraStatesStamped()),
dock_state_(NULL),
fault_state_(NULL),
guest_science_config_(NULL),
@@ -58,44 +61,45 @@ Executive::~Executive() {
}
/************************ Message and timeout callbacks ***********************/
-void Executive::CameraStatesCallback(ff_msgs::CameraStatesStampedConstPtr const&
- state) {
+void Executive::CameraStatesCallback(
+ ff_msgs::msg::CameraStatesStamped::SharedPtr const state) {
unsigned int i, j;
bool streaming = false;
- ff_hw_msgs::ConfigureSystemLeds led_srv;
+ ff_util::FreeFlyerService led_srv;
// State array is only one array and the camera states array is at most 5
// elements so this doesn't waste too much time
// Don't care about cameras not in the camera states array
for (i = 0; i < state->states.size(); i++) {
- for (j = 0; j < camera_states_.states.size(); j++) {
+ for (j = 0; j < camera_states_->states.size(); j++) {
if (state->states[i].camera_name ==
- camera_states_.states[j].camera_name) {
- camera_states_.states[j].streaming = state->states[i].streaming;
+ camera_states_->states[j].camera_name) {
+ camera_states_->states[j].streaming = state->states[i].streaming;
}
}
}
// The state message usually only contains one camera so we have to go through
// all the camera states to see if any are streaming
- for (i = 0; i < camera_states_.states.size(); i++) {
- streaming |= camera_states_.states[i].streaming;
+ for (i = 0; i < camera_states_->states.size(); i++) {
+ streaming |= camera_states_->states[i].streaming;
}
if (streaming && !live_led_on_) {
- led_srv.request.live = ff_hw_msgs::ConfigureSystemLeds::Request::ON;
+ led_srv.request->live = ff_hw_msgs::srv::ConfigureSystemLeds::Request::ON;
if (ConfigureLed(led_srv)) {
live_led_on_ = true;
}
} else if (!streaming && live_led_on_) {
- led_srv.request.live = ff_hw_msgs::ConfigureSystemLeds::Request::OFF;
+ led_srv.request->live = ff_hw_msgs::srv::ConfigureSystemLeds::Request::OFF;
if (ConfigureLed(led_srv)) {
live_led_on_ = false;
}
}
}
-void Executive::CmdCallback(ff_msgs::CommandStampedPtr const& cmd) {
+
+void Executive::CmdCallback(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
// Check to see if the command came from a guest science apk. If it did,
// make sure a primary apk is running
if (cmd->cmd_origin == "guest_science") {
@@ -104,84 +108,87 @@ void Executive::CmdCallback(ff_msgs::CommandStampedPtr const& cmd) {
// running
if (primary_apk_running_ == "None") {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Can't run a gs command when a primary apk not running.");
return;
}
}
// TODO(Katie) add more checks
-
SetOpState(state_->HandleCmd(cmd));
}
-void Executive::DataToDiskCallback(ff_msgs::CompressedFileConstPtr const&
- data) {
+void Executive::DataToDiskCallback(
+ ff_msgs::msg::CompressedFile::SharedPtr const data) {
data_to_disk_ = data;
- cf_ack_.header.stamp = ros::Time::now();
- cf_ack_.id = data_to_disk_->id;
- cf_ack_pub_.publish(cf_ack_);
+ cf_ack_->header.stamp = GetTimeNow();
+ cf_ack_->id = data_to_disk_->id;
+ cf_ack_pub_->publish(*cf_ack_);
}
-void Executive::DockStateCallback(ff_msgs::DockStateConstPtr const& state) {
+void Executive::DockStateCallback(
+ ff_msgs::msg::DockState::SharedPtr const state) {
dock_state_ = state;
// Check to see if the dock state is docking/docked/undocking. If it is, we
// can change the mobility state to docking/docked.
// Docking max state signifies that we are docking
- if (dock_state_->state <= ff_msgs::DockState::DOCKING_MAX_STATE &&
- dock_state_->state > ff_msgs::DockState::UNDOCKED) {
- SetMobilityState(ff_msgs::MobilityState::DOCKING, dock_state_->state);
+ if (dock_state_->state <= ff_msgs::msg::DockState::DOCKING_MAX_STATE &&
+ dock_state_->state > ff_msgs::msg::DockState::UNDOCKED) {
+ SetMobilityState(ff_msgs::msg::MobilityState::DOCKING, dock_state_->state);
}
// If the dock state is undocked, the mobility state needs to be set to
// whatever the motion state is.
- if (dock_state_->state == ff_msgs::DockState::UNDOCKED) {
+ if (dock_state_->state == ff_msgs::msg::DockState::UNDOCKED) {
SetMobilityState();
}
}
-void Executive::FaultStateCallback(ff_msgs::FaultStateConstPtr const& state) {
- ff_hw_msgs::ConfigureSystemLeds led_srv;
+void Executive::FaultStateCallback(
+ ff_msgs::msg::FaultState::SharedPtr const state) {
+ ff_util::FreeFlyerService led_srv;
fault_state_ = state;
// Check if we are in the fault state
- if (state_->id() == ff_msgs::OpState::FAULT) {
+ if (state_->id() == ff_msgs::msg::OpState::FAULT) {
// Check if the blocked fault is cleared
- if (state->state != ff_msgs::FaultState::BLOCKED) {
+ if (state->state != ff_msgs::msg::FaultState::BLOCKED) {
// Turn a2 led off so the astronauts can see there is no longer a fault
- led_srv.request.status_a2 = ff_hw_msgs::ConfigureSystemLeds::Request::OFF;
+ led_srv.request->status_a2 =
+ ff_hw_msgs::srv::ConfigureSystemLeds::Request::OFF;
ConfigureLed(led_srv);
// Check if an action is in progress, if so transition to teleop
// Otherwise transition to ready
if (AreActionsRunning()) {
- SetOpState(state_->TransitionToState(ff_msgs::OpState::TELEOPERATION));
+ SetOpState(
+ state_->TransitionToState(ff_msgs::msg::OpState::TELEOPERATION));
} else {
- SetOpState(state_->TransitionToState(ff_msgs::OpState::READY));
+ SetOpState(state_->TransitionToState(ff_msgs::msg::OpState::READY));
}
}
} else {
// Check if a blocking fault is occurring
- if (state->state == ff_msgs::FaultState::BLOCKED) {
+ if (state->state == ff_msgs::msg::FaultState::BLOCKED) {
// Turn a2 led on and blinking so the astronauts can see there is a fault
- led_srv.request.status_a2 =
- ff_hw_msgs::ConfigureSystemLeds::Request::FAST;
+ led_srv.request->status_a2 =
+ ff_hw_msgs::srv::ConfigureSystemLeds::Request::FAST;
ConfigureLed(led_srv);
// If so, transiton to fault state
- SetOpState(state_->TransitionToState(ff_msgs::OpState::FAULT));
+ SetOpState(state_->TransitionToState(ff_msgs::msg::OpState::FAULT));
}
}
}
-void Executive::GuestScienceAckCallback(ff_msgs::AckStampedConstPtr const&
- ack) {
+void Executive::GuestScienceAckCallback(
+ ff_msgs::msg::AckStamped::SharedPtr const ack) {
if (ack->cmd_id == "plan") {
SetOpState(state_->HandleGuestScienceAck(ack));
} else {
- cmd_ack_pub_.publish(ack);
+ cmd_ack_pub_->publish(*ack);
}
// Clear guest science command timers
@@ -194,13 +201,13 @@ void Executive::GuestScienceAckCallback(ff_msgs::AckStampedConstPtr const&
}
}
-void Executive::GuestScienceConfigCallback(ff_msgs::GuestScienceConfigConstPtr
- const& config) {
+void Executive::GuestScienceConfigCallback(
+ ff_msgs::msg::GuestScienceConfig::SharedPtr const config) {
guest_science_config_ = config;
}
-void Executive::GuestScienceStateCallback(ff_msgs::GuestScienceStateConstPtr
- const& state) {
+void Executive::GuestScienceStateCallback(
+ ff_msgs::msg::GuestScienceState::SharedPtr const state) {
unsigned int i = 0;
std::string primary_apk = "None";
@@ -215,26 +222,26 @@ void Executive::GuestScienceStateCallback(ff_msgs::GuestScienceStateConstPtr
// Currently, this shouldn't happen since we only poll for the current apks on
// startup.
if (guest_science_config_->serial != state->serial) {
- NODELET_WARN("Guest science state and config serial doesn't match.");
+ FF_WARN("Guest science state and config serial doesn't match.");
return;
}
// Also check that the state and config are the same size because it would be
// really bad if they weren't.
- if (state->runningApks.size() != guest_science_config_->apks.size()) {
- NODELET_ERROR("Guest science apk array size doesn't match but serial does");
+ if (state->running_apks.size() != guest_science_config_->apks.size()) {
+ FF_ERROR("Guest science apk array size doesn't match but serial does");
return;
}
// Check to see if any apks are running
- for (i = 0; i < state->runningApks.size(); i++) {
- if (state->runningApks[i]) {
+ for (i = 0; i < state->running_apks.size(); i++) {
+ if (state->running_apks[i]) {
// Check if primary
if (guest_science_config_->apks[i].primary) {
if (primary_apk == "None") {
primary_apk = guest_science_config_->apks[i].apk_name;
} else {
- NODELET_ERROR("More than 1 primary apk running in gs state.");
+ FF_ERROR("More than 1 primary apk running in gs state.");
}
}
}
@@ -243,31 +250,29 @@ void Executive::GuestScienceStateCallback(ff_msgs::GuestScienceStateConstPtr
primary_apk_running_ = primary_apk;
if (primary_apk_running_ != "None") {
- agent_state_.guest_science_state.state = ff_msgs::ExecState::EXECUTING;
+ agent_state_.guest_science_state.state = ff_msgs::msg::ExecState::EXECUTING;
} else {
- agent_state_.guest_science_state.state = ff_msgs::ExecState::IDLE;
+ agent_state_.guest_science_state.state = ff_msgs::msg::ExecState::IDLE;
}
}
-void Executive::GuestScienceCustomCmdTimeoutCallback(
- ros::TimerEvent const& te) {
+void Executive::GuestScienceCustomCmdTimeoutCallback() {
std::string err_msg = "GS manager didn't return an ack for the custom guest ";
err_msg += "science command in the timeout specified. The GS manager may not";
err_msg += " have started or it may have died.";
PublishCmdAck(gs_custom_cmd_id_,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
// Don't need to stop timer because it is a one shot timer
gs_custom_cmd_id_ = "";
}
-void Executive::GuestScienceStartStopRestartCmdTimeoutCallback(
- ros::TimerEvent const& te) {
+void Executive::GuestScienceStartStopRestartCmdTimeoutCallback() {
std::string err_msg = "GS manager didn't return an ack for the start/stop ";
err_msg += "guest science command in the timeout specified. The GS manager ";
err_msg += "may not have started or it may have died.";
PublishCmdAck(gs_start_stop_restart_cmd_id_,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
// Don't need to stop timer because it is a one shot timer
gs_start_stop_restart_cmd_id_ = "";
@@ -275,56 +280,59 @@ void Executive::GuestScienceStartStopRestartCmdTimeoutCallback(
void Executive::InertiaCallback(
- geometry_msgs::InertiaStampedConstPtr const& inertia) {
+ geometry_msgs::msg::InertiaStamped::SharedPtr const inertia) {
current_inertia_ = inertia;
}
void Executive::LedConnectedCallback() {
- ff_hw_msgs::ConfigureSystemLeds led_srv;
+ ff_util::FreeFlyerService led_srv;
// Set video light since this means the fsw started
- led_srv.request.video = ff_hw_msgs::ConfigureSystemLeds::Request::ON;
+ led_srv.request->video = ff_hw_msgs::srv::ConfigureSystemLeds::Request::ON;
// Check if we are in the fault state
- if (state_->id() == ff_msgs::OpState::FAULT) {
+ if (state_->id() == ff_msgs::msg::OpState::FAULT) {
// If so, turn a2 led on and blinking so astronauts can see there is a fault
- led_srv.request.status_a2 = ff_hw_msgs::ConfigureSystemLeds::Request::FAST;
+ led_srv.request->status_a2 =
+ ff_hw_msgs::srv::ConfigureSystemLeds::Request::FAST;
ConfigureLed(led_srv);
} else {
// Turn a2 led off to signify that the executive is ready.
- led_srv.request.status_a2 = ff_hw_msgs::ConfigureSystemLeds::Request::OFF;
+ led_srv.request->status_a2 =
+ ff_hw_msgs::srv::ConfigureSystemLeds::Request::OFF;
ConfigureLed(led_srv);
}
}
-void Executive::MotionStateCallback(ff_msgs::MotionStatePtr const& state) {
+void Executive::MotionStateCallback(
+ ff_msgs::msg::MotionState::SharedPtr const state) {
if (motion_state_ == NULL) {
motion_state_ = state;
}
// Check the current motion state to see if it maps to our mobility state. If
// it does, set the mobility state and our stored motion state.
- if (state->state == ff_msgs::MotionState::INITIALIZING) {
+ if (state->state == ff_msgs::msg::MotionState::INITIALIZING) {
// Set motion state to idle a.k.a mobility state to drifting when the
// mobility subsystem is initializing
- motion_state_->state = ff_msgs::MotionState::IDLE;
- } else if (state->state == ff_msgs::MotionState::IDLE ||
- state->state == ff_msgs::MotionState::IDLING ||
- state->state == ff_msgs::MotionState::STOPPED ||
- state->state == ff_msgs::MotionState::STOPPING ||
- state->state == ff_msgs::MotionState::CONTROLLING ||
- state->state == ff_msgs::MotionState::BOOTSTRAPPING) {
+ motion_state_->state = ff_msgs::msg::MotionState::IDLE;
+ } else if (state->state == ff_msgs::msg::MotionState::IDLE ||
+ state->state == ff_msgs::msg::MotionState::IDLING ||
+ state->state == ff_msgs::msg::MotionState::STOPPED ||
+ state->state == ff_msgs::msg::MotionState::STOPPING ||
+ state->state == ff_msgs::msg::MotionState::CONTROLLING ||
+ state->state == ff_msgs::msg::MotionState::BOOTSTRAPPING) {
motion_state_->state = state->state;
}
// Check to see if we are docking or undocking. If we are, don't use the
// motion state as our mobility state.
if (dock_state_ != NULL) {
- if (dock_state_->state > ff_msgs::DockState::UNDOCKED) {
+ if (dock_state_->state > ff_msgs::msg::DockState::UNDOCKED) {
// If dock state is unknown or initializing, use motion state to set
// mobility state
- if (dock_state_->state != ff_msgs::DockState::UNKNOWN &&
- dock_state_->state != ff_msgs::DockState::INITIALIZING) {
+ if (dock_state_->state != ff_msgs::msg::DockState::UNKNOWN &&
+ dock_state_->state != ff_msgs::msg::DockState::INITIALIZING) {
return;
}
}
@@ -333,11 +341,11 @@ void Executive::MotionStateCallback(ff_msgs::MotionStatePtr const& state) {
// Check to see if we are perching or unperching. If we are, don't use the
// motion state as our mobility state.
if (perch_state_ != NULL) {
- if (perch_state_->state > ff_msgs::PerchState::UNPERCHED) {
+ if (perch_state_->state > ff_msgs::msg::PerchState::UNPERCHED) {
// If perching state is unknown or initializing, use motion state to set
// mobility state
- if (perch_state_->state != ff_msgs::PerchState::UNKNOWN &&
- perch_state_->state != ff_msgs::PerchState::INITIALIZING) {
+ if (perch_state_->state != ff_msgs::msg::PerchState::UNKNOWN &&
+ perch_state_->state != ff_msgs::msg::PerchState::INITIALIZING) {
return;
}
}
@@ -347,15 +355,17 @@ void Executive::MotionStateCallback(ff_msgs::MotionStatePtr const& state) {
SetMobilityState();
}
-void Executive::PerchStateCallback(ff_msgs::PerchStateConstPtr const& state) {
+void Executive::PerchStateCallback(
+ ff_msgs::msg::PerchState::SharedPtr const state) {
perch_state_ = state;
// Check to see if the perch state is perching/perched/unperching. If it is,
// we can change the mobility state to perching/perched.
// Perching max state signifies that we are perching
- if (perch_state_->state <= ff_msgs::PerchState::PERCHING_MAX_STATE &&
- perch_state_->state > ff_msgs::PerchState::UNPERCHED) {
- SetMobilityState(ff_msgs::MobilityState::PERCHING, perch_state_->state);
+ if (perch_state_->state <= ff_msgs::msg::PerchState::PERCHING_MAX_STATE &&
+ perch_state_->state > ff_msgs::msg::PerchState::UNPERCHED) {
+ SetMobilityState(ff_msgs::msg::MobilityState::PERCHING,
+ perch_state_->state);
}
// Check to see if we are docked. If we are, don't use the motion state
@@ -364,28 +374,29 @@ void Executive::PerchStateCallback(ff_msgs::PerchStateConstPtr const& state) {
// already docked when FSW starts.
// More docking and undocking states might be added to the check if needed
if (dock_state_ != NULL) {
- if (dock_state_->state == ff_msgs::DockState::DOCKED) {
+ if (dock_state_->state == ff_msgs::msg::DockState::DOCKED) {
return;
}
}
// If the perch state is unperched, the mobility state needs to be set to
// whatever the motion state is.
- if (perch_state_->state == ff_msgs::PerchState::UNPERCHED) {
+ if (perch_state_->state == ff_msgs::msg::PerchState::UNPERCHED) {
SetMobilityState();
}
}
-void Executive::PlanCallback(ff_msgs::CompressedFileConstPtr const& plan) {
+void Executive::PlanCallback(
+ ff_msgs::msg::CompressedFile::SharedPtr const plan) {
plan_ = plan;
- cf_ack_.header.stamp = ros::Time::now();
- cf_ack_.id = plan_->id;
- cf_ack_pub_.publish(cf_ack_);
+ cf_ack_->header.stamp = GetTimeNow();
+ cf_ack_->id = plan_->id;
+ cf_ack_pub_->publish(*cf_ack_);
}
void Executive::SysMonitorHeartbeatCallback(
- ff_msgs::HeartbeatConstPtr const& heartbeat) {
+ ff_msgs::msg::Heartbeat::SharedPtr const heartbeat) {
sys_monitor_heartbeat_timer_.stop();
// Stop the startup timer everytime since it isn't an expensive operation
@@ -398,12 +409,12 @@ void Executive::SysMonitorHeartbeatCallback(
// Check fault state before transitioning to ready because we need to make
// sure there aren't any other blocking faults occurring
if (fault_state_ != NULL) {
- if (fault_state_->state != ff_msgs::FaultState::BLOCKED) {
+ if (fault_state_->state != ff_msgs::msg::FaultState::BLOCKED) {
if (AreActionsRunning()) {
SetOpState(state_->TransitionToState(
- ff_msgs::OpState::TELEOPERATION));
+ ff_msgs::msg::OpState::TELEOPERATION));
} else {
- SetOpState(state_->TransitionToState(ff_msgs::OpState::READY));
+ SetOpState(state_->TransitionToState(ff_msgs::msg::OpState::READY));
}
}
}
@@ -414,14 +425,14 @@ void Executive::SysMonitorHeartbeatCallback(
// if there is a fault in the fault array, the executive needs to trigger the
// system monitor initialization fault.
if (heartbeat->faults.size() > 0 && !sys_monitor_init_fault_occurring_) {
- NODELET_ERROR("System monitor initalization fault detected in executive.");
+ FF_ERROR("System monitor initalization fault detected in executive.");
sys_monitor_init_fault_occurring_ = true;
sys_monitor_init_fault_response_->cmd_id = "executive" +
- std::to_string(ros::Time::now().sec);
+ std::to_string(GetTimeNow().seconds());
CmdCallback(sys_monitor_init_fault_response_);
// If fault is blocking, transition to fault state
if (sys_monitor_init_fault_blocking_) {
- SetOpState(state_->TransitionToState(ff_msgs::OpState::FAULT));
+ SetOpState(state_->TransitionToState(ff_msgs::msg::OpState::FAULT));
}
return;
// Check initialiization fault went away
@@ -432,12 +443,12 @@ void Executive::SysMonitorHeartbeatCallback(
// Check fault state before transitioning to ready because we need to
// make sure there aren't any other blocking faults occurring
if (fault_state_ != NULL) {
- if (fault_state_->state != ff_msgs::FaultState::BLOCKED) {
+ if (fault_state_->state != ff_msgs::msg::FaultState::BLOCKED) {
if (AreActionsRunning()) {
SetOpState(state_->TransitionToState(
- ff_msgs::OpState::TELEOPERATION));
+ ff_msgs::msg::OpState::TELEOPERATION));
} else {
- SetOpState(state_->TransitionToState(ff_msgs::OpState::READY));
+ SetOpState(state_->TransitionToState(ff_msgs::msg::OpState::READY));
}
}
}
@@ -447,32 +458,33 @@ void Executive::SysMonitorHeartbeatCallback(
sys_monitor_heartbeat_timer_.start();
}
-void Executive::SysMonitorTimeoutCallback(ros::TimerEvent const& te) {
- NODELET_ERROR("System monitor heartbeat fault detected in executive.");
+void Executive::SysMonitorTimeoutCallback() {
+ FF_ERROR("System monitor heartbeat fault detected in executive.");
// If the executive doesn't receive a heartbeat from the system monitor, it
// needs to trigger the system monitor heartbeat missed fault.
sys_monitor_heartbeat_fault_occurring_ = true;
sys_monitor_heartbeat_fault_response_->cmd_id = "executive" +
- std::to_string(ros::Time::now().sec);
+ std::to_string(GetTimeNow().seconds());
CmdCallback(sys_monitor_heartbeat_fault_response_);
// If fault is blocking, transition to fault state
if (sys_monitor_heartbeat_fault_blocking_) {
- SetOpState(state_->TransitionToState(ff_msgs::OpState::FAULT));
+ SetOpState(state_->TransitionToState(ff_msgs::msg::OpState::FAULT));
}
sys_monitor_heartbeat_timer_.stop();
}
-void Executive::WaitCallback(ros::TimerEvent const& te) {
+void Executive::WaitCallback() {
wait_timer_.stop();
SetOpState(state_->HandleWaitCallback());
}
-void Executive::ZonesCallback(ff_msgs::CompressedFileConstPtr const& zones) {
+void Executive::ZonesCallback(
+ ff_msgs::msg::CompressedFile::SharedPtr const zones) {
zones_ = zones;
- cf_ack_.header.stamp = ros::Time::now();
- cf_ack_.id = zones_->id;
- cf_ack_pub_.publish(cf_ack_);
+ cf_ack_->header.stamp = GetTimeNow();
+ cf_ack_->id = zones_->id;
+ cf_ack_pub_->publish(*cf_ack_);
}
/************************ Action based commands *******************************/
@@ -494,7 +506,7 @@ void Executive::CancelAction(Action action, std::string cmd) {
arm_ac_.CancelGoal();
err_msg = "Arm action was canceled due to a " + cmd + " command.";
state_->AckCmd(arm_ac_.cmd_id(),
- ff_msgs::AckCompletedStatus::CANCELED,
+ ff_msgs::msg::AckCompletedStatus::CANCELED,
err_msg);
arm_ac_.SetCmdInfo(NONE, "");
break;
@@ -503,7 +515,7 @@ void Executive::CancelAction(Action action, std::string cmd) {
dock_ac_.CancelGoal();
err_msg = "Dock action was canceled due to a " + cmd + " command.";
state_->AckCmd(dock_ac_.cmd_id(),
- ff_msgs::AckCompletedStatus::CANCELED,
+ ff_msgs::msg::AckCompletedStatus::CANCELED,
err_msg);
dock_ac_.SetCmdInfo(NONE, "");
break;
@@ -513,7 +525,7 @@ void Executive::CancelAction(Action action, std::string cmd) {
motion_ac_.CancelGoal();
err_msg = "Motion action was canceled due to a " + cmd + " command.";
state_->AckCmd(motion_ac_.cmd_id(),
- ff_msgs::AckCompletedStatus::CANCELED,
+ ff_msgs::msg::AckCompletedStatus::CANCELED,
err_msg);
motion_ac_.SetCmdInfo(NONE, "");
break;
@@ -522,18 +534,18 @@ void Executive::CancelAction(Action action, std::string cmd) {
perch_ac_.CancelGoal();
err_msg = "Perch action was canceled due to a " + cmd + " command.";
state_->AckCmd(perch_ac_.cmd_id(),
- ff_msgs::AckCompletedStatus::CANCELED,
+ ff_msgs::msg::AckCompletedStatus::CANCELED,
err_msg);
perch_ac_.SetCmdInfo(NONE, "");
break;
default:
- NODELET_ERROR("Action to cancel not recognized!");
+ FF_ERROR("Action to cancel not recognized!");
return;
}
}
// TODO(Katie) Add stow check
-bool Executive::FillArmGoal(ff_msgs::CommandStampedPtr const& cmd) {
+bool Executive::FillArmGoal(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
bool successful = true;
std::string err_msg;
if (cmd->cmd_name == CommandConstants::CMD_NAME_ARM_PAN_AND_TILT) {
@@ -541,9 +553,9 @@ bool Executive::FillArmGoal(ff_msgs::CommandStampedPtr const& cmd) {
// tilt value, and the last is a string specifying whether to pan, tilt or
// both
if (cmd->args.size() != 3 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[2].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[2].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
successful = false;
err_msg = "Malformed arguments for pan and tilt command!";
} else {
@@ -553,11 +565,11 @@ bool Executive::FillArmGoal(ff_msgs::CommandStampedPtr const& cmd) {
arm_goal_.pan = cmd->args[0].f;
arm_goal_.tilt = cmd->args[1].f;
if (cmd->args[2].s == "Pan" || cmd->args[2].s == "pan") {
- arm_goal_.command = ff_msgs::ArmGoal::ARM_PAN;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::ARM_PAN;
} else if (cmd->args[2].s == "Tilt" || cmd->args[2].s == "tilt") {
- arm_goal_.command = ff_msgs::ArmGoal::ARM_TILT;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::ARM_TILT;
} else if (cmd->args[2].s == "Both" || cmd->args[2].s == "both") {
- arm_goal_.command = ff_msgs::ArmGoal::ARM_MOVE;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::ARM_MOVE;
} else {
successful = false;
err_msg = "Unrecognized which parameter in pan and tilt command. Got: "
@@ -565,41 +577,41 @@ bool Executive::FillArmGoal(ff_msgs::CommandStampedPtr const& cmd) {
}
}
} else if (cmd->cmd_name == CommandConstants::CMD_NAME_DEPLOY_ARM) {
- arm_goal_.command = ff_msgs::ArmGoal::ARM_DEPLOY;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::ARM_DEPLOY;
} else if (cmd->cmd_name == CommandConstants::CMD_NAME_GRIPPER_CONTROL) {
// Gripper control has one argument which is a booleanused to specify
// whether to open or close the arm
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
successful = false;
err_msg = "Malformed arguments for gripper control command!";
} else {
// True means open
if (cmd->args[0].b) {
- arm_goal_.command = ff_msgs::ArmGoal::GRIPPER_OPEN;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::GRIPPER_OPEN;
} else {
- arm_goal_.command = ff_msgs::ArmGoal::GRIPPER_CLOSE;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::GRIPPER_CLOSE;
}
}
} else if (cmd->cmd_name == CommandConstants::CMD_NAME_STOW_ARM) {
- arm_goal_.command = ff_msgs::ArmGoal::ARM_STOW;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::ARM_STOW;
} else if (cmd->cmd_name == CommandConstants::CMD_NAME_STOP_ARM) {
- arm_goal_.command = ff_msgs::ArmGoal::ARM_STOP;
+ arm_goal_.command = ff_msgs::action::Arm::Goal::ARM_STOP;
} else {
successful = false;
err_msg = "Arm command not recognized in fill arm goal.";
}
if (!successful) {
- NODELET_ERROR("%s", err_msg.c_str());
+ FF_ERROR("%s", err_msg.c_str());
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
err_msg);
}
return successful;
}
-bool Executive::FillDockGoal(ff_msgs::CommandStampedPtr const& cmd,
+bool Executive::FillDockGoal(ff_msgs::msg::CommandStamped::SharedPtr const cmd,
bool return_to_dock) {
bool successful = true;
std::string err_msg;
@@ -609,33 +621,33 @@ bool Executive::FillDockGoal(ff_msgs::CommandStampedPtr const& cmd,
if (cmd->cmd_name == CommandConstants::CMD_NAME_DOCK) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_INT) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_INT) {
successful = false;
err_msg = "Malformed argument for dock command in plan.";
}
- dock_goal_.command = ff_msgs::DockGoal::DOCK;
+ dock_goal_.command = ff_msgs::action::Dock::Goal::DOCK;
if (cmd->args[0].i == 1) {
- dock_goal_.berth = ff_msgs::DockGoal::BERTH_1;
+ dock_goal_.berth = ff_msgs::action::Dock::Goal::BERTH_1;
} else if (cmd->args[0].i == 2) {
- dock_goal_.berth = ff_msgs::DockGoal::BERTH_2;
+ dock_goal_.berth = ff_msgs::action::Dock::Goal::BERTH_2;
} else {
successful = false;
err_msg = "Berth must be 1 or 2 not " + std::to_string(cmd->args[0].i);
}
} else if (cmd->cmd_name == CommandConstants::CMD_NAME_UNDOCK) {
- dock_goal_.command = ff_msgs::DockGoal::UNDOCK;
+ dock_goal_.command = ff_msgs::action::Dock::Goal::UNDOCK;
// We don't need a berth to undock
- dock_goal_.berth = ff_msgs::DockGoal::BERTH_UNKNOWN;
+ dock_goal_.berth = ff_msgs::action::Dock::Goal::BERTH_UNKNOWN;
} else {
successful = false;
err_msg = "Dock command not recognized in fill dock goal.";
}
if (!successful) {
- NODELET_ERROR("%s", err_msg.c_str());
+ FF_ERROR("%s", err_msg.c_str());
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
err_msg);
}
@@ -643,7 +655,7 @@ bool Executive::FillDockGoal(ff_msgs::CommandStampedPtr const& cmd,
}
bool Executive::FillMotionGoal(Action action,
- ff_msgs::CommandStampedPtr const& cmd) {
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
jsonloader::Segment segment;
// Flight mode needs to be set for all motion actions
motion_goal_.flight_mode = agent_state_.flight_mode;
@@ -652,7 +664,7 @@ bool Executive::FillMotionGoal(Action action,
case EXECUTE:
segment = sequencer_.CurrentSegment();
- motion_goal_.command = ff_msgs::MotionGoal::EXEC;
+ motion_goal_.command = ff_msgs::action::Motion::Goal::EXEC;
// Convert JSON to a segment type
motion_goal_.segment =
sequencer::Segment2Trajectory(sequencer_.CurrentSegment());
@@ -661,35 +673,35 @@ bool Executive::FillMotionGoal(Action action,
break;
case IDLE:
// Need to set flight mode to off so the PMCs shutdown
- motion_goal_.flight_mode = ff_msgs::MotionGoal::OFF;
- motion_goal_.command = ff_msgs::MotionGoal::IDLE;
+ motion_goal_.flight_mode = ff_msgs::action::Motion::Goal::OFF;
+ motion_goal_.command = ff_msgs::action::Motion::Goal::IDLE;
break;
case STOP:
- motion_goal_.command = ff_msgs::MotionGoal::STOP;
+ motion_goal_.command = ff_msgs::action::Motion::Goal::STOP;
break;
case MOVE:
if (cmd == nullptr) {
- NODELET_ERROR("Executive: move cmd is null in fill motion goal.");
+ FF_ERROR("Executive: move cmd is null in fill motion goal.");
return false;
}
if (cmd->args.size() != 4 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_VEC3d ||
- cmd->args[2].data_type != ff_msgs::CommandArg::DATA_TYPE_VEC3d ||
- cmd->args[3].data_type != ff_msgs::CommandArg::DATA_TYPE_MAT33f) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_VEC3D ||
+ cmd->args[2].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_VEC3D ||
+ cmd->args[3].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_MAT33F) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for simple move 6dof command!");
return false;
}
- motion_goal_.command = ff_msgs::MotionGoal::MOVE;
+ motion_goal_.command = ff_msgs::action::Motion::Goal::MOVE;
if (motion_goal_.states.size() != 1) {
motion_goal_.states.resize(1);
}
- motion_goal_.states[0].header.stamp = ros::Time::now();
+ motion_goal_.states[0].header.stamp = GetTimeNow();
// Copying the reference frame to the goal
if (cmd->args[0].s == "ISS") {
@@ -714,7 +726,7 @@ bool Executive::FillMotionGoal(Action action,
default:
if (cmd != nullptr) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Command isn't a mobility action in fill motion goal!");
}
return false;
@@ -740,7 +752,7 @@ bool Executive::StartAction(Action action, std::string const& cmd_id) {
if (arm_ac_.IsConnected()) {
arm_ac_.SetCmdInfo(action, cmd_id);
arm_ac_.SendGoal(arm_goal_);
- NODELET_DEBUG("Arm action goal sent/started.");
+ FF_DEBUG("Arm action goal sent/started.");
} else {
successful = false;
err_msg = "Arm action server not connected! Arm node may have died!";
@@ -751,7 +763,7 @@ bool Executive::StartAction(Action action, std::string const& cmd_id) {
if (dock_ac_.IsConnected()) {
dock_ac_.SetCmdInfo(action, cmd_id);
dock_ac_.SendGoal(dock_goal_);
- NODELET_DEBUG("Dock action goal sent/started.");
+ FF_DEBUG("Dock action goal sent/started.");
} else {
successful = false;
err_msg = "Dock action server not connected! Dock node may have died!";
@@ -764,8 +776,7 @@ bool Executive::StartAction(Action action, std::string const& cmd_id) {
if (motion_ac_.IsConnected()) {
motion_ac_.SetCmdInfo(action, cmd_id);
motion_ac_.SendGoal(motion_goal_);
- NODELET_DEBUG("Motion action %i goal sent/started.",
- motion_goal_.command);
+ FF_DEBUG("Motion action %i goal sent/started.", motion_goal_.command);
} else {
successful = false;
err_msg = "Motion action server not connected! Node may have died!";
@@ -776,7 +787,7 @@ bool Executive::StartAction(Action action, std::string const& cmd_id) {
if (localization_ac_.IsConnected()) {
localization_ac_.SetCmdInfo(action, cmd_id);
localization_ac_.SendGoal(localization_goal_);
- NODELET_DEBUG("Localization action goal sent/started.");
+ FF_DEBUG("Localization action goal sent/started.");
} else {
successful = false;
err_msg = "Localization action server not connected. Node may be dead";
@@ -787,7 +798,7 @@ bool Executive::StartAction(Action action, std::string const& cmd_id) {
if (perch_ac_.IsConnected()) {
perch_ac_.SetCmdInfo(action, cmd_id);
perch_ac_.SendGoal(perch_goal_);
- NODELET_DEBUG("Perch action goal sent/started.");
+ FF_DEBUG("Perch action goal sent/started.");
} else {
successful = false;
err_msg = "Perch action server not connected. Node may have died!";
@@ -799,12 +810,14 @@ bool Executive::StartAction(Action action, std::string const& cmd_id) {
}
if (!successful) {
- state_->AckCmd(cmd_id, ff_msgs::AckCompletedStatus::EXEC_FAILED, err_msg);
+ state_->AckCmd(cmd_id,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ err_msg);
} else {
state_->AckCmd(cmd_id,
- ff_msgs::AckCompletedStatus::NOT,
+ ff_msgs::msg::AckCompletedStatus::NOT,
"",
- ff_msgs::AckStatus::EXECUTING);
+ ff_msgs::msg::AckStatus::EXECUTING);
}
if (successful) {
@@ -829,16 +842,15 @@ bool Executive::RemoveAction(Action action) {
if (found) {
running_actions_.erase(running_actions_.begin() + i);
} else {
- NODELET_ERROR_STREAM("Action " << action <<
- " not in running actions vector!");
+ FF_ERROR_STREAM("Action " << action << " not in running actions vector!");
}
return found;
}
/************************ Action callbacks ************************************/
void Executive::ArmResultCallback(
- ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::ArmResultConstPtr const& result) {
+ ff_util::FreeFlyerActionState::Enum const& state,
+ std::shared_ptr result) {
std::string response = "";
Action current_action = arm_ac_.action();
std::string cmd_id = arm_ac_.cmd_id();
@@ -863,8 +875,8 @@ void Executive::ArmResultCallback(
}
void Executive::DockResultCallback(
- ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::DockResultConstPtr const& result) {
+ ff_util::FreeFlyerActionState::Enum const& state,
+ std::shared_ptr result) {
std::string response = "";
Action current_action = dock_ac_.action();
std::string cmd_id = dock_ac_.cmd_id();
@@ -889,8 +901,8 @@ void Executive::DockResultCallback(
}
void Executive::LocalizationResultCallback(
- ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::LocalizationResultConstPtr const& result) {
+ ff_util::FreeFlyerActionState::Enum const& state,
+ std::shared_ptr result) {
std::string response = "";
Action current_action = localization_ac_.action();
std::string cmd_id = localization_ac_.cmd_id();
@@ -919,7 +931,7 @@ void Executive::LocalizationResultCallback(
}
void Executive::MotionFeedbackCallback(
- ff_msgs::MotionFeedbackConstPtr const& feedback) {
+ std::shared_ptr feedback) {
// The only feedback used from the motion action is the execute feedback and
// it goes to the sequencer. Otherwise there isn't much to with the feedback
if (motion_ac_.action() == EXECUTE) {
@@ -928,8 +940,8 @@ void Executive::MotionFeedbackCallback(
}
void Executive::MotionResultCallback(
- ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::MotionResultConstPtr const& result) {
+ ff_util::FreeFlyerActionState::Enum const& state,
+ std::shared_ptr result) {
std::string response = "";
Action current_action = motion_ac_.action();
std::string cmd_id = motion_ac_.cmd_id();
@@ -954,8 +966,8 @@ void Executive::MotionResultCallback(
}
void Executive::PerchResultCallback(
- ff_util::FreeFlyerActionState::Enum const& state,
- ff_msgs::PerchResultConstPtr const& result) {
+ ff_util::FreeFlyerActionState::Enum const& state,
+ std::shared_ptr result) {
std::string response = "";
Action current_action = perch_ac_.action();
std::string cmd_id = perch_ac_.cmd_id();
@@ -985,36 +997,35 @@ void Executive::PublishCmdAck(std::string const& cmd_id,
std::string const& message,
uint8_t status) {
// Output if the command failed
- if (completed_status != ff_msgs::AckCompletedStatus::OK &&
- completed_status != ff_msgs::AckCompletedStatus::NOT &&
- completed_status != ff_msgs::AckCompletedStatus::CANCELED) {
- NODELET_ERROR("Executive: Command failed with message: %s",
- message.c_str());
+ if (completed_status != ff_msgs::msg::AckCompletedStatus::OK &&
+ completed_status != ff_msgs::msg::AckCompletedStatus::NOT &&
+ completed_status != ff_msgs::msg::AckCompletedStatus::CANCELED) {
+ FF_ERROR("Executive: Command failed with message: %s", message.c_str());
}
- ack_.header.stamp = ros::Time::now();
+ ack_.header.stamp = GetTimeNow();
ack_.cmd_id = cmd_id;
ack_.status.status = status;
ack_.completed_status.status = completed_status;
ack_.message = message;
- cmd_ack_pub_.publish(ack_);
+ cmd_ack_pub_->publish(ack_);
}
void Executive::PublishPlan() {
- plan_pub_.publish(plan_);
+ plan_pub_->publish(*plan_);
}
void Executive::PublishPlanStatus(uint8_t status) {
// The sequencer sets the plan status to executing for every plan status but
// since the executive has knowledge of if the plan has just started,
// is paused, or is executing, the executive sets the status.
- ff_msgs::PlanStatusStamped plan_status = sequencer_.plan_status();
- plan_status.header.stamp = ros::Time::now();
+ ff_msgs::msg::PlanStatusStamped plan_status = sequencer_.plan_status();
+ plan_status.header.stamp = GetTimeNow();
plan_status.status.status = status;
- plan_status_pub_.publish(plan_status);
+ plan_status_pub_->publish(plan_status);
}
/************************ Getters *********************************************/
-ff_msgs::MobilityState Executive::GetMobilityState() {
+ff_msgs::msg::MobilityState Executive::GetMobilityState() {
return agent_state_.mobility_state;
}
@@ -1033,21 +1044,21 @@ void Executive::SetMobilityState() {
return;
}
- if (motion_state_->state == ff_msgs::MotionState::IDLE) {
- agent_state_.mobility_state.state = ff_msgs::MobilityState::DRIFTING;
+ if (motion_state_->state == ff_msgs::msg::MotionState::IDLE) {
+ agent_state_.mobility_state.state = ff_msgs::msg::MobilityState::DRIFTING;
agent_state_.mobility_state.sub_state = 0;
- } else if (motion_state_->state == ff_msgs::MotionState::IDLING) {
- agent_state_.mobility_state.state = ff_msgs::MobilityState::DRIFTING;
+ } else if (motion_state_->state == ff_msgs::msg::MotionState::IDLING) {
+ agent_state_.mobility_state.state = ff_msgs::msg::MobilityState::DRIFTING;
agent_state_.mobility_state.sub_state = 1;
- } else if (motion_state_->state == ff_msgs::MotionState::STOPPED) {
- agent_state_.mobility_state.state = ff_msgs::MobilityState::STOPPING;
+ } else if (motion_state_->state == ff_msgs::msg::MotionState::STOPPED) {
+ agent_state_.mobility_state.state = ff_msgs::msg::MobilityState::STOPPING;
agent_state_.mobility_state.sub_state = 0;
- } else if (motion_state_->state == ff_msgs::MotionState::STOPPING) {
- agent_state_.mobility_state.state = ff_msgs::MobilityState::STOPPING;
+ } else if (motion_state_->state == ff_msgs::msg::MotionState::STOPPING) {
+ agent_state_.mobility_state.state = ff_msgs::msg::MobilityState::STOPPING;
agent_state_.mobility_state.sub_state = 1;
- } else if (motion_state_->state == ff_msgs::MotionState::CONTROLLING ||
- motion_state_->state == ff_msgs::MotionState::BOOTSTRAPPING) {
- agent_state_.mobility_state.state = ff_msgs::MobilityState::FLYING;
+ } else if (motion_state_->state == ff_msgs::msg::MotionState::CONTROLLING ||
+ motion_state_->state == ff_msgs::msg::MotionState::BOOTSTRAPPING) {
+ agent_state_.mobility_state.state = ff_msgs::msg::MobilityState::FLYING;
agent_state_.mobility_state.sub_state = 0;
}
@@ -1062,7 +1073,7 @@ void Executive::SetMobilityState(uint8_t state, uint32_t sub_state) {
void Executive::SetOpState(OpState* state) {
if (state_->id() != state->id()) {
- NODELET_INFO("Executive state changing from [%s(%i)] to [%s(%i)].",
+ FF_INFO("Executive state changing from [%s(%i)] to [%s(%i)].",
state_->name().c_str(), state_->id(),
state->name().c_str(), state->id());
agent_state_.operating_state.state = state->id();
@@ -1083,9 +1094,10 @@ void Executive::SetRunPlanCmdId(std::string cmd_id) {
/************************ Helper functions ************************************/
// Used as a helper function to send a failed ack when the command is not
// accepted in the current mobility state
-void Executive::AckMobilityStateIssue(ff_msgs::CommandStampedPtr const& cmd,
- std::string const& current_mobility_state,
- std::string const& accepted_mobility_state) {
+void Executive::AckMobilityStateIssue(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd,
+ std::string const& current_mobility_state,
+ std::string const& accepted_mobility_state) {
std::string err_msg = cmd->cmd_name + " not accepted while " +
current_mobility_state + "!";
if (accepted_mobility_state != "") {
@@ -1093,22 +1105,23 @@ void Executive::AckMobilityStateIssue(ff_msgs::CommandStampedPtr const& cmd,
}
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
}
-bool Executive::ArmControl(ff_msgs::CommandStampedPtr const& cmd) {
+bool Executive::ArmControl(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
// Check to make sure we aren't trying to dock or perch
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DOCKING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DOCKING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Cannot move arm while (un)docking or docked!");
return false;
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING &&
+ ff_msgs::msg::MobilityState::PERCHING &&
agent_state_.mobility_state.sub_state != 0) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Cannot move arm while (un)perching!");
return false;
}
@@ -1116,7 +1129,7 @@ bool Executive::ArmControl(ff_msgs::CommandStampedPtr const& cmd) {
// Check to make sure another arm command isn't being executed
if (IsActionRunning(ARM)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Arm command already being executed!");
return false;
}
@@ -1125,20 +1138,22 @@ bool Executive::ArmControl(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
- NODELET_INFO("Executing arm command.");
+ FF_INFO("Executing arm command.");
if (!StartAction(ARM, cmd->cmd_id)) {
return false;
}
return true;
}
-bool Executive::CheckServiceExists(ros::ServiceClient& serviceIn,
+bool Executive::CheckServiceExists(bool serviceExists,
std::string const& serviceName,
std::string const& cmd_id) {
std::string err_msg = "";
- if (!serviceIn.exists()) {
+ if (!serviceExists) {
err_msg = serviceName + " service isn't running! Node may have died!";
- state_->AckCmd(cmd_id, ff_msgs::AckCompletedStatus::EXEC_FAILED, err_msg);
+ state_->AckCmd(cmd_id,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ err_msg);
return false;
}
return true;
@@ -1146,27 +1161,30 @@ bool Executive::CheckServiceExists(ros::ServiceClient& serviceIn,
bool Executive::CheckStoppedOrDrifting(std::string const& cmd_id,
std::string const& cmd_name) {
- if ((agent_state_.mobility_state.state == ff_msgs::MobilityState::STOPPING &&
+ if ((agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::STOPPING &&
agent_state_.mobility_state.sub_state == 0) ||
- agent_state_.mobility_state.state == ff_msgs::MobilityState::DRIFTING) {
+ agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DRIFTING) {
return true;
}
state_->AckCmd(cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
("Must be stopped or drifting before " + cmd_name + "."));
return false;
}
-bool Executive::ConfigureLed(ff_hw_msgs::ConfigureSystemLeds& led_srv) {
+bool Executive::ConfigureLed(
+ ff_util::FreeFlyerService& led_srv) {
if (!led_client_.Call(led_srv)) {
- NODELET_ERROR("Configure system leds service not running!");
+ FF_ERROR("Configure system leds service not running!");
return false;
}
- if (!led_srv.response.success) {
- NODELET_ERROR("Configure system leds failed with message %s.",
- led_srv.response.status.c_str());
+ if (!led_srv.response->success) {
+ FF_ERROR("Configure system leds failed with message %s.",
+ led_srv.response->status.c_str());
return false;
}
@@ -1178,8 +1196,10 @@ bool Executive::ConfigureLed(ff_hw_msgs::ConfigureSystemLeds& led_srv) {
bool Executive::ConfigureMobility(bool move_to_start, std::string& err_msg) {
// Initialize choreographer config client if it hasn't been initialized
if (!choreographer_cfg_) {
+ std::string platform = this->GetPlatform();
+ cfg_node_ = std::make_shared("executive_cfg_node", platform, rclcpp::NodeOptions().use_global_arguments(false));
choreographer_cfg_ =
- std::make_shared(&nh_, NODE_CHOREOGRAPHER);
+ std::make_shared(cfg_node_, NODE_CHOREOGRAPHER);
}
// Set values for configuring, these values will persist until changed
@@ -1213,8 +1233,8 @@ bool Executive::ConfigureMobility(bool move_to_start, std::string& err_msg) {
}
// Set the collision distance in the mapper
- ff_msgs::SetFloat collision_distance_srv;
- collision_distance_srv.request.data = agent_state_.collision_distance;
+ ff_util::FreeFlyerService collision_distance_srv;
+ collision_distance_srv.request->data = agent_state_.collision_distance;
// Check to make sure the service is valid and running
// Don't use the check service exists function since we don't want to
@@ -1230,7 +1250,7 @@ bool Executive::ConfigureMobility(bool move_to_start, std::string& err_msg) {
return false;
}
- if (!collision_distance_srv.response.success) {
+ if (!collision_distance_srv.response->success) {
err_msg = "Set collision distance service was not successful.";
return false;
}
@@ -1241,11 +1261,13 @@ bool Executive::ConfigureMobility(bool move_to_start, std::string& err_msg) {
// Used to check the mobility state for commands that can only be executed when
// the astrobee is in some sort of stopped state. Send a failed execution ack
// and return false if mobility state is flying, docking, perching, or stopping.
-bool Executive::FailCommandIfMoving(ff_msgs::CommandStampedPtr const& cmd) {
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::FLYING) {
+bool Executive::FailCommandIfMoving(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::FLYING) {
AckMobilityStateIssue(cmd, "flying");
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::DOCKING &&
+ ff_msgs::msg::MobilityState::DOCKING &&
agent_state_.mobility_state.sub_state != 0) {
// Check if astrobee is docking vs. undocking
if (agent_state_.mobility_state.sub_state > 0) {
@@ -1254,7 +1276,7 @@ bool Executive::FailCommandIfMoving(ff_msgs::CommandStampedPtr const& cmd) {
AckMobilityStateIssue(cmd, "undocking", "stopped");
}
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING &&
+ ff_msgs::msg::MobilityState::PERCHING &&
agent_state_.mobility_state.sub_state != 0) {
// Check if astrobee is perching vs. unperching
if (agent_state_.mobility_state.sub_state > 0) {
@@ -1263,7 +1285,7 @@ bool Executive::FailCommandIfMoving(ff_msgs::CommandStampedPtr const& cmd) {
AckMobilityStateIssue(cmd, "unperching", "stopped");
}
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::STOPPING &&
+ ff_msgs::msg::MobilityState::STOPPING &&
agent_state_.mobility_state.sub_state == 1) {
AckMobilityStateIssue(cmd, "stopping", "stopped");
} else {
@@ -1272,7 +1294,8 @@ bool Executive::FailCommandIfMoving(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
+bool Executive::LoadUnloadNodelet(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
bool load = true;
std::string which = "Load";
int num_args = cmd->args.size();
@@ -1282,15 +1305,16 @@ bool Executive::LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
which = "Unload";
}
- ff_msgs::UnloadLoadNodelet unload_load_nodelet_srv;
- unload_load_nodelet_srv.request.load = load;
+ ff_util::FreeFlyerService
+ unload_load_nodelet_srv;
+ unload_load_nodelet_srv.request->load = load;
// Don't load/unload a nodelet while moving
if (FailCommandIfMoving(cmd)) {
// Only one argument is required for load/unload nodelet, the nodelet name
if (num_args < 1) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
(which + " nodelet must have one argument."));
return false;
}
@@ -1298,7 +1322,7 @@ bool Executive::LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
// The unload nodelet command takes only 1 or 2 arguments
if (num_args > 2 && !load) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
(which + " nodelet takes no more than two arguments."));
return false;
}
@@ -1306,33 +1330,34 @@ bool Executive::LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
// The load nodelet command takes 1 or up to 4 arguments
if (num_args > 4 && load) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
(which + " nodelet takes no more than four arguments."));
return false;
}
// Extract arguments
for (int i = 0; i < num_args; i++) {
- if (cmd->args[i].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ if (cmd->args[i].data_type !=
+ ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
(which + " nodelet parameters must be strings."));
return false;
}
if (i == 0) {
- unload_load_nodelet_srv.request.name = cmd->args[0].s;
+ unload_load_nodelet_srv.request->name = cmd->args[0].s;
} else if (i == 1) {
- unload_load_nodelet_srv.request.manager_name = cmd->args[1].s;
+ unload_load_nodelet_srv.request->manager_name = cmd->args[1].s;
} else if (i == 2) {
- unload_load_nodelet_srv.request.type = cmd->args[2].s;
+ unload_load_nodelet_srv.request->type = cmd->args[2].s;
} else {
- unload_load_nodelet_srv.request.bond_id = cmd->args[3].s;
+ unload_load_nodelet_srv.request->bond_id = cmd->args[3].s;
}
}
// Check if the load/unload nodelet service is running
- if (!CheckServiceExists(unload_load_nodelet_client_,
+ if (!CheckServiceExists(unload_load_nodelet_client_.exists(),
"Load/unload nodelet",
cmd->cmd_id)) {
return false;
@@ -1341,17 +1366,17 @@ bool Executive::LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
// Call the unload load nodelet service
if (!unload_load_nodelet_client_.call(unload_load_nodelet_srv)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Unload load nodelet service returned false.");
return false;
}
- if (unload_load_nodelet_srv.response.result !=
- ff_msgs::UnloadLoadNodelet::Response::SUCCESSFUL) {
+ if (unload_load_nodelet_srv.response->result !=
+ ff_msgs::srv::UnloadLoadNodelet::Response::SUCCESSFUL) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
(which + " nodelet failed with result " +
- std::to_string(unload_load_nodelet_srv.response.result)));
+ std::to_string(unload_load_nodelet_srv.response->result)));
return false;
}
@@ -1362,43 +1387,44 @@ bool Executive::LoadUnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-ros::Time Executive::MsToSec(std::string timestamp) {
+rclcpp::Time Executive::MsToSec(std::string timestamp) {
uint64_t time, secs, nsecs;
time = std::stoull(timestamp);
secs = time/1000;
nsecs = (time % 1000) * 1000000;
- return ros::Time(secs, nsecs);
+ return rclcpp::Time(secs, nsecs);
}
-bool Executive::PowerItem(ff_msgs::CommandStampedPtr const& cmd, bool on) {
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+bool Executive::PowerItem(ff_msgs::msg::CommandStamped::SharedPtr const cmd,
+ bool on) {
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
std::string err_msg = "";
bool success;
// Check to make sure command is formatted as expected
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for power item command!");
return false;
}
- NODELET_INFO("Item %s is being powered on/off!", cmd->args[0].s.c_str());
+ FF_INFO("Item %s is being powered on/off!", cmd->args[0].s.c_str());
// Handle pmcs and laser the same since they use the same service message
if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_POWERED_COMPONENT_LASER_POINTER ||
cmd->args[0].s ==
CommandConstants::PARAM_NAME_POWERED_COMPONENT_PMCS_AND_SIGNAL_LIGHTS) {
- ff_hw_msgs::SetEnabled enable_srv;
- enable_srv.request.enabled = on;
+ ff_util::FreeFlyerService enable_srv;
+ enable_srv.request->enabled = on;
if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_POWERED_COMPONENT_LASER_POINTER) {
// Check to make sure the laser service is valid and running
- if (!CheckServiceExists(laser_enable_client_,
+ if (!CheckServiceExists(laser_enable_client_.exists(),
"Enable laser",
cmd->cmd_id)) {
return false;
@@ -1406,7 +1432,9 @@ bool Executive::PowerItem(ff_msgs::CommandStampedPtr const& cmd, bool on) {
success = laser_enable_client_.call(enable_srv);
} else { // PMCS
// Check to make sure the pmc service is valid and running
- if (!CheckServiceExists(pmc_enable_client_, "Enable PMC", cmd->cmd_id)) {
+ if (!CheckServiceExists(pmc_enable_client_.exists(),
+ "Enable PMC",
+ cmd->cmd_id)) {
return false;
}
success = pmc_enable_client_.call(enable_srv);
@@ -1415,43 +1443,44 @@ bool Executive::PowerItem(ff_msgs::CommandStampedPtr const& cmd, bool on) {
// Check to see if the service was successfully enabled/disabled
if (!success) {
err_msg = "Service returned false.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
- } else if (!enable_srv.response.success) {
- err_msg = enable_srv.response.status_message;
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
+ } else if (!enable_srv.response->success) {
+ err_msg = enable_srv.response->status_message;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
} else { // Item is probably a payload
- ff_hw_msgs::ConfigurePayloadPower config_srv;
- config_srv.request.top_front = config_srv.request.PERSIST;
- config_srv.request.bottom_front = config_srv.request.PERSIST;
- config_srv.request.top_aft = config_srv.request.PERSIST;
- config_srv.request.bottom_aft = config_srv.request.PERSIST;
+ ff_util::FreeFlyerService
+ config_srv;
+ config_srv.request->top_front = config_srv.request->PERSIST;
+ config_srv.request->bottom_front = config_srv.request->PERSIST;
+ config_srv.request->top_aft = config_srv.request->PERSIST;
+ config_srv.request->bottom_aft = config_srv.request->PERSIST;
uint8_t power;
if (on) {
- power = ff_hw_msgs::ConfigurePayloadPower::Request::ON;
+ power = ff_hw_msgs::srv::ConfigurePayloadPower::Request::ON;
} else {
- power = ff_hw_msgs::ConfigurePayloadPower::Request::OFF;
+ power = ff_hw_msgs::srv::ConfigurePayloadPower::Request::OFF;
}
if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_POWERED_COMPONENT_PAYLOAD_TOP_AFT) {
- config_srv.request.top_aft = power;
+ config_srv.request->top_aft = power;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_POWERED_COMPONENT_PAYLOAD_BOTTOM_AFT) {
- config_srv.request.bottom_aft = power;
+ config_srv.request->bottom_aft = power;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_POWERED_COMPONENT_PAYLOAD_BOTTOM_FRONT) {
- config_srv.request.bottom_front = power;
+ config_srv.request->bottom_front = power;
} else { // Item wasn't recognized
err_msg = "Item " + cmd->args[0].s + " not recognized in power item.";
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
return false;
}
- if (!CheckServiceExists(payload_power_client_,
+ if (!CheckServiceExists(payload_power_client_.exists(),
"Power payload",
cmd->cmd_id)) {
return false;
@@ -1462,10 +1491,10 @@ bool Executive::PowerItem(ff_msgs::CommandStampedPtr const& cmd, bool on) {
// Check to see if the payload was successfully enabled/disabled
if (!success) {
err_msg = "Power payload service returned false.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
- } else if (!config_srv.response.success) {
- err_msg = config_srv.response.status;
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
+ } else if (!config_srv.response->success) {
+ err_msg = config_srv.response->status;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
@@ -1473,20 +1502,20 @@ bool Executive::PowerItem(ff_msgs::CommandStampedPtr const& cmd, bool on) {
return true;
}
-bool Executive::ProcessGuestScienceCommand(ff_msgs::CommandStampedPtr
- const& cmd) {
+bool Executive::ProcessGuestScienceCommand(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
int gs_command_timeout_mod = gs_command_timeout_;
// Check if command is restart. If so, need to extract time to add to the
// timeout
if (cmd->cmd_name ==
- ff_msgs::CommandConstants::CMD_NAME_RESTART_GUEST_SCIENCE) {
+ ff_msgs::msg::CommandConstants::CMD_NAME_RESTART_GUEST_SCIENCE) {
// Check command arguments are correct before sending to the guest science
// manager
if (cmd->args.size() != 2 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_INT) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_INT) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for restart guest science command.");
return false;
}
@@ -1496,9 +1525,9 @@ bool Executive::ProcessGuestScienceCommand(ff_msgs::CommandStampedPtr
// Check command arguments are correct before sending to the guest science
// manager
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for guest science command.");
return false;
}
@@ -1508,19 +1537,21 @@ bool Executive::ProcessGuestScienceCommand(ff_msgs::CommandStampedPtr
std::string msg = "Already executing a start or stop guest science command";
msg += ". Please wait for it to finish before issuing another start guest ";
msg += "science command.";
- state_->AckCmd(cmd->cmd_id, ff_msgs::AckCompletedStatus::EXEC_FAILED, msg);
+ state_->AckCmd(cmd->cmd_id,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ msg);
return false;
}
// If starting an apk, check to see if it is primary. If it is, make sure
// a primary apk isn't already running.
if (cmd->cmd_name ==
- ff_msgs::CommandConstants::CMD_NAME_START_GUEST_SCIENCE) {
+ ff_msgs::msg::CommandConstants::CMD_NAME_START_GUEST_SCIENCE) {
// Make sure the executive has received the guest science config message.
// This is needed to check if the apk is primary.
if (guest_science_config_ == NULL) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Executive never got GS config. GS manager may have died");
return false;
}
@@ -1531,7 +1562,7 @@ bool Executive::ProcessGuestScienceCommand(ff_msgs::CommandStampedPtr
// Cannot start a primary apk if another primary apk is running.
if (primary_apk_running_ != "None") {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Can't start primary apk when one is already running");
return false;
}
@@ -1541,24 +1572,24 @@ bool Executive::ProcessGuestScienceCommand(ff_msgs::CommandStampedPtr
}
}
- gs_cmd_pub_.publish(cmd);
- gs_start_stop_restart_command_timer_.setPeriod(
- ros::Duration(gs_command_timeout_mod));
+ gs_cmd_pub_->publish(*cmd);
+ gs_start_stop_restart_command_timer_.setPeriod(gs_command_timeout_mod);
gs_start_stop_restart_command_timer_.start();
gs_start_stop_restart_cmd_id_ = cmd->cmd_id;
return true;
}
bool Executive::ResetEkf(std::string const& cmd_id) {
- localization_goal_.command = ff_msgs::LocalizationGoal::COMMAND_RESET_FILTER;
+ localization_goal_.command =
+ ff_msgs::action::Localization::Goal::COMMAND_RESET_FILTER;
// Don't need to specify a pipeline for reset but clear it just in case
localization_goal_.pipeline = "";
return StartAction(LOCALIZATION, cmd_id);
}
-void Executive::StartWaitTimer(float duration) {
- wait_timer_.setPeriod(ros::Duration(duration));
+void Executive::StartWaitTimer(double duration) {
+ wait_timer_.setPeriod(duration);
wait_timer_.start();
}
@@ -1566,11 +1597,27 @@ void Executive::StopWaitTimer() {
wait_timer_.stop();
}
+/****************************** Output functions ******************************/
+void Executive::Debug(std::string output) {
+ FF_DEBUG_STREAM(output);
+}
+void Executive::Error(std::string output) {
+ FF_ERROR_STREAM(output);
+}
+
+void Executive::Info(std::string output) {
+ FF_INFO_STREAM(output);
+}
+
+void Executive::Warn(std::string output) {
+ FF_WARN_STREAM(output);
+}
+
/************************ Plan related functions ******************************/
// Returns false if there are no more command/segments in the plan
bool Executive::AckCurrentPlanItem() {
- ff_msgs::AckCompletedStatus ack;
- ack.status = ff_msgs::AckCompletedStatus::OK;
+ ff_msgs::msg::AckCompletedStatus ack;
+ ack.status = ff_msgs::msg::AckCompletedStatus::OK;
return sequencer_.Feedback(ack);
}
@@ -1578,33 +1625,35 @@ sequencer::ItemType Executive::GetCurrentPlanItemType() {
return sequencer_.CurrentType();
}
-ff_msgs::CommandStampedPtr Executive::GetPlanCommand() {
+ff_msgs::msg::CommandStamped::SharedPtr Executive::GetPlanCommand() {
return sequencer_.CurrentCommand();
}
bool Executive::GetSetPlanInertia(std::string const& cmd_id) {
// If the plan has inertia, set it. Otherwise, leave the inertia the way it is
if (sequencer_.HaveInertia()) {
- ff_msgs::SetInertia inertia_srv;
- inertia_srv.request.inertia = sequencer_.GetInertia();
+ ff_util::FreeFlyerService inertia_srv;
+ inertia_srv.request->inertia = sequencer_.GetInertia();
// Plan header doesn't contain the center of mass so we need to get the
// current center of mass
- inertia_srv.request.inertia.inertia.com = current_inertia_->inertia.com;
+ inertia_srv.request->inertia.inertia.com = current_inertia_->inertia.com;
- if (!CheckServiceExists(set_inertia_client_, "Set inertia", cmd_id)) {
+ if (!CheckServiceExists(set_inertia_client_.exists(),
+ "Set inertia",
+ cmd_id)) {
return false;
}
if (!set_inertia_client_.call(inertia_srv)) {
state_->AckCmd(cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set inertia service returned false for plan inertia.");
return false;
}
- if (!inertia_srv.response.success) {
+ if (!inertia_srv.response->success) {
state_->AckCmd(cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set inertia srv returned unsuccessful for plan inertia");
return false;
}
@@ -1623,21 +1672,23 @@ void Executive::GetSetPlanOperatingLimits() {
}
/************************ Commands ********************************************/
-bool Executive::ArmPanAndTilt(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing arm pan and tilt command!");
+bool Executive::ArmPanAndTilt(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing arm pan and tilt command!");
return ArmControl(cmd);
}
-bool Executive::AutoReturn(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing auto return command!");
+bool Executive::AutoReturn(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing auto return command!");
bool successful = false;
std::string err_msg;
// Astrobee needs to be either stopped or drifting
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DOCKING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DOCKING) {
err_msg = "Already docked!";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING) {
+ ff_msgs::msg::MobilityState::PERCHING) {
err_msg = "Astrobee cannot attempt to dock while it is perched(ing).";
} else {
// TODO(Katie) Currently this is just the dock 1 command with return to dock
@@ -1645,7 +1696,7 @@ bool Executive::AutoReturn(ff_msgs::CommandStampedPtr const& cmd) {
successful = true;
cmd->cmd_name = "dock";
cmd->args.resize(1);
- cmd->args[0].data_type = ff_msgs::CommandArg::DATA_TYPE_INT;
+ cmd->args[0].data_type = ff_msgs::msg::CommandArg::DATA_TYPE_INT;
cmd->args[0].i = 1;
if (!FillDockGoal(cmd, true)) {
return false;
@@ -1659,21 +1710,22 @@ bool Executive::AutoReturn(ff_msgs::CommandStampedPtr const& cmd) {
// Ack command as failed if we are already docked or perched
if (!successful) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
}
return successful;
}
-bool Executive::CustomGuestScience(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing custom guest science command!");
+bool Executive::CustomGuestScience(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing custom guest science command!");
// Check command arguments are correcy before sending to the guest science
// manager
if (cmd->args.size() != 2 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for custom guest science command.");
return false;
}
@@ -1681,23 +1733,26 @@ bool Executive::CustomGuestScience(ff_msgs::CommandStampedPtr const& cmd) {
if (gs_custom_cmd_id_ != "") {
std::string msg = "Already executing a custom gs command. Please wait for ";
msg += "it to finish before issuing another custom gs command.";
- state_->AckCmd(cmd->cmd_id, ff_msgs::AckCompletedStatus::EXEC_FAILED, msg);
+ state_->AckCmd(cmd->cmd_id,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ msg);
return false;
}
- gs_cmd_pub_.publish(cmd);
- gs_custom_command_timer_.setPeriod(ros::Duration(gs_command_timeout_));
+ gs_cmd_pub_->publish(*cmd);
+ gs_custom_command_timer_.setPeriod(gs_command_timeout_);
gs_custom_command_timer_.start();
gs_custom_cmd_id_ = cmd->cmd_id;
return true;
}
-bool Executive::DeployArm(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing deploy arm command!");
+bool Executive::DeployArm(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing deploy arm command!");
// Check if Astrobee is perching/perched. Arm control will check the rest.
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::PERCHING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::PERCHING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Can't deploy arm while perched or (un)perching!");
return false;
}
@@ -1705,18 +1760,19 @@ bool Executive::DeployArm(ff_msgs::CommandStampedPtr const& cmd) {
return ArmControl(cmd);
}
-bool Executive::Dock(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing dock command!");
+bool Executive::Dock(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing dock command!");
bool successful = false;
std::string err_msg;
// Make sure robot is stopped before attempting to dock. Only accept dock in
// ready op state so perched and docked are the only mobility states we need
// to check for
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DOCKING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DOCKING) {
err_msg = "Already docked.";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING) {
+ ff_msgs::msg::MobilityState::PERCHING) {
err_msg = "Astrobee cannot attempt to dock while it is perched.";
} else {
successful = true;
@@ -1733,19 +1789,20 @@ bool Executive::Dock(ff_msgs::CommandStampedPtr const& cmd) {
// need to fail an ack if we aren't stopped and thus cannot dock
if (!successful) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
}
return successful;
}
-bool Executive::EnableAstrobeeIntercomms(ff_msgs::CommandStampedPtr const&
- cmd) {
- NODELET_INFO("Executive executing enable astrobee intercomms command!");
+bool Executive::EnableAstrobeeIntercomms(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing enable astrobee intercomms command!");
- ff_msgs::ResponseOnly enable_astrobee_intercomms_srv;
+ ff_util::FreeFlyerService
+ enable_astrobee_intercomms_srv;
- if (!CheckServiceExists(enable_astrobee_intercommunication_client_,
+ if (!CheckServiceExists(enable_astrobee_intercommunication_client_.exists(),
"Enable astrobee intercommunication",
cmd->cmd_id)) {
return false;
@@ -1754,16 +1811,16 @@ bool Executive::EnableAstrobeeIntercomms(ff_msgs::CommandStampedPtr const&
if (!enable_astrobee_intercommunication_client_.call(
enable_astrobee_intercomms_srv)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Enable astrobee intercommunication service returned false");
return false;
}
- if (!enable_astrobee_intercomms_srv.response.success) {
+ if (!enable_astrobee_intercomms_srv.response->success) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
("Enable astrobee intercommunication failed with result: " +
- enable_astrobee_intercomms_srv.response.status));
+ enable_astrobee_intercomms_srv.response->status));
return false;
}
@@ -1771,8 +1828,8 @@ bool Executive::EnableAstrobeeIntercomms(ff_msgs::CommandStampedPtr const&
return true;
}
-bool Executive::Fault(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing fault command!");
+bool Executive::Fault(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing fault command!");
// Only transition to the fault state if the fault command came from the
// system monitor or executive. The only way to transition out of the fault
@@ -1781,25 +1838,28 @@ bool Executive::Fault(ff_msgs::CommandStampedPtr const& cmd) {
// transition out of the fault state
if (cmd->cmd_src == "sys_monitor" || cmd->cmd_src == "executive") {
// Configure leds to be blinking since there is a fault
- ff_hw_msgs::ConfigureSystemLeds led_srv;
- led_srv.request.status_a2 = ff_hw_msgs::ConfigureSystemLeds::Request::FAST;
+ ff_util::FreeFlyerService led_srv;
+ led_srv.request->status_a2 =
+ ff_hw_msgs::srv::ConfigureSystemLeds::Request::FAST;
ConfigureLed(led_srv);
state_->AckCmd(cmd->cmd_id);
return true;
}
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"The fault command can only come from the system monitor.");
return false;
}
-bool Executive::GripperControl(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing gripper control command!");
+bool Executive::GripperControl(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing gripper control command!");
return ArmControl(cmd);
}
-bool Executive::IdlePropulsion(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing idle propulsion command!");
+bool Executive::IdlePropulsion(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing idle propulsion command!");
// Cancel any motion actions being executed include the arm
unsigned int i = 0;
@@ -1816,7 +1876,7 @@ bool Executive::IdlePropulsion(ff_msgs::CommandStampedPtr const& cmd) {
} else if (running_actions_[i] == IDLE) {
// Don't try to idle if we are already trying to idle
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Can't idle, already trying to idle");
return false;
} else if (running_actions_[i] == MOVE) {
@@ -1844,11 +1904,13 @@ bool Executive::IdlePropulsion(ff_msgs::CommandStampedPtr const& cmd) {
return StartAction(IDLE, cmd->cmd_id);
}
-bool Executive::InitializeBias(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing initialize bias command!");
+bool Executive::InitializeBias(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing initialize bias command!");
// We don't want to initialize the bias when stopped because we will not be
// completely still
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::STOPPING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::STOPPING) {
AckMobilityStateIssue(cmd, "stopped", "docked, idle, or perched");
return false;
}
@@ -1856,7 +1918,7 @@ bool Executive::InitializeBias(ff_msgs::CommandStampedPtr const& cmd) {
// We also cannot be moving when we initialize the bias
if (FailCommandIfMoving(cmd)) {
localization_goal_.command =
- ff_msgs::LocalizationGoal::COMMAND_ESTIMATE_BIAS;
+ ff_msgs::action::Localization::Goal::COMMAND_ESTIMATE_BIAS;
// Don't need to specify a pipeline for init bias but clear it just in case
localization_goal_.pipeline = "";
return StartAction(LOCALIZATION, cmd->cmd_id);
@@ -1864,38 +1926,39 @@ bool Executive::InitializeBias(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::LoadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing load nodelet command!");
+bool Executive::LoadNodelet(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing load nodelet command!");
return LoadUnloadNodelet(cmd);
}
-bool Executive::NoOp(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing noop command!");
+bool Executive::NoOp(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing noop command!");
state_->AckCmd(cmd->cmd_id);
return true;
}
-bool Executive::PausePlan(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing pause plan command!");
+bool Executive::PausePlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing pause plan command!");
return state_->PausePlan(cmd);
}
-bool Executive::Perch(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing perch command!");
+bool Executive::Perch(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing perch command!");
bool successful = false;
std::string err_msg;
// Make sure robot is stopped before attempting to perch. Only accept perch in
// ready op state so perched and docked are the only mobility states we need
// to check for
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DOCKING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DOCKING) {
err_msg = "Astrobee cannot attempt to perch while it is perched.";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING) {
+ ff_msgs::msg::MobilityState::PERCHING) {
err_msg = "Already perched.";
} else {
successful = true;
- perch_goal_.command = ff_msgs::PerchGoal::PERCH;
+ perch_goal_.command = ff_msgs::action::Perch::Goal::PERCH;
if (!StartAction(PERCH, cmd->cmd_id)) {
return false;
@@ -1906,67 +1969,71 @@ bool Executive::Perch(ff_msgs::CommandStampedPtr const& cmd) {
// if we aren't stopped and thus cannot perch
if (!successful) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
}
return successful;
}
-bool Executive::PowerItemOff(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing power item off command!");
+bool Executive::PowerItemOff(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing power item off command!");
return PowerItem(cmd, false);
}
-bool Executive::PowerItemOn(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing power item on command!");
+bool Executive::PowerItemOn(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing power item on command!");
return PowerItem(cmd, true);
}
-bool Executive::Prepare(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing prepare command!");
+bool Executive::Prepare(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing prepare command!");
// TODO(Katie) Stub, change to be actual code
// Astrobee needs to be either stopped or drifting
if (CheckStoppedOrDrifting(cmd->cmd_id, "preparing")) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Prepare not implemented yet! Stay tune!");
return false;
}
return false;
}
-bool Executive::ReacquirePosition(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing reacquire position command!");
+bool Executive::ReacquirePosition(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing reacquire position command!");
if (FailCommandIfMoving(cmd)) {
// Reacquire position tries to get astrobee localizing again with mapped
// landmarks
localization_goal_.command =
- ff_msgs::LocalizationGoal::COMMAND_SWITCH_PIPELINE;
+ ff_msgs::action::Localization::Goal::COMMAND_SWITCH_PIPELINE;
localization_goal_.pipeline =
- ff_msgs::LocalizationGoal::PIPELINE_MAP_LANDMARKS;
+ ff_msgs::action::Localization::Goal::PIPELINE_MAP_LANDMARKS;
return StartAction(REACQUIRE, cmd->cmd_id);
}
return false;
}
-bool Executive::ResetEkf(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing reset ekf command!");
+bool Executive::ResetEkf(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing reset ekf command!");
if (FailCommandIfMoving(cmd)) {
return ResetEkf(cmd->cmd_id);
}
return false;
}
-bool Executive::RestartGuestScience(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing restart guest science command!");
+bool Executive::RestartGuestScience(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing restart guest science command!");
return ProcessGuestScienceCommand(cmd);
}
-bool Executive::RunPlan(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing run plan command!");
- if (agent_state_.plan_execution_state.state != ff_msgs::ExecState::PAUSED) {
+bool Executive::RunPlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing run plan command!");
+ if (agent_state_.plan_execution_state.state !=
+ ff_msgs::msg::ExecState::PAUSED) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Got run plan cmd but plan status is not paused!");
return false;
}
@@ -1975,34 +2042,34 @@ bool Executive::RunPlan(ff_msgs::CommandStampedPtr const& cmd) {
// Also send successful ack because technically we didn't fail, the plan
// was just empty
if (GetCurrentPlanItemType() == sequencer::ItemType::NONE) {
- SetPlanExecState(ff_msgs::ExecState::IDLE);
+ SetPlanExecState(ff_msgs::msg::ExecState::IDLE);
state_->AckCmd(cmd->cmd_id);
return false;
}
// We can start the plan!
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::NOT,
+ ff_msgs::msg::AckCompletedStatus::NOT,
"",
- ff_msgs::AckStatus::EXECUTING);
+ ff_msgs::msg::AckStatus::EXECUTING);
return true;
}
-bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set camera command!");
+bool Executive::SetCamera(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set camera command!");
std::string err_msg = "";
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
bool successful = true;
// Check to make sure command is formatted as expected
if (cmd->args.size() != 5 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[2].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[3].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[4].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[2].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[3].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[4].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT) {
successful = false;
err_msg = "Malformed arguments for set camera command!";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else {
// Third argument is a string specifing the width and height, need to
// parse it
@@ -2017,42 +2084,42 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
} else {
successful = false;
err_msg = "Camera resolution needs format w_h, wXh, or wxh!";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
}
// Need to ensure mode is valid
int mode;
if (cmd->args[1].s == CommandConstants::PARAM_NAME_CAMERA_MODE_BOTH) {
- mode = ff_msgs::ConfigureCamera::Request::BOTH;
+ mode = ff_msgs::srv::ConfigureCamera::Request::BOTH;
} else if (cmd->args[1].s ==
CommandConstants::PARAM_NAME_CAMERA_MODE_RECORDING) {
- mode = ff_msgs::ConfigureCamera::Request::RECORDING;
+ mode = ff_msgs::srv::ConfigureCamera::Request::RECORDING;
} else if (cmd->args[1].s ==
CommandConstants::PARAM_NAME_CAMERA_MODE_STREAMING) {
- mode = ff_msgs::ConfigureCamera::Request::STREAMING;
+ mode = ff_msgs::srv::ConfigureCamera::Request::STREAMING;
} else {
successful = false;
err_msg = "Camera mode invalid. Options are Both, Streaming, Recording";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
}
if (successful) {
width = cmd->args[2].s.substr(0, pos);
height = cmd->args[2].s.substr((pos + 1));
- ff_msgs::ConfigureCamera config_img_srv;
- config_img_srv.request.mode = mode;
- config_img_srv.request.rate = cmd->args[3].f;
- config_img_srv.request.width = std::stoi(width);
- config_img_srv.request.height = std::stoi(height);
- config_img_srv.request.bitrate = cmd->args[4].f;
+ ff_util::FreeFlyerService config_img_srv;
+ config_img_srv.request->mode = mode;
+ config_img_srv.request->rate = cmd->args[3].f;
+ config_img_srv.request->width = std::stoi(width);
+ config_img_srv.request->height = std::stoi(height);
+ config_img_srv.request->bitrate = cmd->args[4].f;
if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_DOCK) {
// Check to make sure the dock cam service is valid
if (!dock_cam_config_client_.exists()) {
successful = false;
err_msg = "Dock cam config service not running! Node may have died";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if the dock cam was successfully configured
if (!dock_cam_config_client_.call(config_img_srv)) {
@@ -2060,7 +2127,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
// equal to 0
successful = false;
err_msg = "Height, width, and/or rate was invalid for dock camera.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s ==
@@ -2069,7 +2136,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
if (!haz_cam_config_client_.exists()) {
successful = false;
err_msg = "Haz cam config service not running! Node may have died";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if the haz cam was successfully configured
if (!haz_cam_config_client_.call(config_img_srv)) {
@@ -2077,7 +2144,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
// equal to 0
successful = false;
err_msg = "Height, width, and/or rate was invalid for haz camera.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s ==
@@ -2086,7 +2153,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
if (!nav_cam_config_client_.exists()) {
successful = false;
err_msg = "Nav cam configure service not running! Node may have died";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if the nav cam was successfully configured
if (!nav_cam_config_client_.call(config_img_srv)) {
@@ -2094,7 +2161,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
// equal to 0
successful = false;
err_msg = "Height, width, and/or rate was invalid for nav camera.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s ==
@@ -2103,7 +2170,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
if (!perch_cam_config_client_.exists()) {
successful = false;
err_msg = "Perch cam config service not running! Node may have died";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if the perch cam was successfully configured
if (!perch_cam_config_client_.call(config_img_srv)) {
@@ -2111,7 +2178,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
// equal to 0
successful = false;
err_msg = "Height, width, and/or rate was invalid for perch camera";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s ==
@@ -2120,7 +2187,7 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
if (!sci_cam_config_client_.exists()) {
successful = false;
err_msg = "Sci cam configure service not running! Node may have died";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if the sci cam was successfully configured
if (!sci_cam_config_client_.call(config_img_srv)) {
@@ -2129,13 +2196,13 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
successful = false;
err_msg = "Height, width, rate, and/or bitrate was invalid for sci";
err_msg += " camera.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else {
successful = false;
err_msg = "Camera " + cmd->args[0].s + " not recognized.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
}
@@ -2144,35 +2211,37 @@ bool Executive::SetCamera(ff_msgs::CommandStampedPtr const& cmd) {
return successful;
}
-bool Executive::SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set camera recording command!");
+bool Executive::SetCameraRecording(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set camera recording command!");
bool successful = true;
std::string err_msg;
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
// Check to make sure command is formatted as expected
if (cmd->args.size() != 2 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
successful = false;
err_msg = "Malformed arguments for set camera recording command!";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else {
- ff_msgs::EnableCamera enable_img_srv;
- enable_img_srv.request.mode = ff_msgs::EnableCamera::Request::RECORDING;
- enable_img_srv.request.enable = cmd->args[1].b;
+ ff_util::FreeFlyerService enable_img_srv;
+ enable_img_srv.request->mode =
+ ff_msgs::srv::EnableCamera::Request::RECORDING;
+ enable_img_srv.request->enable = cmd->args[1].b;
if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_DOCK) {
// Check to make sure the dock cam enable service exists
if (!dock_cam_enable_client_.exists()) {
successful = false;
err_msg = "Dock cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if recording was set successfully
if (!dock_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable recording failed for dock cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_HAZ) {
@@ -2180,13 +2249,13 @@ bool Executive::SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd) {
if (!haz_cam_enable_client_.exists()) {
successful = false;
err_msg = "Haz cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if recording was set successfully
if (!haz_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable recording failed for haz cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_NAV) {
@@ -2194,13 +2263,13 @@ bool Executive::SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd) {
if (!nav_cam_enable_client_.exists()) {
successful = false;
err_msg = "Nav cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if recording was set successfully
if (!nav_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable recording failed for nav cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s ==
@@ -2209,13 +2278,13 @@ bool Executive::SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd) {
if (!perch_cam_enable_client_.exists()) {
successful = false;
err_msg = "Perch cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if recording was set successfully
if (!perch_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable recording failed for perch cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_SCI) {
@@ -2223,19 +2292,19 @@ bool Executive::SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd) {
if (!sci_cam_enable_client_.exists()) {
successful = false;
err_msg = "Sci cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if recording was set successfully
if (!sci_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable recording failed for sci cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else {
successful = false;
err_msg = "Camera " + cmd->args[0].s + " not recognized.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
@@ -2243,35 +2312,37 @@ bool Executive::SetCameraRecording(ff_msgs::CommandStampedPtr const& cmd) {
return successful;
}
-bool Executive::SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set camera streaming command!");
+bool Executive::SetCameraStreaming(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set camera streaming command!");
bool successful = true;
std::string err_msg = "";
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
// Check to make sure command is formatted as expected
if (cmd->args.size() != 2 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
successful = false;
err_msg = "Malformed arguments for set camera streaming!";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else {
- ff_msgs::EnableCamera enable_img_srv;
- enable_img_srv.request.mode = ff_msgs::EnableCamera::Request::STREAMING;
- enable_img_srv.request.enable = cmd->args[1].b;
+ ff_util::FreeFlyerService enable_img_srv;
+ enable_img_srv.request->mode =
+ ff_msgs::srv::EnableCamera::Request::STREAMING;
+ enable_img_srv.request->enable = cmd->args[1].b;
if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_DOCK) {
// Check to make sure the dock cam service is valid
if (!dock_cam_enable_client_.exists()) {
successful = false;
err_msg = "Dock cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if streaming was successfully set
if (!dock_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable streaming failed for dock cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_HAZ) {
@@ -2279,13 +2350,13 @@ bool Executive::SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd) {
if (!haz_cam_enable_client_.exists()) {
successful = false;
err_msg = "Haz cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if streaming was successfully set
if (!haz_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable streaming failed for haz cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_NAV) {
@@ -2293,13 +2364,13 @@ bool Executive::SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd) {
if (!nav_cam_enable_client_.exists()) {
successful = false;
err_msg = "Nav cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if streaming was successfully set
if (!nav_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable streaming failed for nav cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s ==
@@ -2308,13 +2379,13 @@ bool Executive::SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd) {
if (!perch_cam_enable_client_.exists()) {
successful = false;
err_msg = "Perch cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if streaming was successfully set
if (!perch_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable streaming failed for perch cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else if (cmd->args[0].s == CommandConstants::PARAM_NAME_CAMERA_NAME_SCI) {
@@ -2322,19 +2393,19 @@ bool Executive::SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd) {
if (!sci_cam_enable_client_.exists()) {
successful = false;
err_msg = "Sci cam enable service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Check to see if streaming was successfully set
if (!sci_cam_enable_client_.call(enable_img_srv)) {
successful = false;
err_msg = "Enable streaming failed for sci cam.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else {
successful = false;
err_msg = "Camera " + cmd->args[0].s + " not recognized.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
@@ -2342,15 +2413,16 @@ bool Executive::SetCameraStreaming(ff_msgs::CommandStampedPtr const& cmd) {
return successful;
}
-bool Executive::SetCheckObstacles(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set check obstacles command!");
+bool Executive::SetCheckObstacles(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set check obstacles command!");
// Don't set whether to check obstacles when moving
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
- NODELET_ERROR("Malformed arguments for set check obstacles!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
+ FF_ERROR("Malformed arguments for set check obstacles!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set check obstacles!");
return false;
}
@@ -2363,15 +2435,16 @@ bool Executive::SetCheckObstacles(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetCheckZones(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set check zones command!");
+bool Executive::SetCheckZones(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set check zones command!");
// Don't set whether to check zones when moving
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
- NODELET_ERROR("Malformed arguments for set check zones!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
+ FF_ERROR("Malformed arguments for set check zones!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set check zones!");
return false;
}
@@ -2384,10 +2457,10 @@ bool Executive::SetCheckZones(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set data to disk command!");
+bool Executive::SetDataToDisk(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set data to disk command!");
if (data_to_disk_) {
- ff_msgs::SetDataToDisk data_srv;
+ ff_util::FreeFlyerService data_srv;
std::string file_contents;
// Decompress file into a string
@@ -2399,7 +2472,7 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
// Reset data to disk so that the same file isn't reloaded
data_to_disk_.reset();
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Unable to decompress data to disk file.");
return false;
}
@@ -2411,7 +2484,7 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
Json::Value file_obj;
if (!jsonloader::LoadData(file_contents, &file_obj)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Error parsing json.");
return false;
}
@@ -2419,30 +2492,30 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
// Check to make sure the name exists in the file
if (!file_obj.isMember("name") || !file_obj["name"].isString()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Name of data profile doesn't exist or isn't a string.");
return false;
}
// Get name
- data_srv.request.state.name = file_obj["name"].asString();
+ data_srv.request->state.name = file_obj["name"].asString();
// Check to make sure topic settings exists
if (!file_obj.isMember("topicSettings") ||
!file_obj["topicSettings"].isArray()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Topic settings doesn't exist in file or is not an array!");
return false;
}
- ff_msgs::SaveSettings save_settings;
+ ff_msgs::msg::SaveSettings save_settings;
for (Json::Value const& data_obj : file_obj["topicSettings"]) {
// Check to make sure topic name exists
if (!data_obj.isMember("topicName") ||
!data_obj["topicName"].isString()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Topic name for entry doesn't exist or isn't a string.");
return false;
}
@@ -2452,18 +2525,18 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
if (!data_obj.isMember("downlinkOption") ||
!data_obj["downlinkOption"].isString()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Downlink option doesn't exist or isn't a string.");
return false;
}
if (data_obj["downlinkOption"].asString() == "immediate") {
- save_settings.downlinkOption = ff_msgs::SaveSettings::IMMEDIATE;
+ save_settings.downlink_option = ff_msgs::msg::SaveSettings::IMMEDIATE;
} else if (data_obj["downlinkOption"].asString() == "delayed") {
- save_settings.downlinkOption = ff_msgs::SaveSettings::DELAYED;
+ save_settings.downlink_option = ff_msgs::msg::SaveSettings::DELAYED;
} else {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Downlink option must be either delayed or immediate.");
return false;
}
@@ -2472,17 +2545,17 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
if (!data_obj.isMember("frequency") ||
!data_obj["frequency"].isNumeric()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Frequency for entry doesn't exist or isn't a float.");
return false;
}
save_settings.frequency = data_obj["frequency"].asFloat();
- data_srv.request.state.topic_save_settings.push_back(save_settings);
+ data_srv.request->state.topic_save_settings.push_back(save_settings);
}
// Check to make sure the service is valid and running
- if (!CheckServiceExists(set_data_client_,
+ if (!CheckServiceExists(set_data_client_.exists(),
"Set data to disk",
cmd->cmd_id)) {
return false;
@@ -2490,15 +2563,15 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
if (!set_data_client_.call(data_srv)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set data to disk service returned false.");
return false;
}
- if (!data_srv.response.success) {
+ if (!data_srv.response->success) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
- data_srv.response.status);
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ data_srv.response->status);
return false;
}
@@ -2509,18 +2582,19 @@ bool Executive::SetDataToDisk(ff_msgs::CommandStampedPtr const& cmd) {
// Data to disk pointer is null
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Data to disk file not found.");
return false;
}
-bool Executive::SetEnableAutoReturn(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set enable auto return command!");
+bool Executive::SetEnableAutoReturn(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set enable auto return command!");
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
- NODELET_ERROR("Malformed arguments for enable auto return command!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
+ FF_ERROR("Malformed arguments for enable auto return command!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for enable auto return command!");
return false;
}
@@ -2531,14 +2605,15 @@ bool Executive::SetEnableAutoReturn(ff_msgs::CommandStampedPtr const& cmd) {
return true;
}
-bool Executive::SetEnableImmediate(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set enable immediate command!");
+bool Executive::SetEnableImmediate(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set enable immediate command!");
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
- NODELET_ERROR("Malformed arguments for enable immediate command!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
+ FF_ERROR("Malformed arguments for enable immediate command!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for enable immediate command!");
return false;
}
@@ -2551,14 +2626,15 @@ bool Executive::SetEnableImmediate(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetEnableReplan(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set enable replan command!");
+bool Executive::SetEnableReplan(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set enable replan command!");
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
- NODELET_ERROR("Malformed arguments for enable replan command!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
+ FF_ERROR("Malformed arguments for enable replan command!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for enable replan command!");
return false;
}
@@ -2571,71 +2647,72 @@ bool Executive::SetEnableReplan(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetFlashlightBrightness(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set flashlight brightness command!");
+bool Executive::SetFlashlightBrightness(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set flashlight brightness command!");
bool successful = true;
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
std::string err_msg = "";
// Check to make sure command is formatted as expected
if (cmd->args.size() != 2 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT) {
successful = false;
err_msg = "Malformed arguments for set flashlight brightness command!";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else if (cmd->args[0].s !=
CommandConstants::PARAM_NAME_FLASHLIGHT_LOCATION_BACK &&
cmd->args[0].s !=
CommandConstants::PARAM_NAME_FLASHLIGHT_LOCATION_FRONT) {
successful = false;
err_msg = "Flashlight location not recognized. Must be Front or Back.";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else if (cmd->args[1].f < 0 || cmd->args[1].f > 1) {
successful = false;
err_msg = "Flashlight brightness must be a value between 0 and 1.";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else {
- ff_hw_msgs::SetFlashlight flashlight_srv;
+ ff_util::FreeFlyerService flashlight_srv;
// Flashlight brightness needs to be a value between 0 and 200
- flashlight_srv.request.brightness = 200 * cmd->args[1].f;
+ flashlight_srv.request->brightness = 200 * cmd->args[1].f;
if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_FLASHLIGHT_LOCATION_BACK) {
if (!back_flashlight_client_.exists()) {
successful = false;
err_msg = "Back flashlight control service isn't running.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
if (!back_flashlight_client_.call(flashlight_srv)) {
successful = false;
err_msg = "Back flashlight service returned false.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
// Check to see if flashlight brightness was successfully set
- if (successful && !flashlight_srv.response.success) {
+ if (successful && !flashlight_srv.response->success) {
successful = false;
- err_msg = flashlight_srv.response.status_message;
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ err_msg = flashlight_srv.response->status_message;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
} else {
if (!front_flashlight_client_.exists()) {
successful = false;
err_msg = "Front flashlight control service isn't running.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
if (!front_flashlight_client_.call(flashlight_srv)) {
successful = false;
err_msg = "Front flashlight service returned false.";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
// Check to see if flashlight brightness was successfully set
- if (successful && !flashlight_srv.response.success) {
+ if (successful && !flashlight_srv.response->success) {
successful = false;
- err_msg = flashlight_srv.response.status_message;
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ err_msg = flashlight_srv.response->status_message;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
}
@@ -2645,14 +2722,15 @@ bool Executive::SetFlashlightBrightness(ff_msgs::CommandStampedPtr const& cmd) {
return successful;
}
-bool Executive::SetHolonomicMode(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set holonomic mode command!");
+bool Executive::SetHolonomicMode(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set holonomic mode command!");
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_BOOL) {
- NODELET_ERROR("Malformed arguments for set holonomic mode command!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_BOOL) {
+ FF_ERROR("Malformed arguments for set holonomic mode command!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set holonomic mode command!");
return false;
}
@@ -2665,54 +2743,56 @@ bool Executive::SetHolonomicMode(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetInertia(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set inertia command!");
+bool Executive::SetInertia(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set inertia command!");
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 4 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[2].data_type != ff_msgs::CommandArg::DATA_TYPE_VEC3d ||
- cmd->args[3].data_type != ff_msgs::CommandArg::DATA_TYPE_MAT33f) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[2].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_VEC3D ||
+ cmd->args[3].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_MAT33F) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set inertia command!");
return false;
}
- ff_msgs::SetInertia inertia_srv;
+ ff_util::FreeFlyerService inertia_srv;
// Inertia profile name
- inertia_srv.request.inertia.header.frame_id = cmd->args[0].s;
+ inertia_srv.request->inertia.header.frame_id = cmd->args[0].s;
// Mass
- inertia_srv.request.inertia.inertia.m = cmd->args[1].f;
+ inertia_srv.request->inertia.inertia.m = cmd->args[1].f;
// Center of mass
- inertia_srv.request.inertia.inertia.com.x = cmd->args[2].vec3d[0];
- inertia_srv.request.inertia.inertia.com.y = cmd->args[2].vec3d[1];
- inertia_srv.request.inertia.inertia.com.z = cmd->args[2].vec3d[2];
+ inertia_srv.request->inertia.inertia.com.x = cmd->args[2].vec3d[0];
+ inertia_srv.request->inertia.inertia.com.y = cmd->args[2].vec3d[1];
+ inertia_srv.request->inertia.inertia.com.z = cmd->args[2].vec3d[2];
// Inertia Tensor
// | ixx ixy ixz |
// I = | ixy iyy iyz |
// | ixz iyz izz |
- inertia_srv.request.inertia.inertia.ixx = cmd->args[3].mat33f[0];
- inertia_srv.request.inertia.inertia.ixy = cmd->args[3].mat33f[1];
- inertia_srv.request.inertia.inertia.ixz = cmd->args[3].mat33f[2];
- inertia_srv.request.inertia.inertia.iyy = cmd->args[3].mat33f[4];
- inertia_srv.request.inertia.inertia.iyz = cmd->args[3].mat33f[5];
- inertia_srv.request.inertia.inertia.izz = cmd->args[3].mat33f[8];
-
- if (!CheckServiceExists(set_inertia_client_, "Set inertia", cmd->cmd_id)) {
+ inertia_srv.request->inertia.inertia.ixx = cmd->args[3].mat33f[0];
+ inertia_srv.request->inertia.inertia.ixy = cmd->args[3].mat33f[1];
+ inertia_srv.request->inertia.inertia.ixz = cmd->args[3].mat33f[2];
+ inertia_srv.request->inertia.inertia.iyy = cmd->args[3].mat33f[4];
+ inertia_srv.request->inertia.inertia.iyz = cmd->args[3].mat33f[5];
+ inertia_srv.request->inertia.inertia.izz = cmd->args[3].mat33f[8];
+
+ if (!CheckServiceExists(set_inertia_client_.exists(),
+ "Set inertia",
+ cmd->cmd_id)) {
return false;
}
if (!set_inertia_client_.call(inertia_srv)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set inertia service returned false!");
return false;
}
- if (!inertia_srv.response.success) {
+ if (!inertia_srv.response->success) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set inertia service returned unsuccessful.");
return false;
}
@@ -2724,29 +2804,30 @@ bool Executive::SetInertia(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetOperatingLimits(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set operating limits command!");
+bool Executive::SetOperatingLimits(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set operating limits command!");
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 7 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[2].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[3].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[4].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[5].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
- cmd->args[6].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[2].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[3].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[4].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[5].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
+ cmd->args[6].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set operating limits command!");
return false;
}
// Check to make sure the flight mode exists before setting everything
- ff_msgs::FlightMode mode;
+ ff_msgs::msg::FlightMode mode;
if (!ff_util::FlightUtil::GetFlightMode(mode, cmd->args[1].s)) {
std::string err_msg = "Flight mode " + cmd->args[1].s +" doesn't exist!.";
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
err_msg);
return false;
}
@@ -2775,18 +2856,18 @@ bool Executive::SetOperatingLimits(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetPlan(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set plan command!");
+bool Executive::SetPlan(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set plan command!");
std::string err_msg;
if (plan_) {
if (sequencer::LoadPlan(plan_, &sequencer_)) {
if (sequencer_.plan_status().name.size() < 128) {
// Set plan execution state to paused, apparently this was the way
// spheres worked
- SetPlanExecState(ff_msgs::ExecState::PAUSED);
+ SetPlanExecState(ff_msgs::msg::ExecState::PAUSED);
// Publish plan stuff for ground
PublishPlan();
- PublishPlanStatus(ff_msgs::AckStatus::QUEUED);
+ PublishPlanStatus(ff_msgs::msg::AckStatus::QUEUED);
// Clear plan so that the operator has to upload a new plan after this
// plan is done running
plan_.reset();
@@ -2809,22 +2890,22 @@ bool Executive::SetPlan(ff_msgs::CommandStampedPtr const& cmd) {
} else {
err_msg = "No plan found! Plan must have failed to upload.";
}
- SetPlanExecState(ff_msgs::ExecState::IDLE);
+ SetPlanExecState(ff_msgs::msg::ExecState::IDLE);
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
return false;
}
-bool Executive::SetPlanner(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set planner command!");
+bool Executive::SetPlanner(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set planner command!");
// Don't set planner when moving
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
- NODELET_ERROR("Malformed arguments for set planner command!");
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
+ FF_ERROR("Malformed arguments for set planner command!");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set planner command!");
return false;
}
@@ -2833,9 +2914,9 @@ bool Executive::SetPlanner(ff_msgs::CommandStampedPtr const& cmd) {
if (cmd->args[0].s != CommandConstants::PARAM_NAME_PLANNER_TYPE_TRAPEZOIDAL
&& cmd->args[0].s !=
CommandConstants::PARAM_NAME_PLANNER_TYPE_QUADRATIC_PROGRAM) {
- NODELET_ERROR("Planner must be either Trapezoidal or QuadraticProgram");
+ FF_ERROR("Planner must be either Trapezoidal or QuadraticProgram");
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Planner must be either Trapezoidal or QuadraticProgram");
return false;
}
@@ -2848,66 +2929,70 @@ bool Executive::SetPlanner(ff_msgs::CommandStampedPtr const& cmd) {
return false;
}
-bool Executive::SetTelemetryRate(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set telemetry rate command!");
+bool Executive::SetTelemetryRate(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set telemetry rate command!");
if (cmd->args.size() != 2 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING ||
- cmd->args[1].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING ||
+ cmd->args[1].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for set telemetry rate!");
return false;
}
- ff_msgs::SetRate set_rate_srv;
- set_rate_srv.request.rate = cmd->args[1].f;
+ ff_util::FreeFlyerService set_rate_srv;
+ set_rate_srv.request->rate = cmd->args[1].f;
if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_COMM_STATUS) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::COMM_STATUS;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::COMM_STATUS;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_CPU_STATE) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::CPU_STATE;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::CPU_STATE;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_DISK_STATE) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::DISK_STATE;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::DISK_STATE;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_EKF_STATE) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::EKF_STATE;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::EKF_STATE;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_GNC_STATE) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::GNC_STATE;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::GNC_STATE;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_PMC_CMD_STATE) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::PMC_CMD_STATE;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::PMC_CMD_STATE;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_POSITION) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::POSITION;
+ set_rate_srv.request->which = ff_msgs::srv::SetRate::Request::POSITION;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_TELEMETRY_TYPE_SPARSE_MAPPING_POSE) {
- set_rate_srv.request.which = ff_msgs::SetRate::Request::SPARSE_MAPPING_POSE;
+ set_rate_srv.request->which =
+ ff_msgs::srv::SetRate::Request::SPARSE_MAPPING_POSE;
} else {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Unknown name in set telemetry rate command!");
return false;
}
- if (!CheckServiceExists(set_rate_client_, "Set telem rate", cmd->cmd_id)) {
+ if (!CheckServiceExists(set_rate_client_.exists(),
+ "Set telem rate",
+ cmd->cmd_id)) {
return false;
}
if (!set_rate_client_.call(set_rate_srv)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set rate service returned false.");
return false;
}
// Check to see if the rate was set successfully
- if (!set_rate_srv.response.success) {
+ if (!set_rate_srv.response->success) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
- set_rate_srv.response.status);
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ set_rate_srv.response->status);
return false;
}
@@ -2915,11 +3000,11 @@ bool Executive::SetTelemetryRate(ff_msgs::CommandStampedPtr const& cmd) {
return true;
}
-bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing set zones command!");
+bool Executive::SetZones(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing set zones command!");
if (FailCommandIfMoving(cmd)) {
if (zones_) {
- ff_msgs::SetZones zones_srv;
+ ff_util::FreeFlyerService zones_srv;
std::string file_contents;
// Decompress file into a string
@@ -2929,7 +3014,7 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
// Reset zones so that the same file isn't reloaded
zones_.reset();
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Unable to decompress zones file.");
return false;
}
@@ -2941,7 +3026,7 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
Json::Value file_obj;
if (!jsonloader::LoadData(file_contents, &file_obj)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Error parsing json.");
return false;
}
@@ -2950,31 +3035,31 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
if (!file_obj.isMember("timestamp") ||
!file_obj["timestamp"].isString()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"File timestamp doesn't exist or is not a string.");
return false;
}
// Get timestamp in milliseconds and convert it to a number
std::string timestamp = file_obj["timestamp"].asString();
- zones_srv.request.timestamp = MsToSec(timestamp);
+ zones_srv.request->timestamp = MsToSec(timestamp);
// Check to make sure zones array exists
if (!file_obj.isMember("zones") || !file_obj["zones"].isArray()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Parser error: zones don't exist or are not an array!");
return false;
}
std::string err_msg;
- ff_msgs::Zone zone;
+ ff_msgs::msg::Zone zone;
int i = 0;
for (Json::Value const& zone_obj : file_obj["zones"]) {
// Check to make sure zone name exists
if (!zone_obj.isMember("name") || !zone_obj["name"].isString()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Name in zone doesn't exist or is not a string.");
return false;
}
@@ -2983,21 +3068,21 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
// Check to make sure safe exists for zone
if (!zone_obj.isMember("safe") || !zone_obj["safe"].isBool()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Safe flag in zone doesn't exist or is not a boolean");
return false;
}
if (zone_obj["safe"].asBool()) {
- zone.type = ff_msgs::Zone::KEEPIN;
+ zone.type = ff_msgs::msg::Zone::KEEPIN;
} else {
- zone.type = ff_msgs::Zone::KEEPOUT;
+ zone.type = ff_msgs::msg::Zone::KEEPOUT;
}
// Check to make sure the sequence exists for the zone
if (!zone_obj.isMember("sequence") || !zone_obj["sequence"].isArray()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Sequence in zone doesn't exist or isn't an array.");
return false;
}
@@ -3007,7 +3092,7 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
zone.index = i;
if (!box_array.isArray() || box_array.size() != 6) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Box isn't an array or doesn't have 6 points.");
return false;
}
@@ -3016,7 +3101,7 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
!box_array[2].isNumeric() || !box_array[3].isNumeric() ||
!box_array[4].isNumeric() || !box_array[5].isNumeric()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"One of the box points in zone is not numeric!");
return false;
}
@@ -3030,7 +3115,7 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
zone.max.y = box_array[4].asFloat();
zone.max.z = box_array[5].asFloat();
- zones_srv.request.zones.push_back(zone);
+ zones_srv.request->zones.push_back(zone);
i++;
}
}
@@ -3038,21 +3123,21 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
// Check to make sure the service is valid and running
if (!zones_client_.exists()) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set zones service isn't running! Choreographer may have died");
return false;
}
if (!zones_client_.call(zones_srv)) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set zones service returned false.");
return false;
}
- if (!zones_srv.response.success) {
+ if (!zones_srv.response->success) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Set zones was not successful.");
return false;
}
@@ -3061,72 +3146,76 @@ bool Executive::SetZones(ff_msgs::CommandStampedPtr const& cmd) {
return true;
}
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"No zones file found.");
return false;
}
return false;
}
-bool Executive::SkipPlanStep(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing skip plan step command!");
+bool Executive::SkipPlanStep(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing skip plan step command!");
// Make sure plan execution state is paused
- if (agent_state_.plan_execution_state.state != ff_msgs::ExecState::PAUSED) {
+ if (agent_state_.plan_execution_state.state !=
+ ff_msgs::msg::ExecState::PAUSED) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Got command to skip a plan step but plan isn't paused.");
return false;
}
- ff_msgs::AckCompletedStatus ack;
- ack.status = ff_msgs::AckCompletedStatus::CANCELED;
+ ff_msgs::msg::AckCompletedStatus ack;
+ ack.status = ff_msgs::msg::AckCompletedStatus::CANCELED;
// Check to see if we are skipping the last step in the plan
if (sequencer_.Feedback(ack)) {
- PublishPlanStatus(ff_msgs::AckStatus::QUEUED);
+ PublishPlanStatus(ff_msgs::msg::AckStatus::QUEUED);
} else {
- PublishPlanStatus(ff_msgs::AckStatus::COMPLETED);
- SetPlanExecState(ff_msgs::ExecState::IDLE);
+ PublishPlanStatus(ff_msgs::msg::AckStatus::COMPLETED);
+ SetPlanExecState(ff_msgs::msg::ExecState::IDLE);
}
state_->AckCmd(cmd->cmd_id);
return true;
}
-bool Executive::StartGuestScience(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing start guest science!");
+bool Executive::StartGuestScience(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing start guest science!");
return ProcessGuestScienceCommand(cmd);
}
-bool Executive::StartRecording(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing start recording command.");
+bool Executive::StartRecording(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing start recording command.");
bool successful = true;
std::string err_msg;
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
successful = false;
err_msg = "Malformed arguments for start recording command.";
- completed_status = ff_msgs::AckCompletedStatus::BAD_SYNTAX;
+ completed_status = ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX;
} else {
- ff_msgs::EnableRecording enable_rec_srv;
- enable_rec_srv.request.enable = true;
- enable_rec_srv.request.bag_description = cmd->args[0].s;
+ ff_util::FreeFlyerService enable_rec_srv;
+ enable_rec_srv.request->enable = true;
+ enable_rec_srv.request->bag_description = cmd->args[0].s;
// Check to make sure the enable recording service exists
if (!enable_recording_client_.exists()) {
successful = false;
err_msg = "Enable recording service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Call enable service and make sure it worked
if (!enable_recording_client_.call(enable_rec_srv)) {
successful = false;
err_msg = "Enable recording service failed!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
- } else if (!enable_rec_srv.response.success) {
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
+ } else if (!enable_rec_srv.response->success) {
successful = false;
- err_msg = enable_rec_srv.response.status;
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ err_msg = enable_rec_srv.response->status;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
}
@@ -3142,8 +3231,9 @@ bool Executive::StartRecording(ff_msgs::CommandStampedPtr const& cmd) {
// haven't activated the pmcs yet.
// This function is also as pause for a plan so if the plan flag is set, we
// need to check if we are downloading data and if so, stop it.
-bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing stop all motion command!");
+bool Executive::StopAllMotion(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing stop all motion command!");
// We pretty much always start stop action even if stopped. See cases below
// for situations we don't want to stop in
bool successful = true, start_stop = true;
@@ -3153,10 +3243,11 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// it is, we need to check if mobility is idle. If mobility is idle, we don't
// want to spin up the pmcs by excuting a stop
if (cmd->cmd_src == "sys_monitor") {
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DRIFTING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DRIFTING) {
// Ack command as failed and don't stop
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"PMCs are idle so don't want spin them up due to a fault");
return false;
}
@@ -3169,7 +3260,8 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// If we are perched or docked, we will be idle and don't want to
// spin up the motors to try to stop so we need to fail the stop command in
// this case
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DOCKING &&
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DOCKING &&
agent_state_.mobility_state.sub_state == 0) {
err_msg = "Astrobee cannot stop while docked.";
start_stop = false;
@@ -3177,7 +3269,7 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// Will check if we started the undock action but haven't received any
// feedback in main for loop
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING &&
+ ff_msgs::msg::MobilityState::PERCHING &&
agent_state_.mobility_state.sub_state == 0) {
err_msg = "Astrobee cannot stop while perched.";
start_stop = false;
@@ -3203,7 +3295,7 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// Don't stop if we are deactivating the PMCs or already docked but
// switching localiization
if (agent_state_.mobility_state.sub_state <=
- ff_msgs::DockState::DOCKING_WAITING_FOR_SPIN_DOWN) {
+ ff_msgs::msg::DockState::DOCKING_WAITING_FOR_SPIN_DOWN) {
err_msg = "Already deactivating pmcs or docked. Cannot stop.";
start_stop = false;
successful = false;
@@ -3225,7 +3317,7 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// Don't stop if we are deactivating the PMCs or already perched but
// switching localization
if (agent_state_.mobility_state.sub_state <=
- ff_msgs::PerchState::PERCHING_WAITING_FOR_SPIN_DOWN) {
+ ff_msgs::msg::PerchState::PERCHING_WAITING_FOR_SPIN_DOWN) {
err_msg = "Already deactivating the pmcs or perched. Cannot stop.";
start_stop = false;
successful = false;
@@ -3243,7 +3335,7 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// Figure out where we are in the undock process and only send a stop if
// we are in or have completed the egressing state
if (agent_state_.mobility_state.sub_state >
- ff_msgs::DockState::UNDOCKING_MOVING_TO_APPROACH_POSE) {
+ ff_msgs::msg::DockState::UNDOCKING_MOVING_TO_APPROACH_POSE) {
start_stop = false;
// Set successful to true since it may have been set to false in the
// if docked statement
@@ -3262,7 +3354,7 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// Figure out where we are in the unperching process and only send a stop
// if we might not be perched any more.
if (agent_state_.mobility_state.sub_state >
- ff_msgs::PerchState::UNPERCHING_OPENING_GRIPPER) {
+ ff_msgs::msg::PerchState::UNPERCHING_OPENING_GRIPPER) {
start_stop = false;
// Set successful to true since it may have been set to false in the if
// perched statement
@@ -3288,9 +3380,9 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
// Ack before start action since start action will ack for us if it fails
if (!successful) {
- NODELET_ERROR("%s", err_msg.c_str());
+ FF_ERROR("%s", err_msg.c_str());
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
} else if (successful && !start_stop) {
// Ack successful since we cancelled an action that hadn't moved the robot
@@ -3306,8 +3398,8 @@ bool Executive::StopAllMotion(ff_msgs::CommandStampedPtr const& cmd) {
return successful;
}
-bool Executive::StopArm(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing stop arm command!");
+bool Executive::StopArm(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing stop arm command!");
// Check for an arm action already being executed. If so, cancel it.
if (IsActionRunning(ARM)) {
CancelAction(ARM, "stop arm");
@@ -3324,35 +3416,37 @@ bool Executive::StopArm(ff_msgs::CommandStampedPtr const& cmd) {
return true;
}
-bool Executive::StopGuestScience(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing stop guest science command!");
+bool Executive::StopGuestScience(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing stop guest science command!");
return ProcessGuestScienceCommand(cmd);
}
-bool Executive::StopRecording(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing stop recording command!");
+bool Executive::StopRecording(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing stop recording command!");
bool successful = true;
std::string err_msg;
- uint8_t completed_status = ff_msgs::AckCompletedStatus::OK;
+ uint8_t completed_status = ff_msgs::msg::AckCompletedStatus::OK;
- ff_msgs::EnableRecording enable_rec_srv;
- enable_rec_srv.request.enable = false;
+ ff_util::FreeFlyerService enable_rec_srv;
+ enable_rec_srv.request->enable = false;
// Check to make sure the enable recording service exists
if (!enable_recording_client_.exists()) {
successful = false;
err_msg = "Enable recording service not running! Node may have died!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
} else {
// Call enable service and make sure it worked
if (!enable_recording_client_.call(enable_rec_srv)) {
successful = false;
err_msg = "Enable recording service failed!";
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
- } else if (!enable_rec_srv.response.success) {
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
+ } else if (!enable_rec_srv.response->success) {
successful = false;
- err_msg = enable_rec_srv.response.status;
- completed_status = ff_msgs::AckCompletedStatus::EXEC_FAILED;
+ err_msg = enable_rec_srv.response->status;
+ completed_status = ff_msgs::msg::AckCompletedStatus::EXEC_FAILED;
}
}
@@ -3360,12 +3454,13 @@ bool Executive::StopRecording(ff_msgs::CommandStampedPtr const& cmd) {
return successful;
}
-bool Executive::StowArm(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing stow arm command!");
+bool Executive::StowArm(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing stow arm command!");
// Check if Astrobee is perched. Arm control will check the rest.
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::PERCHING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::PERCHING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Can't stow arm while perched or (un)perching!");
return false;
}
@@ -3373,58 +3468,64 @@ bool Executive::StowArm(ff_msgs::CommandStampedPtr const& cmd) {
return ArmControl(cmd);
}
-bool Executive::SwitchLocalization(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_DEBUG("Executive executing switch localization command!");
+bool Executive::SwitchLocalization(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_DEBUG("Executive executing switch localization command!");
if (FailCommandIfMoving(cmd)) {
if (cmd->args.size() != 1 ||
- cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_STRING) {
+ cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_STRING) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for switch localization!");
return false;
}
localization_goal_.command =
- ff_msgs::LocalizationGoal::COMMAND_SWITCH_PIPELINE;
+ ff_msgs::action::Localization::Goal::COMMAND_SWITCH_PIPELINE;
if (cmd->args[0].s == CommandConstants::PARAM_NAME_LOCALIZATION_MODE_NONE) {
- localization_goal_.pipeline = ff_msgs::LocalizationGoal::PIPELINE_NONE;
+ localization_goal_.pipeline =
+ ff_msgs::action::Localization::Goal::PIPELINE_NONE;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_LOCALIZATION_MODE_MAPPED_LANDMARKS) {
localization_goal_.pipeline =
- ff_msgs::LocalizationGoal::PIPELINE_MAP_LANDMARKS;
+ ff_msgs::action::Localization::Goal::PIPELINE_MAP_LANDMARKS;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_LOCALIZATION_MODE_ARTAGS) {
- localization_goal_.pipeline = ff_msgs::LocalizationGoal::PIPELINE_AR_TAGS;
+ localization_goal_.pipeline =
+ ff_msgs::action::Localization::Goal::PIPELINE_AR_TAGS;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_LOCALIZATION_MODE_HANDRAIL) {
localization_goal_.pipeline =
- ff_msgs::LocalizationGoal::PIPELINE_HANDRAIL;
+ ff_msgs::action::Localization::Goal::PIPELINE_HANDRAIL;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_LOCALIZATION_MODE_PERCH) {
- localization_goal_.pipeline = ff_msgs::LocalizationGoal::PIPELINE_PERCH;
+ localization_goal_.pipeline =
+ ff_msgs::action::Localization::Goal::PIPELINE_PERCH;
} else if (cmd->args[0].s ==
CommandConstants::PARAM_NAME_LOCALIZATION_MODE_TRUTH) {
- localization_goal_.pipeline = ff_msgs::LocalizationGoal::PIPELINE_TRUTH;
+ localization_goal_.pipeline =
+ ff_msgs::action::Localization::Goal::PIPELINE_TRUTH;
}
return StartAction(LOCALIZATION, cmd->cmd_id);
}
return false;
}
-bool Executive::Undock(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing undock command!");
+bool Executive::Undock(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing undock command!");
bool docked = false;
std::string err_msg = "";
// Make sure robot is docked before attempting to undock. Only accept undock
// in the ready op state so only need to check perched, stopped, or drifting
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DRIFTING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DRIFTING) {
err_msg = "Can't undock when not docked. Astrobee is currently drifting.";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::PERCHING) {
+ ff_msgs::msg::MobilityState::PERCHING) {
err_msg = "Can't undock when not docked. Astrobee is currently perched.";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::STOPPING) {
+ ff_msgs::msg::MobilityState::STOPPING) {
err_msg = "Can't undock when not docked. Astrobee is currently stopped.";
} else {
docked = true;
@@ -3441,36 +3542,38 @@ bool Executive::Undock(ff_msgs::CommandStampedPtr const& cmd) {
// need to fail an ack if we aren't docked and thus cannot undock
if (!docked) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
}
return docked;
}
-bool Executive::UnloadNodelet(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing unload nodelet command!");
+bool Executive::UnloadNodelet(
+ ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing unload nodelet command!");
return LoadUnloadNodelet(cmd);
}
-bool Executive::Unperch(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing unperch command!");
+bool Executive::Unperch(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing unperch command!");
bool perched = false;
std::string err_msg = "";
// Make sure robot is perched before attempting to unperch. Only accept
// unperch in the ready op state so only need to check docked, stopped, or
// drifting
- if (agent_state_.mobility_state.state == ff_msgs::MobilityState::DOCKING) {
+ if (agent_state_.mobility_state.state ==
+ ff_msgs::msg::MobilityState::DOCKING) {
err_msg = "Can't unperch when not perched. Astrobee is currently docked.";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::DRIFTING) {
+ ff_msgs::msg::MobilityState::DRIFTING) {
err_msg = "Can't unperch when not perched. Astrobeep is currently drifting";
} else if (agent_state_.mobility_state.state ==
- ff_msgs::MobilityState::STOPPING) {
+ ff_msgs::msg::MobilityState::STOPPING) {
err_msg = "Can't unperch when not perched. Astrobee is currently stopped.";
} else {
perched = true;
- perch_goal_.command = ff_msgs::PerchGoal::UNPERCH;
+ perch_goal_.command = ff_msgs::action::Perch::Goal::UNPERCH;
if (!StartAction(UNPERCH, cmd->cmd_id)) {
return false;
@@ -3481,32 +3584,32 @@ bool Executive::Unperch(ff_msgs::CommandStampedPtr const& cmd) {
// if we aren't perched and thus cannot unperch
if (!perched) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
err_msg);
}
return perched;
}
-bool Executive::Unterminate(ff_msgs::CommandStampedPtr const& cmd) {
- ff_hw_msgs::ClearTerminate clear_srv;
+bool Executive::Unterminate(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ ff_util::FreeFlyerService clear_srv;
// Clear eps terminate flag
- if (!CheckServiceExists(eps_terminate_client_,
+ if (!CheckServiceExists(eps_terminate_client_.exists(),
"EPS terminate",
cmd->cmd_id)) {
return false;
}
if (eps_terminate_client_.call(clear_srv)) {
- if (!clear_srv.response.success) {
+ if (!clear_srv.response->success) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
- clear_srv.response.status_message);
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
+ clear_srv.response->status_message);
return false;
}
} else {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::EXEC_FAILED,
+ ff_msgs::msg::AckCompletedStatus::EXEC_FAILED,
"Eps clear terminate service returned false.");
return false;
}
@@ -3515,12 +3618,12 @@ bool Executive::Unterminate(ff_msgs::CommandStampedPtr const& cmd) {
return true;
}
-bool Executive::Wait(ff_msgs::CommandStampedPtr const& cmd) {
- NODELET_INFO("Executive executing wait command! Duration %f", cmd->args[0].f);
- if (cmd->args[0].data_type != ff_msgs::CommandArg::DATA_TYPE_FLOAT ||
+bool Executive::Wait(ff_msgs::msg::CommandStamped::SharedPtr const cmd) {
+ FF_INFO("Executive executing wait command! Duration %f", cmd->args[0].f);
+ if (cmd->args[0].data_type != ff_msgs::msg::CommandArg::DATA_TYPE_FLOAT ||
cmd->args[0].f < 0) {
state_->AckCmd(cmd->cmd_id,
- ff_msgs::AckCompletedStatus::BAD_SYNTAX,
+ ff_msgs::msg::AckCompletedStatus::BAD_SYNTAX,
"Malformed arguments for wait command!");
return false;
}
@@ -3530,12 +3633,14 @@ bool Executive::Wait(ff_msgs::CommandStampedPtr const& cmd) {
}
/************************ Protected *******************************************/
-void Executive::Initialize(ros::NodeHandle *nh) {
+void Executive::Initialize(NodeHandle &nh) {
std::string err_msg;
// Set executive in op state repo so the op_states can call this executive
OpStateRepo::Instance()->SetExec(this);
- nh_ = *nh;
+ nh_ = nh;
+
+ sequencer_.SetNodeHandle(nh);
// Read in all the action timeouts. They are in config files so that they can
// be changed on the fly.
@@ -3555,11 +3660,11 @@ void Executive::Initialize(ros::NodeHandle *nh) {
}
// Set up a timer to check and reload timeouts if they are changed.
- reload_params_timer_ = nh_.createTimer(ros::Duration(1),
- [this](ros::TimerEvent e) {
+ reload_params_timer_.createTimer(1.0,
+ [this]() {
config_params_.CheckFilesUpdated(std::bind(&Executive::ReadParams,
this));},
- false, true);
+ nh, false, true);
// initialize actions
arm_ac_.SetActiveTimeout(action_active_timeout_);
@@ -3607,200 +3712,202 @@ void Executive::Initialize(ros::NodeHandle *nh) {
perch_ac_.Create(nh, ACTION_BEHAVIORS_PERCH);
// initialize subs
- camera_state_sub_ = nh_.subscribe(TOPIC_MANAGEMENT_CAMERA_STATE,
- sub_queue_size_,
- &Executive::CameraStatesCallback,
- this);
-
- cmd_sub_ = nh_.subscribe(TOPIC_COMMAND,
- sub_queue_size_,
- &Executive::CmdCallback,
- this);
-
- data_sub_ = nh_.subscribe(TOPIC_COMMUNICATIONS_DDS_DATA,
- sub_queue_size_,
- &Executive::DataToDiskCallback,
- this);
-
- dock_state_sub_ = nh_.subscribe(TOPIC_BEHAVIORS_DOCKING_STATE,
- sub_queue_size_,
- &Executive::DockStateCallback,
- this);
-
- fault_state_sub_ = nh_.subscribe(TOPIC_MANAGEMENT_SYS_MONITOR_STATE,
- sub_queue_size_,
- &Executive::FaultStateCallback,
- this);
-
- gs_ack_sub_ = nh_.subscribe(TOPIC_GUEST_SCIENCE_MANAGER_ACK,
- sub_queue_size_,
- &Executive::GuestScienceAckCallback,
- this);
-
- gs_config_sub_ = nh_.subscribe(TOPIC_GUEST_SCIENCE_MANAGER_CONFIG,
- sub_queue_size_,
- &Executive::GuestScienceConfigCallback,
- this);
-
- gs_state_sub_ = nh_.subscribe(TOPIC_GUEST_SCIENCE_MANAGER_STATE,
- sub_queue_size_,
- &Executive::GuestScienceStateCallback,
- this);
-
- heartbeat_sub_ = nh_.subscribe(TOPIC_MANAGEMENT_SYS_MONITOR_HEARTBEAT,
- sub_queue_size_,
- &Executive::SysMonitorHeartbeatCallback,
- this);
-
-
- inertia_sub_ = nh_.subscribe(TOPIC_MOBILITY_INERTIA,
- sub_queue_size_,
- &Executive::InertiaCallback,
- this);
-
- motion_sub_ = nh_.subscribe(TOPIC_MOBILITY_MOTION_STATE,
- sub_queue_size_,
- &Executive::MotionStateCallback,
- this);
-
- perch_state_sub_ = nh_.subscribe(TOPIC_BEHAVIORS_PERCHING_STATE,
- sub_queue_size_,
- &Executive::PerchStateCallback,
- this);
-
- plan_sub_ = nh_.subscribe(TOPIC_COMMUNICATIONS_DDS_PLAN,
- sub_queue_size_,
- &Executive::PlanCallback,
- this);
-
- zones_sub_ = nh_.subscribe(TOPIC_COMMUNICATIONS_DDS_ZONES,
- sub_queue_size_,
- &Executive::ZonesCallback,
- this);
+ camera_state_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::CameraStatesStamped,
+ TOPIC_MANAGEMENT_CAMERA_STATE,
+ sub_queue_size_,
+ std::bind(&Executive::CameraStatesCallback, this, std::placeholders::_1));
+
+ cmd_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::CommandStamped,
+ TOPIC_COMMAND,
+ sub_queue_size_,
+ std::bind(&Executive::CmdCallback, this, std::placeholders::_1));
+
+ data_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::CompressedFile,
+ TOPIC_COMMUNICATIONS_DDS_DATA,
+ sub_queue_size_,
+ std::bind(&Executive::DataToDiskCallback, this, std::placeholders::_1));
+
+ dock_state_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::DockState,
+ TOPIC_BEHAVIORS_DOCKING_STATE,
+ sub_queue_size_,
+ std::bind(&Executive::DockStateCallback, this, std::placeholders::_1));
+
+ fault_state_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::FaultState,
+ TOPIC_MANAGEMENT_SYS_MONITOR_STATE,
+ sub_queue_size_,
+ std::bind(&Executive::FaultStateCallback, this, std::placeholders::_1));
+
+ gs_ack_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::AckStamped,
+ TOPIC_GUEST_SCIENCE_MANAGER_ACK,
+ sub_queue_size_,
+ std::bind(&Executive::GuestScienceAckCallback, this,
+ std::placeholders::_1));
+
+ gs_config_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::GuestScienceConfig,
+ TOPIC_GUEST_SCIENCE_MANAGER_CONFIG,
+ sub_queue_size_,
+ std::bind(&Executive::GuestScienceConfigCallback, this,
+ std::placeholders::_1));
+
+ gs_state_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::GuestScienceState,
+ TOPIC_GUEST_SCIENCE_MANAGER_STATE,
+ sub_queue_size_,
+ std::bind(&Executive::GuestScienceStateCallback, this,
+ std::placeholders::_1));
+
+ heartbeat_sub_ =
+ FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::Heartbeat,
+ TOPIC_MANAGEMENT_SYS_MONITOR_HEARTBEAT,
+ sub_queue_size_,
+ std::bind(&Executive::SysMonitorHeartbeatCallback, this, std::placeholders::_1));
+
+ inertia_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ geometry_msgs::msg::InertiaStamped,
+ TOPIC_MOBILITY_INERTIA,
+ sub_queue_size_,
+ std::bind(&Executive::InertiaCallback, this, std::placeholders::_1));
+
+ motion_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::MotionState,
+ TOPIC_MOBILITY_MOTION_STATE,
+ sub_queue_size_,
+ std::bind(&Executive::MotionStateCallback, this, std::placeholders::_1));
+
+ perch_state_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::PerchState,
+ TOPIC_BEHAVIORS_PERCHING_STATE,
+ sub_queue_size_,
+ std::bind(&Executive::PerchStateCallback, this, std::placeholders::_1));
+
+ plan_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::CompressedFile,
+ TOPIC_COMMUNICATIONS_DDS_PLAN,
+ sub_queue_size_,
+ std::bind(&Executive::PlanCallback, this, std::placeholders::_1));
+
+ zones_sub_ = FF_CREATE_SUBSCRIBER(nh_,
+ ff_msgs::msg::CompressedFile,
+ TOPIC_COMMUNICATIONS_DDS_ZONES,
+ sub_queue_size_,
+ std::bind(&Executive::ZonesCallback, this, std::placeholders::_1));
// initialize pubs
- agent_state_pub_ = nh_.advertise(
- TOPIC_MANAGEMENT_EXEC_AGENT_STATE,
- pub_queue_size_,
- true);
-
- cf_ack_pub_ = nh_.advertise