Skip to content

Commit dfbd63e

Browse files
authored
Merge pull request #8 from SchillingRobotics/ctg-use-time-from-start
Use time from start passed in from input reference if non-zero in CTG
2 parents eb1cd2b + e495783 commit dfbd63e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

joint_trajectory_controller/src/cartesian_trajectory_generator.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ void CartesianTrajectoryGenerator::reference_callback(
147147
params_.joints.size(), std::numeric_limits<double>::quiet_NaN());
148148
new_traj_msg->points[0].velocities.resize(
149149
params_.joints.size(), std::numeric_limits<double>::quiet_NaN());
150-
new_traj_msg->points[0].time_from_start = rclcpp::Duration::from_seconds(0.01);
150+
if (msg->time_from_start.nanosec == 0)
151+
{
152+
new_traj_msg->points[0].time_from_start = rclcpp::Duration::from_seconds(0.01);
153+
}
154+
else
155+
{
156+
new_traj_msg->points[0].time_from_start = rclcpp::Duration::from_nanoseconds(
157+
static_cast<rcl_duration_value_t>(msg->time_from_start.nanosec));
158+
}
151159

152160
// just pass input into trajectory message
153161
auto assign_value_from_input = [&](

0 commit comments

Comments
 (0)