Controller for executing joint-space trajectories on a group of joints. More...
#include <joint_trajectory_controller.h>
Classes | |
struct | TimeData |
Public Member Functions | |
JointTrajectoryController () | |
Non Real-Time Safe Functions | |
bool | init (HardwareInterface *hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh) |
Real-Time Safe Functions | |
void | starting (const ros::Time &time) |
Holds the current position. More... | |
void | stopping (const ros::Time &) |
Cancels the active action goal, if any. More... | |
void | update (const ros::Time &time, const ros::Duration &period) |
Public Member Functions inherited from controller_interface::Controller< HardwareInterface > | |
virtual bool | init (T *, ros::NodeHandle &) |
virtual bool | init (T *, ros::NodeHandle &, ros::NodeHandle &) |
Public Member Functions inherited from controller_interface::ControllerBase | |
virtual void | aborting (const ros::Time &) |
virtual void | aborting (const ros::Time &) |
bool | abortRequest (const ros::Time &time) |
bool | abortRequest (const ros::Time &time) |
ControllerBase ()=default | |
ControllerBase (const ControllerBase &)=delete | |
ControllerBase (ControllerBase &&)=delete | |
bool | isAborted () const |
bool | isAborted () const |
bool | isInitialized () const |
bool | isInitialized () const |
bool | isRunning () const |
bool | isRunning () const |
bool | isStopped () const |
bool | isStopped () const |
bool | isWaiting () const |
bool | isWaiting () const |
ControllerBase & | operator= (const ControllerBase &)=delete |
ControllerBase & | operator= (ControllerBase &&)=delete |
bool | startRequest (const ros::Time &time) |
bool | startRequest (const ros::Time &time) |
bool | stopRequest (const ros::Time &time) |
bool | stopRequest (const ros::Time &time) |
void | updateRequest (const ros::Time &time, const ros::Duration &period) |
void | updateRequest (const ros::Time &time, const ros::Duration &period) |
virtual void | waiting (const ros::Time &) |
virtual void | waiting (const ros::Time &) |
bool | waitRequest (const ros::Time &time) |
bool | waitRequest (const ros::Time &time) |
virtual | ~ControllerBase ()=default |
Protected Member Functions | |
virtual void | cancelCB (GoalHandle gh) |
unsigned int | getNumberOfJoints () const |
Returns the number of joints of the robot. More... | |
virtual void | goalCB (GoalHandle gh) |
virtual void | preemptActiveGoal () |
void | publishState (const ros::Time &time) |
Publish current controller state at a throttled frequency. More... | |
virtual bool | queryStateService (control_msgs::QueryTrajectoryState::Request &req, control_msgs::QueryTrajectoryState::Response &resp) |
void | setHoldPosition (const ros::Time &time, RealtimeGoalHandlePtr gh=RealtimeGoalHandlePtr()) |
Hold the current position. More... | |
virtual void | trajectoryCommandCB (const JointTrajectoryConstPtr &msg) |
void | updateStates (const ros::Time &sample_time, const Trajectory *const traj) |
Updates the states by sampling the specified trajectory for each joint at the specified sampling time. More... | |
virtual bool | updateTrajectoryCommand (const JointTrajectoryConstPtr &msg, RealtimeGoalHandlePtr gh, std::string *error_string=nullptr) |
Protected Member Functions inherited from controller_interface::Controller< HardwareInterface > | |
std::string | getHardwareInterfaceType () const |
bool | initRequest (hardware_interface::RobotHW *robot_hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh, ClaimedResources &claimed_resources) override |
Static Protected Member Functions | |
static TrajectoryPtr | createHoldTrajectory (const unsigned int &number_of_joints) |
Returns a trajectory consisting of joint trajectories with one pre-allocated segment. More... | |
Private Member Functions | |
void | setActionFeedback () |
Updates the pre-allocated feedback of the current active goal (if any) based on the current state values. More... | |
virtual void | updateFuncExtensionPoint (const Trajectory &curr_traj, const TimeData &time_data) |
Allows derived classes to perform additional checks and to e.g. replace the newly calculated desired value before the hardware interface is finally updated. More... | |
Additional Inherited Members | |
Public Types inherited from controller_interface::ControllerBase | |
typedef std::vector< hardware_interface::InterfaceResources > | ClaimedResources |
Public Attributes inherited from controller_interface::ControllerBase | |
ABORTED | |
CONSTRUCTED | |
INITIALIZED | |
RUNNING | |
enum controller_interface::ControllerBase:: { ... } | state_ |
STOPPED | |
WAITING | |
Controller for executing joint-space trajectories on a group of joints.
SegmentImpl | Trajectory segment representation to use. The type must comply with the following structure: class FooSegment { public: // Required types typedef Scalar Time; typedef PosVelAccState<Scalar> State; // Default constructor FooSegment(); // Constructor from start and end states (boundary conditions) FooSegment(const Time& start_time, const State& start_state, const Time& end_time, const State& end_state); // Start and end states initializer (the guts of the above constructor) // May throw std::invalid_argument if parameters are invalid const State& start_state, const Time& end_time, const State& end_state); // Sampler (realtime-safe) // Accesors (realtime-safe) Time startTime() const; Time endTime() const; unsigned int size() const; }; |
HardwareInterface | Controller hardware interface. Currently hardware_interface::PositionJointInterface , hardware_interface::VelocityJointInterface , and hardware_interface::EffortJointInterface are supported out-of-the-box. |
Definition at line 128 of file joint_trajectory_controller.h.
|
protected |
Definition at line 161 of file joint_trajectory_controller.h.
|
protected |
Definition at line 162 of file joint_trajectory_controller.h.
|
protected |
Definition at line 163 of file joint_trajectory_controller.h.
|
protected |
Definition at line 178 of file joint_trajectory_controller.h.
|
protected |
Definition at line 179 of file joint_trajectory_controller.h.
|
protected |
Definition at line 166 of file joint_trajectory_controller.h.
|
protected |
Definition at line 164 of file joint_trajectory_controller.h.
|
protected |
Definition at line 165 of file joint_trajectory_controller.h.
|
protected |
Definition at line 176 of file joint_trajectory_controller.h.
|
protected |
Definition at line 170 of file joint_trajectory_controller.h.
|
protected |
Definition at line 167 of file joint_trajectory_controller.h.
|
protected |
Definition at line 168 of file joint_trajectory_controller.h.
|
protected |
Definition at line 172 of file joint_trajectory_controller.h.
|
protected |
Definition at line 175 of file joint_trajectory_controller.h.
|
protected |
Definition at line 171 of file joint_trajectory_controller.h.
|
protected |
Definition at line 174 of file joint_trajectory_controller.h.
|
protected |
Definition at line 173 of file joint_trajectory_controller.h.
joint_trajectory_controller::JointTrajectoryController< SegmentImpl, HardwareInterface >::JointTrajectoryController | ( | ) |
Definition at line 190 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 634 of file joint_trajectory_controller_impl.h.
|
staticprotected |
Returns a trajectory consisting of joint trajectories with one pre-allocated segment.
Definition at line 807 of file joint_trajectory_controller_impl.h.
|
inlineprotected |
Returns the number of joints of the robot.
Definition at line 750 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 561 of file joint_trajectory_controller_impl.h.
bool joint_trajectory_controller::JointTrajectoryController< SegmentImpl, HardwareInterface >::init | ( | HardwareInterface * | hw, |
ros::NodeHandle & | root_nh, | ||
ros::NodeHandle & | controller_nh | ||
) |
Definition at line 205 of file joint_trajectory_controller_impl.h.
|
inlineprotectedvirtual |
Definition at line 175 of file joint_trajectory_controller_impl.h.
|
protected |
Publish current controller state at a throttled frequency.
Definition at line 706 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 658 of file joint_trajectory_controller_impl.h.
|
private |
Updates the pre-allocated feedback of the current active goal (if any) based on the current state values.
Definition at line 785 of file joint_trajectory_controller_impl.h.
|
inlineprotected |
Hold the current position.
Substitutes the current trajectory with a single-segment one going from the current position and velocity to zero velocity.
Definition at line 731 of file joint_trajectory_controller_impl.h.
|
inlinevirtual |
Holds the current position.
Reimplemented from controller_interface::ControllerBase.
Definition at line 133 of file joint_trajectory_controller_impl.h.
|
inlinevirtual |
Cancels the active action goal, if any.
Reimplemented from controller_interface::ControllerBase.
Definition at line 160 of file joint_trajectory_controller_impl.h.
|
inlineprotectedvirtual |
Definition at line 167 of file joint_trajectory_controller_impl.h.
|
virtual |
Implements controller_interface::ControllerBase.
Definition at line 347 of file joint_trajectory_controller_impl.h.
|
inlineprivatevirtual |
Allows derived classes to perform additional checks and to e.g. replace the newly calculated desired value before the hardware interface is finally updated.
curr_traj | The trajectory that is executed during the current update. |
time_data | Updated time data. |
Definition at line 743 of file joint_trajectory_controller_impl.h.
|
protected |
Updates the states by sampling the specified trajectory for each joint at the specified sampling time.
The current state is updated based on the values transmitted by the corresponding JointHandles.
sample_time | Time point at which the joint trajectories have to be sampled. |
traj | Trajectory containing all joint trajectories currently under execution. |
Definition at line 757 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 475 of file joint_trajectory_controller_impl.h.
|
protected |
Definition at line 214 of file joint_trajectory_controller.h.
|
protected |
Definition at line 223 of file joint_trajectory_controller.h.
|
protected |
Definition at line 218 of file joint_trajectory_controller.h.
|
protected |
Whether controlled joints wrap around or not.
Definition at line 184 of file joint_trajectory_controller.h.
|
protected |
Definition at line 221 of file joint_trajectory_controller.h.
|
protected |
Thread-safe container with a smart pointer to trajectory currently being followed. Can be either a hold trajectory or a trajectory received from a ROS message.
We store the hold trajectory in a separate class member because the starting(time)
method must be realtime-safe. The (single segment) hold trajectory is preallocated at initialization time and its size is kept unchanged.
Definition at line 198 of file joint_trajectory_controller.h.
|
protected |
Preallocated workspace variable.
Definition at line 201 of file joint_trajectory_controller.h.
|
protected |
Default trajectory segment tolerances.
Definition at line 186 of file joint_trajectory_controller.h.
|
protected |
Preallocated workspace variable.
Definition at line 205 of file joint_trajectory_controller.h.
|
protected |
Preallocated workspace variable.
Definition at line 202 of file joint_trajectory_controller.h.
|
protected |
Definition at line 227 of file joint_trajectory_controller.h.
|
protected |
Definition at line 208 of file joint_trajectory_controller.h.
|
protected |
Last hold trajectory values.
Definition at line 199 of file joint_trajectory_controller.h.
|
protected |
Adapts desired trajectory state to HW interface.
Definition at line 187 of file joint_trajectory_controller.h.
|
protected |
Controlled joint names.
Definition at line 185 of file joint_trajectory_controller.h.
|
protected |
Handles to controlled joints.
Definition at line 183 of file joint_trajectory_controller.h.
|
protected |
Definition at line 228 of file joint_trajectory_controller.h.
|
protected |
Controller name.
Definition at line 182 of file joint_trajectory_controller.h.
|
protected |
Preallocated workspace variable.
Definition at line 203 of file joint_trajectory_controller.h.
|
protected |
Definition at line 211 of file joint_trajectory_controller.h.
|
protected |
Definition at line 224 of file joint_trajectory_controller.h.
|
protected |
Currently active action goal, if any.
Definition at line 189 of file joint_trajectory_controller.h.
|
protected |
Preallocated workspace variable.
Definition at line 204 of file joint_trajectory_controller.h.
|
protected |
Preallocated workspace variable.
Definition at line 206 of file joint_trajectory_controller.h.
|
protected |
Definition at line 225 of file joint_trajectory_controller.h.
|
protected |
Definition at line 213 of file joint_trajectory_controller.h.
|
protected |
Duration for stop ramp. If zero, the controller stops at the actual position.
Definition at line 216 of file joint_trajectory_controller.h.
|
protected |
Definition at line 217 of file joint_trajectory_controller.h.
|
protected |
Definition at line 210 of file joint_trajectory_controller.h.
|
protected |
Definition at line 222 of file joint_trajectory_controller.h.
|
protected |
Hard coded verbose flag to help in debugging.
Definition at line 181 of file joint_trajectory_controller.h.