#include <trajectory_execution_manager.h>
Classes | |
struct | ControllerInformation |
class | DynamicReconfigureImpl |
struct | TrajectoryExecutionContext |
Data structure that represents information necessary to execute a trajectory. More... | |
Public Types | |
typedef boost::function< void(const moveit_controller_manager::ExecutionStatus &)> | ExecutionCompleteCallback |
typedef boost::function< void(std::size_t)> | PathSegmentCompleteCallback |
Public Member Functions | |
bool | areControllersActive (const std::vector< std::string > &controllers) |
Check if a set of controllers are active. More... | |
void | clear () |
Clear the trajectories to execute. More... | |
void | enableExecutionDurationMonitoring (bool flag) |
bool | ensureActiveController (const std::string &controller) |
Make sure a particular controller is active. More... | |
bool | ensureActiveControllers (const std::vector< std::string > &controllers) |
Make sure a particular set of controllers are active. More... | |
bool | ensureActiveControllersForGroup (const std::string &group) |
Make sure the active controllers are such that trajectories that actuate joints in the specified group can be executed. More... | |
bool | ensureActiveControllersForJoints (const std::vector< std::string > &joints) |
Make sure the active controllers are such that trajectories that actuate joints in the specified set can be executed. More... | |
void | execute (const ExecutionCompleteCallback &callback=ExecutionCompleteCallback(), bool auto_clear=true) |
Start the execution of pushed trajectories; this does not wait for completion, but calls a callback when done. More... | |
void | execute (const ExecutionCompleteCallback &callback, const PathSegmentCompleteCallback &part_callback, bool auto_clear=true) |
moveit_controller_manager::ExecutionStatus | executeAndWait (bool auto_clear=true) |
const moveit_controller_manager::MoveItControllerManagerPtr & | getControllerManager () const |
Get the instance of the controller manager used (this is the plugin instance loaded) More... | |
std::pair< int, int > | getCurrentExpectedTrajectoryIndex () const |
moveit_controller_manager::ExecutionStatus | getLastExecutionStatus () const |
Return the controller status for the last attempted execution. More... | |
const std::vector< TrajectoryExecutionContext * > & | getTrajectories () const |
Get the trajectories to be executed. More... | |
bool | isControllerActive (const std::string &controller) |
Check if a controller is active. More... | |
bool | isManagingControllers () const |
If this function returns true, then this instance of the manager is allowed to load/unload/switch controllers. More... | |
void | processEvent (const std::string &event) |
Execute a named event (e.g., 'stop') More... | |
bool | push (const moveit_msgs::RobotTrajectory &trajectory, const std::string &controller="") |
bool | push (const trajectory_msgs::JointTrajectory &trajectory, const std::string &controller="") |
bool | push (const trajectory_msgs::JointTrajectory &trajectory, const std::vector< std::string > &controllers) |
bool | push (const moveit_msgs::RobotTrajectory &trajectory, const std::vector< std::string > &controllers) |
bool | pushAndExecute (const moveit_msgs::RobotTrajectory &trajectory, const std::string &controller="") |
bool | pushAndExecute (const trajectory_msgs::JointTrajectory &trajectory, const std::string &controller="") |
bool | pushAndExecute (const sensor_msgs::JointState &state, const std::string &controller="") |
bool | pushAndExecute (const trajectory_msgs::JointTrajectory &trajectory, const std::vector< std::string > &controllers) |
bool | pushAndExecute (const moveit_msgs::RobotTrajectory &trajectory, const std::vector< std::string > &controllers) |
bool | pushAndExecute (const sensor_msgs::JointState &state, const std::vector< std::string > &controllers) |
void | setAllowedExecutionDurationScaling (double scaling) |
void | setAllowedGoalDurationMargin (double margin) |
void | setAllowedStartTolerance (double tolerance) |
Set joint-value tolerance for validating trajectory's start point against current robot state. More... | |
void | setExecutionVelocityScaling (double scaling) |
void | setWaitForTrajectoryCompletion (bool flag) |
Enable or disable waiting for trajectory completion. More... | |
void | stopExecution (bool auto_clear=true) |
Stop whatever executions are active, if any. More... | |
TrajectoryExecutionManager (const robot_model::RobotModelConstPtr &kmodel, const planning_scene_monitor::CurrentStateMonitorPtr &csm) | |
Load the controller manager plugin, start listening for events on a topic. More... | |
TrajectoryExecutionManager (const robot_model::RobotModelConstPtr &kmodel, const planning_scene_monitor::CurrentStateMonitorPtr &csm, bool manage_controllers) | |
Load the controller manager plugin, start listening for events on a topic. More... | |
moveit_controller_manager::ExecutionStatus | waitForExecution () |
~TrajectoryExecutionManager () | |
Destructor. Cancels all running trajectories (if any) More... | |
Static Public Attributes | |
static const std::string | EXECUTION_EVENT_TOPIC = "trajectory_execution_event" |
Private Member Functions | |
bool | checkControllerCombination (std::vector< std::string > &controllers, const std::set< std::string > &actuated_joints) |
bool | configure (TrajectoryExecutionContext &context, const moveit_msgs::RobotTrajectory &trajectory, const std::vector< std::string > &controllers) |
void | continuousExecutionThread () |
bool | distributeTrajectory (const moveit_msgs::RobotTrajectory &trajectory, const std::vector< std::string > &controllers, std::vector< moveit_msgs::RobotTrajectory > &parts) |
bool | executePart (std::size_t part_index) |
void | executeThread (const ExecutionCompleteCallback &callback, const PathSegmentCompleteCallback &part_callback, bool auto_clear) |
bool | findControllers (const std::set< std::string > &actuated_joints, std::size_t controller_count, const std::vector< std::string > &available_controllers, std::vector< std::string > &selected_controllers) |
void | generateControllerCombination (std::size_t start_index, std::size_t controller_count, const std::vector< std::string > &available_controllers, std::vector< std::string > &selected_controllers, std::vector< std::vector< std::string > > &selected_options, const std::set< std::string > &actuated_joints) |
void | initialize () |
void | loadControllerParams () |
void | receiveEvent (const std_msgs::StringConstPtr &event) |
void | reloadControllerInformation () |
bool | selectControllers (const std::set< std::string > &actuated_joints, const std::vector< std::string > &available_controllers, std::vector< std::string > &selected_controllers) |
void | stopExecutionInternal () |
void | updateControllersState (const ros::Duration &age) |
void | updateControllerState (const std::string &controller, const ros::Duration &age) |
void | updateControllerState (ControllerInformation &ci, const ros::Duration &age) |
bool | validate (const TrajectoryExecutionContext &context) const |
Validate first point of trajectory matches current robot state. More... | |
bool | waitForRobotToStop (const TrajectoryExecutionContext &context, double wait_time=1.0) |
Definition at line 60 of file trajectory_execution_manager.h.
typedef boost::function<void(const moveit_controller_manager::ExecutionStatus&)> trajectory_execution_manager::TrajectoryExecutionManager::ExecutionCompleteCallback |
Definition of the function signature that is called when the execution of all the pushed trajectories completes. The status of the overall execution is passed as argument
Definition at line 67 of file trajectory_execution_manager.h.
typedef boost::function<void(std::size_t)> trajectory_execution_manager::TrajectoryExecutionManager::PathSegmentCompleteCallback |
Definition of the function signature that is called when the execution of a pushed trajectory completes successfully.
Definition at line 71 of file trajectory_execution_manager.h.
trajectory_execution_manager::TrajectoryExecutionManager::TrajectoryExecutionManager | ( | const robot_model::RobotModelConstPtr & | kmodel, |
const planning_scene_monitor::CurrentStateMonitorPtr & | csm | ||
) |
Load the controller manager plugin, start listening for events on a topic.
Definition at line 81 of file trajectory_execution_manager.cpp.
trajectory_execution_manager::TrajectoryExecutionManager::TrajectoryExecutionManager | ( | const robot_model::RobotModelConstPtr & | kmodel, |
const planning_scene_monitor::CurrentStateMonitorPtr & | csm, | ||
bool | manage_controllers | ||
) |
Load the controller manager plugin, start listening for events on a topic.
Definition at line 91 of file trajectory_execution_manager.cpp.
trajectory_execution_manager::TrajectoryExecutionManager::~TrajectoryExecutionManager | ( | ) |
Destructor. Cancels all running trajectories (if any)
Definition at line 99 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::areControllersActive | ( | const std::vector< std::string > & | controllers | ) |
Check if a set of controllers are active.
Definition at line 771 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 591 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::clear | ( | void | ) |
Clear the trajectories to execute.
Definition at line 1249 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 1040 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 385 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 809 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::enableExecutionDurationMonitoring | ( | bool | flag | ) |
Enable or disable the monitoring of trajectory execution duration. If a controller takes longer than expected, the trajectory is canceled
Definition at line 193 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::ensureActiveController | ( | const std::string & | controller | ) |
Make sure a particular controller is active.
Definition at line 1653 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::ensureActiveControllers | ( | const std::vector< std::string > & | controllers | ) |
Make sure a particular set of controllers are active.
Definition at line 1658 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::ensureActiveControllersForGroup | ( | const std::string & | group | ) |
Make sure the active controllers are such that trajectories that actuate joints in the specified group can be executed.
Definition at line 1619 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::ensureActiveControllersForJoints | ( | const std::vector< std::string > & | joints | ) |
Make sure the active controllers are such that trajectories that actuate joints in the specified set can be executed.
Definition at line 1628 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::execute | ( | const ExecutionCompleteCallback & | callback = ExecutionCompleteCallback() , |
bool | auto_clear = true |
||
) |
Start the execution of pushed trajectories; this does not wait for completion, but calls a callback when done.
Definition at line 1203 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::execute | ( | const ExecutionCompleteCallback & | callback, |
const PathSegmentCompleteCallback & | part_callback, | ||
bool | auto_clear = true |
||
) |
Start the execution of pushed trajectories; this does not wait for completion, but calls a callback when done. A callback is also called for every trajectory part that completes successfully.
Definition at line 1208 of file trajectory_execution_manager.cpp.
moveit_controller_manager::ExecutionStatus trajectory_execution_manager::TrajectoryExecutionManager::executeAndWait | ( | bool | auto_clear = true | ) |
This is a blocking call for the execution of the passed in trajectories. This just calls execute() and waitForExecution()
Definition at line 1143 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 1321 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 1269 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 682 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 617 of file trajectory_execution_manager.cpp.
const moveit_controller_manager::MoveItControllerManagerPtr & trajectory_execution_manager::TrajectoryExecutionManager::getControllerManager | ( | ) | const |
Get the instance of the controller manager used (this is the plugin instance loaded)
Definition at line 228 of file trajectory_execution_manager.cpp.
std::pair< int, int > trajectory_execution_manager::TrajectoryExecutionManager::getCurrentExpectedTrajectoryIndex | ( | ) | const |
Get the state that the robot is expected to be at, given current time, after execute() has been called. The return value is a pair of two index values: first = the index of the trajectory to be executed (in the order push() was called), second = the index of the point within that trajectory. Values of -1 are returned when there is no trajectory being executed, or if the trajectory was passed using pushAndExecute().
Definition at line 1595 of file trajectory_execution_manager.cpp.
moveit_controller_manager::ExecutionStatus trajectory_execution_manager::TrajectoryExecutionManager::getLastExecutionStatus | ( | ) | const |
Return the controller status for the last attempted execution.
Definition at line 1614 of file trajectory_execution_manager.cpp.
const std::vector< TrajectoryExecutionManager::TrajectoryExecutionContext * > & trajectory_execution_manager::TrajectoryExecutionManager::getTrajectories | ( | ) | const |
Get the trajectories to be executed.
Definition at line 1609 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 109 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::isControllerActive | ( | const std::string & | controller | ) |
Check if a controller is active.
Definition at line 766 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::isManagingControllers | ( | ) | const |
If this function returns true, then this instance of the manager is allowed to load/unload/switch controllers.
Definition at line 223 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 1757 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::processEvent | ( | const std::string & | event | ) |
Execute a named event (e.g., 'stop')
Definition at line 233 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::push | ( | const moveit_msgs::RobotTrajectory & | trajectory, |
const std::string & | controller = "" |
||
) |
Add a trajectory for future execution. Optionally specify a controller to use for the trajectory. If no controller is specified, a default is used.
Definition at line 247 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::push | ( | const trajectory_msgs::JointTrajectory & | trajectory, |
const std::string & | controller = "" |
||
) |
Add a trajectory for future execution. Optionally specify a controller to use for the trajectory. If no controller is specified, a default is used.
Definition at line 255 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::push | ( | const trajectory_msgs::JointTrajectory & | trajectory, |
const std::vector< std::string > & | controllers | ||
) |
Add a trajectory for future execution. Optionally specify a set of controllers to consider using for the trajectory. Multiple controllers can be used simultaneously to execute the different parts of the trajectory. If multiple controllers can be used, preference is given to the already loaded ones. If no controller is specified, a default is used.
Definition at line 263 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::push | ( | const moveit_msgs::RobotTrajectory & | trajectory, |
const std::vector< std::string > & | controllers | ||
) |
Add a trajectory for future execution. Optionally specify a set of controllers to consider using for the trajectory. Multiple controllers can be used simultaneously to execute the different parts of the trajectory. If multiple controllers can be used, preference is given to the already loaded ones. If no controller is specified, a default is used.
Definition at line 271 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::pushAndExecute | ( | const moveit_msgs::RobotTrajectory & | trajectory, |
const std::string & | controller = "" |
||
) |
Add a trajectory for immediate execution. Optionally specify a controller to use for the trajectory. If no controller is specified, a default is used. This call is non-blocking.
Definition at line 306 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::pushAndExecute | ( | const trajectory_msgs::JointTrajectory & | trajectory, |
const std::string & | controller = "" |
||
) |
Add a trajectory for immediate execution. Optionally specify a controller to use for the trajectory. If no controller is specified, a default is used. This call is non-blocking.
Definition at line 315 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::pushAndExecute | ( | const sensor_msgs::JointState & | state, |
const std::string & | controller = "" |
||
) |
Add a trajectory that consists of a single state for immediate execution. Optionally specify a controller to use for the trajectory. If no controller is specified, a default is used. This call is non-blocking.
Definition at line 324 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::pushAndExecute | ( | const trajectory_msgs::JointTrajectory & | trajectory, |
const std::vector< std::string > & | controllers | ||
) |
Add a trajectory for immediate execution. Optionally specify a set of controllers to consider using for the trajectory. Multiple controllers can be used simultaneously to execute the different parts of the trajectory. If multiple controllers can be used, preference is given to the already loaded ones. If no controller is specified, a default is used. This call is non-blocking.
Definition at line 332 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::pushAndExecute | ( | const moveit_msgs::RobotTrajectory & | trajectory, |
const std::vector< std::string > & | controllers | ||
) |
Add a trajectory for immediate execution. Optionally specify a set of controllers to consider using for the trajectory. Multiple controllers can be used simultaneously to execute the different parts of the trajectory. If multiple controllers can be used, preference is given to the already loaded ones. If no controller is specified, a default is used. This call is non-blocking.
Definition at line 354 of file trajectory_execution_manager.cpp.
bool trajectory_execution_manager::TrajectoryExecutionManager::pushAndExecute | ( | const sensor_msgs::JointState & | state, |
const std::vector< std::string > & | controllers | ||
) |
Add a trajectory that consists of a single state for immediate execution. Optionally specify a set of controllers to consider using for the trajectory. Multiple controllers can be used simultaneously to execute the different parts of the trajectory. If multiple controllers can be used, preference is given to the already loaded ones. If no controller is specified, a default is used. This call is non-blocking.
Definition at line 340 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 241 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 524 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 783 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::setAllowedExecutionDurationScaling | ( | double | scaling | ) |
When determining the expected duration of a trajectory, this multiplicative factor is applied to get the allowed duration of execution
Definition at line 198 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::setAllowedGoalDurationMargin | ( | double | margin | ) |
When determining the expected duration of a trajectory, this multiplicative factor is applied to allow more than the expected execution time before triggering trajectory cancel
Definition at line 203 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::setAllowedStartTolerance | ( | double | tolerance | ) |
Set joint-value tolerance for validating trajectory's start point against current robot state.
Definition at line 213 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::setExecutionVelocityScaling | ( | double | scaling | ) |
Before sending a trajectory to a controller, scale the velocities by the factor specified. By default, this is 1.0
Definition at line 208 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::setWaitForTrajectoryCompletion | ( | bool | flag | ) |
Enable or disable waiting for trajectory completion.
Definition at line 218 of file trajectory_execution_manager.cpp.
void trajectory_execution_manager::TrajectoryExecutionManager::stopExecution | ( | bool | auto_clear = true | ) |
Stop whatever executions are active, if any.
Definition at line 1163 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 1149 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 584 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 559 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 568 of file trajectory_execution_manager.cpp.
|
private |
Validate first point of trajectory matches current robot state.
Definition at line 945 of file trajectory_execution_manager.cpp.
moveit_controller_manager::ExecutionStatus trajectory_execution_manager::TrajectoryExecutionManager::waitForExecution | ( | ) |
Wait until the execution is complete. This only works for executions started by execute(). If you call this after pushAndExecute(), it will immediately stop execution.
Definition at line 1230 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 1536 of file trajectory_execution_manager.cpp.
|
private |
Definition at line 331 of file trajectory_execution_manager.h.
|
private |
Definition at line 353 of file trajectory_execution_manager.h.
|
private |
Definition at line 354 of file trajectory_execution_manager.h.
|
private |
Definition at line 360 of file trajectory_execution_manager.h.
|
private |
Definition at line 325 of file trajectory_execution_manager.h.
|
private |
Definition at line 323 of file trajectory_execution_manager.h.
|
private |
Definition at line 340 of file trajectory_execution_manager.h.
|
private |
Definition at line 320 of file trajectory_execution_manager.h.
|
private |
Definition at line 357 of file trajectory_execution_manager.h.
|
private |
Definition at line 358 of file trajectory_execution_manager.h.
|
private |
Definition at line 344 of file trajectory_execution_manager.h.
|
private |
Definition at line 343 of file trajectory_execution_manager.h.
|
private |
Definition at line 308 of file trajectory_execution_manager.h.
|
private |
Definition at line 332 of file trajectory_execution_manager.h.
|
private |
Definition at line 311 of file trajectory_execution_manager.h.
|
private |
Definition at line 335 of file trajectory_execution_manager.h.
|
private |
Definition at line 328 of file trajectory_execution_manager.h.
|
private |
Definition at line 351 of file trajectory_execution_manager.h.
|
static |
Definition at line 63 of file trajectory_execution_manager.h.
|
private |
Definition at line 322 of file trajectory_execution_manager.h.
|
private |
Definition at line 317 of file trajectory_execution_manager.h.
|
private |
Definition at line 361 of file trajectory_execution_manager.h.
|
private |
Definition at line 313 of file trajectory_execution_manager.h.
|
private |
Definition at line 330 of file trajectory_execution_manager.h.
|
private |
Definition at line 314 of file trajectory_execution_manager.h.
|
private |
Definition at line 305 of file trajectory_execution_manager.h.
|
private |
Definition at line 309 of file trajectory_execution_manager.h.
|
private |
Definition at line 348 of file trajectory_execution_manager.h.
|
private |
Definition at line 307 of file trajectory_execution_manager.h.
|
private |
Definition at line 310 of file trajectory_execution_manager.h.
|
private |
Definition at line 338 of file trajectory_execution_manager.h.
|
private |
Definition at line 337 of file trajectory_execution_manager.h.
|
private |
Definition at line 333 of file trajectory_execution_manager.h.
|
mutableprivate |
Definition at line 334 of file trajectory_execution_manager.h.
|
private |
Definition at line 339 of file trajectory_execution_manager.h.
|
private |
Definition at line 346 of file trajectory_execution_manager.h.
|
private |
Definition at line 362 of file trajectory_execution_manager.h.