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) |
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 |
Real-Time Safe Functions | |
typedef actionlib::ActionServer< control_msgs::FollowJointTrajectoryAction > | ActionServer |
typedef std::shared_ptr< ActionServer > | ActionServerPtr |
typedef ActionServer::GoalHandle | GoalHandle |
typedef realtime_tools::RealtimeServerGoalHandle< control_msgs::FollowJointTrajectoryAction > | RealtimeGoalHandle |
typedef boost::shared_ptr< RealtimeGoalHandle > | RealtimeGoalHandlePtr |
typedef trajectory_msgs::JointTrajectory::ConstPtr | JointTrajectoryConstPtr |
typedef realtime_tools::RealtimePublisher< control_msgs::JointTrajectoryControllerState > | StatePublisher |
typedef std::unique_ptr< StatePublisher > | StatePublisherPtr |
typedef JointTrajectorySegment< SegmentImpl > | Segment |
typedef std::vector< Segment > | TrajectoryPerJoint |
typedef std::vector< TrajectoryPerJoint > | Trajectory |
typedef std::shared_ptr< Trajectory > | TrajectoryPtr |
typedef std::shared_ptr< TrajectoryPerJoint > | TrajectoryPerJointPtr |
typedef realtime_tools::RealtimeBox< TrajectoryPtr > | TrajectoryBox |
typedef Segment::Scalar | Scalar |
typedef HardwareInterfaceAdapter< HardwareInterface, typename Segment::State > | HwIfaceAdapter |
typedef HardwareInterface::ResourceHandleType | JointHandle |
bool | verbose_ |
Hard coded verbose flag to help in debugging. More... | |
std::string | name_ |
Controller name. More... | |
std::vector< JointHandle > | joints_ |
Handles to controlled joints. More... | |
std::vector< bool > | angle_wraparound_ |
Whether controlled joints wrap around or not. More... | |
std::vector< std::string > | joint_names_ |
Controlled joint names. More... | |
SegmentTolerances< Scalar > | default_tolerances_ |
Default trajectory segment tolerances. More... | |
HwIfaceAdapter | hw_iface_adapter_ |
Adapts desired trajectory state to HW interface. More... | |
RealtimeGoalHandlePtr | rt_active_goal_ |
Currently active action goal, if any. More... | |
TrajectoryBox | curr_trajectory_box_ |
TrajectoryPtr | hold_trajectory_ptr_ |
Last hold trajectory values. More... | |
Segment::State | current_state_ |
Preallocated workspace variable. More... | |
Segment::State | desired_state_ |
Preallocated workspace variable. More... | |
Segment::State | old_desired_state_ |
Preallocated workspace variable. More... | |
Segment::State | state_error_ |
Preallocated workspace variable. More... | |
Segment::State | desired_joint_state_ |
Preallocated workspace variable. More... | |
Segment::State | state_joint_error_ |
Preallocated workspace variable. More... | |
std::unique_ptr< TrajectoryBuilder< SegmentImpl > > | hold_traj_builder_ |
realtime_tools::RealtimeBuffer< TimeData > | time_data_ |
TimeData | old_time_data_ |
ros::Duration | state_publisher_period_ |
ros::Duration | action_monitor_period_ |
Segment::Time | stop_trajectory_duration_ |
Duration for stop ramp. If zero, the controller stops at the actual position. More... | |
boost::dynamic_bitset | successful_joint_traj_ |
bool | allow_partial_joints_goal_ |
ros::NodeHandle | controller_nh_ |
ros::Subscriber | trajectory_command_sub_ |
ActionServerPtr | action_server_ |
ros::ServiceServer | query_state_service_ |
StatePublisherPtr | state_publisher_ |
ros::Timer | goal_handle_timer_ |
ros::Time | last_state_publish_time_ |
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) |
virtual bool | updateTrajectoryCommand (const JointTrajectoryConstPtr &msg, RealtimeGoalHandlePtr gh, std::string *error_string=nullptr) |
virtual void | trajectoryCommandCB (const JointTrajectoryConstPtr &msg) |
virtual void | goalCB (GoalHandle gh) |
virtual void | cancelCB (GoalHandle gh) |
virtual void | preemptActiveGoal () |
virtual bool | queryStateService (control_msgs::QueryTrajectoryState::Request &req, control_msgs::QueryTrajectoryState::Response &resp) |
void | publishState (const ros::Time &time) |
Publish current controller state at a throttled frequency. More... | |
void | setHoldPosition (const ros::Time &time, RealtimeGoalHandlePtr gh=RealtimeGoalHandlePtr()) |
Hold the current position. More... | |
unsigned int | getNumberOfJoints () const |
Returns the number of joints of the robot. More... | |
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... | |
static TrajectoryPtr | createHoldTrajectory (const unsigned int &number_of_joints) |
Returns a trajectory consisting of joint trajectories with one pre-allocated segment. 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... | |
void | setActionFeedback () |
Updates the pre-allocated feedback of the current active goal (if any) based on the current state values. More... | |
Additional Inherited Members | |
Public Types inherited from controller_interface::ControllerBase | |
typedef std::vector< hardware_interface::InterfaceResources > | ClaimedResources |
enum | ControllerState { ControllerState::CONSTRUCTED, ControllerState::INITIALIZED, ControllerState::RUNNING, ControllerState::STOPPED, ControllerState::WAITING, ControllerState::ABORTED } |
Public Attributes inherited from controller_interface::ControllerBase | |
ControllerState | state_ |
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 |
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 640 of file joint_trajectory_controller_impl.h.
|
staticprotected |
Returns a trajectory consisting of joint trajectories with one pre-allocated segment.
Definition at line 823 of file joint_trajectory_controller_impl.h.
|
inlineprotected |
Returns the number of joints of the robot.
Definition at line 759 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 567 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 712 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 664 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 798 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 740 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 752 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 766 of file joint_trajectory_controller_impl.h.
|
protectedvirtual |
Definition at line 481 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.