@@ -71,30 +71,25 @@ enum CommandInterfaces
7171 point to the hardware interface.
7272 2.0: The hardware interface will read the point written from the controller. The state will switch between 1.0
7373 and 2.0 until all points have been read by the hardware interface.
74- 3.0: The hardware interface has read all the points, and will now write all the points to the robot driver.
75- 4.0: The robot is moving through the trajectory.
76- 5.0: The robot finished executing the trajectory. */
74+ 3.0: The hardware interface has read all the points, and will now write all the points to the physical robot
75+ controller. 4.0: The robot is moving through the trajectory. 5.0: The robot finished executing the trajectory. */
7776 PASSTHROUGH_TRAJECTORY_TRANSFER_STATE = 0 ,
78- /* The PASSTHROUGH_TRAJECTORY_CANCEL value is used to indicate whether the trajectory has been cancelled from the
77+ /* The PASSTHROUGH_TRAJECTORY_ABORT value is used to indicate whether the trajectory has been cancelled from the
7978 * hardware interface.*/
80- PASSTHROUGH_TRAJECTORY_CANCEL = 1 ,
81- /* The PASSTHROUGH_TRAJECTORY_DIMENSIONS is used to indicate what combination of joint positions, velocities and
82- * accelerations the trajectory consists of, see check_dimensions() for a description of what the values mean. */
83- PASSTHROUGH_TRAJECTORY_DIMENSIONS = 2 ,
79+ PASSTHROUGH_TRAJECTORY_ABORT = 1 ,
8480 /* Arrays to hold the values of a point. */
85- PASSTHROUGH_TRAJECTORY_POSITIONS_ = 3 ,
86- PASSTHROUGH_TRAJECTORY_VELOCITIES_ = 9 ,
87- PASSTHROUGH_TRAJECTORY_ACCELERATIONS_ = 15 ,
88- PASSTHROUGH_TRAJECTORY_TIME_FROM_START = 21
81+ PASSTHROUGH_TRAJECTORY_POSITIONS_ = 2 ,
82+ PASSTHROUGH_TRAJECTORY_VELOCITIES_ = 8 ,
83+ PASSTHROUGH_TRAJECTORY_ACCELERATIONS_ = 14 ,
84+ PASSTHROUGH_TRAJECTORY_TIME_FROM_START = 20
8985};
9086
9187enum StateInterfaces
9288{
9389 /* State interface 0 - 17 are joint state interfaces*/
9490
9591 SPEED_SCALING_FACTOR = 18 ,
96- NUMBER_OF_JOINTS = 19 ,
97- CONTROLLER_RUNNING = 20
92+ CONTROLLER_RUNNING = 19
9893};
9994
10095class PassthroughTrajectoryController : public controller_interface ::ControllerInterface
@@ -138,26 +133,15 @@ class PassthroughTrajectoryController : public controller_interface::ControllerI
138133 void goal_accepted_callback (
139134 const std::shared_ptr<rclcpp_action::ServerGoalHandle<control_msgs::action::FollowJointTrajectory>> goal_handle);
140135
141- void execute (
142- const std::shared_ptr<rclcpp_action::ServerGoalHandle<control_msgs::action::FollowJointTrajectory>> goal_handle);
143-
144136 std::vector<std::string> joint_names_;
145137 std::vector<std::string> state_interface_types_;
146138
147139 std::vector<std::reference_wrapper<hardware_interface::LoanedStateInterface>> joint_position_state_interface_;
148140 std::vector<std::reference_wrapper<hardware_interface::LoanedStateInterface>> joint_velocity_state_interface_;
149141
150- /*
151- If there are values in the velocities and accelerations vectors, they should have as many elements as there are
152- joints, and all be the same size.
153- The return value indicates what combination of joint positions, velocities and accelerations is present;
154- 0: The trajectory is invalid, and will be rejected.
155- 1: Only positions are defined for the trajectory.
156- 2: Positions and velocities are defined for the trajectory.
157- 3: Positions and accelerations are defined for the trajectory.
158- 4: Both positions, velocities and accelerations are defined for the trajectory.
159- */
160- int check_dimensions (std::shared_ptr<const control_msgs::action::FollowJointTrajectory::Goal> goal);
142+ bool check_positions (std::shared_ptr<const control_msgs::action::FollowJointTrajectory::Goal> goal);
143+ bool check_velocities (std::shared_ptr<const control_msgs::action::FollowJointTrajectory::Goal> goal);
144+ bool check_accelerations (std::shared_ptr<const control_msgs::action::FollowJointTrajectory::Goal> goal);
161145
162146 trajectory_msgs::msg::JointTrajectory active_joint_traj_;
163147 std::vector<control_msgs::msg::JointTolerance> path_tolerance_;
@@ -174,6 +158,7 @@ class PassthroughTrajectoryController : public controller_interface::ControllerI
174158 double scaling_factor_;
175159 uint32_t number_of_joints_;
176160 std::shared_ptr<rclcpp_action::ServerGoalHandle<control_msgs::action::FollowJointTrajectory>> active_goal_;
161+ static constexpr double NO_VAL = std::numeric_limits<double >::quiet_NaN();
177162};
178163} // namespace ur_controllers
179164#endif // UR_CONTROLLERS__PASSTHROUGH_TRAJECTORY_CONTROLLER_HPP_
0 commit comments