Skip to main content
Version: 2.0.0

Using the API

note

All action names and service names are namespace prefixed with the robot serial number.

Commanding the Robot

To command a robot, we provide action interfaces that are defined in our Autonomy API. Below, are the action_name, action_type, and pkg_name for each required action. The user is then able to write their own C++ or Python action client using this information.

Start a mission

action_nameautonomy/network_mission
pkg_nameclearpath_navigation_msgs
action_typeExecuteNetworkMissionByUuid

Start a Mission from a specific goal

action_nameautonomy/network_mission_from_goal
pkg_nameclearpath_navigation_msgs
action_typeExecuteNetworkMissionFromGoal

Send the robot to a location in the map

action_nameautonomy/network_goto
pkg_nameclearpath_navigation_msgs
action_typeExecuteNetworkGoTo

Send the robot to a point of interest (POI)

action_nameautonomy/network_goto_poi
pkg_nameclearpath_navigation_msgs
action_typeExecuteNetworkGoToPOI

Docking the robot

Local docking

action_nameautonomy/local_dock
pkg_nameclearpath_navigation_msgs
action_typeDock

Local undocking

action_nameautonomy/local_undock
pkg_nameclearpath_navigation_msgs
action_typeUndock

action_name: autonomy/local_undock

pkg_name: clearpath_dock_msgs

action_type: Undock

Network docking

action_nameautonomy/network_dock
pkg_nameclearpath_navigation_msgs
action_typeNetworkDock

Pause navigation

service_namecontrol_selection/pause
pkg_namestd_srvs
service_typeSetBool

Resume navigation

service_namecontrol_selection/resume
pkg_namestd_srvs
service_typeSetBool

Stop all autonomy actions

service_nameautonomy/stop
pkg_namestd_srvs
service_typeTrigger

Action Client (C++)

#include "action_tutorials_interfaces/action/fibonacci.hpp"

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "rclcpp_components/register_node_macro.hpp"

...
using <action_type> = action_tutorials_interfaces::action::<action_type>;
using GoalHandle<action_type> = rclcpp_action::ClientGoalHandle<action_type>;

...
this->client_ptr_ = rclcpp_action::create_client<<action_type>>(
this, <action_name>);

...
auto goal_msg = <action_type>::Goal();
auto send_goal_options = rclcpp_action::Client<<action_type>>::SendGoalOptions();

...
this->client_ptr_->async_send_goal(goal_msg, send_goal_options);

Action Client (Python)

from <pkg_name>.action import <action_type>

...

self._action_client = ActionClient(self, <action_type>, <action_name>)

...
goal_msgs = <action_type>.Goal()
self._action_client.wait_for_server()
self._action_client.send_goal_async(goal_msg)

Terminal Command-line

In order to command the robot from the command-line, you will need to run the following command, where the --feedack argument will allow the user to view the action feedbacks message:

ros2 action send_goal <action_name> <action_type> <values> --feedback

The values are based on the actions message type.