@@ -219,6 +219,8 @@ controller_interface::return_type JointTrajectoryController::update(
219219 TrajectoryPointConstIter start_segment_itr, end_segment_itr;
220220 const bool valid_point = traj_external_point_ptr_->sample (
221221 time, interpolation_method_, state_desired_, start_segment_itr, end_segment_itr);
222+ state_desired_.time_from_start = state_current_.time_from_start =
223+ time - traj_external_point_ptr_->time_from_start ();
222224
223225 if (valid_point)
224226 {
@@ -1190,15 +1192,9 @@ void JointTrajectoryController::publish_state(
11901192 state_publisher_->msg_ .reference .velocities = desired_state.velocities ;
11911193 state_publisher_->msg_ .reference .accelerations = desired_state.accelerations ;
11921194 state_publisher_->msg_ .reference .time_from_start = desired_state.time_from_start ;
1195+ state_publisher_->msg_ .feedback .time_from_start = current_state.time_from_start ;
11931196 state_publisher_->msg_ .feedback .positions = current_state.positions ;
1194- // DESIRED and ACTUAL are deprecated in the message but we are still
1195- // reporting on them
1196- state_publisher_legacy_->msg_ .desired .positions = desired_state.positions ;
1197- state_publisher_legacy_->msg_ .desired .velocities = desired_state.velocities ;
1198- state_publisher_legacy_->msg_ .desired .accelerations = desired_state.accelerations ;
1199- state_publisher_legacy_->msg_ .actual .positions = current_state.positions ;
12001197 state_publisher_->msg_ .error .positions = state_error.positions ;
1201- state_publisher_->msg_ .feedback .time_from_start = desired_state.time_from_start ;
12021198 if (has_velocity_state_interface_)
12031199 {
12041200 state_publisher_->msg_ .feedback .velocities = current_state.velocities ;
@@ -1209,6 +1205,24 @@ void JointTrajectoryController::publish_state(
12091205 state_publisher_->msg_ .feedback .accelerations = current_state.accelerations ;
12101206 state_publisher_->msg_ .error .accelerations = state_error.accelerations ;
12111207 }
1208+
1209+ // DESIRED and ACTUAL are deprecated in the message but we are still
1210+ // reporting on them
1211+ state_publisher_->msg_ .desired .time_from_start = desired_state.time_from_start ;
1212+ state_publisher_->msg_ .desired .positions = desired_state.positions ;
1213+ state_publisher_->msg_ .desired .velocities = desired_state.velocities ;
1214+ state_publisher_->msg_ .desired .accelerations = desired_state.accelerations ;
1215+ state_publisher_->msg_ .actual .time_from_start = current_state.time_from_start ;
1216+ state_publisher_->msg_ .actual .positions = current_state.positions ;
1217+ if (has_velocity_state_interface_)
1218+ {
1219+ state_publisher_->msg_ .actual .velocities = current_state.velocities ;
1220+ }
1221+ if (has_acceleration_state_interface_)
1222+ {
1223+ state_publisher_->msg_ .actual .accelerations = current_state.accelerations ;
1224+ }
1225+
12121226 if (read_commands_from_command_interfaces (command_current_))
12131227 {
12141228 state_publisher_->msg_ .output = command_current_;
0 commit comments