Skip to content

added time_from_start to action feedback #1756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions joint_trajectory_controller/src/trajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ bool Trajectory::sample(
}
}

output_state.time_from_start = next_point.time_from_start;
// whole animation has played out
start_segment_itr = --end();
end_segment_itr = end();
Expand Down
24 changes: 24 additions & 0 deletions joint_trajectory_controller/test/test_trajectory_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,31 @@ TEST_P(TrajectoryControllerTestParameterized, state_topic_consistency_command_jo
EXPECT_EQ(n_joints, state->output.effort.size());
}
}
/**
* @brief check if time_from_start is populated correctly
*/
TEST_F(TrajectoryControllerTest, time_from_start_populated)
{
rclcpp::executors::SingleThreadedExecutor executor;
SetUpAndActivateTrajectoryController(executor, {});
subscribeToState(executor);

// schedule a single waypoint at 100ms:
builtin_interfaces::msg::Duration tfs;
tfs.sec = 0;
tfs.nanosec = 100000000;
publish(tfs, {INITIAL_POS_JOINTS}, rclcpp::Time(0));
traj_controller_->wait_for_trajectory(executor);

updateController();
// give the publish timer one more spin
executor.spin_some();

auto state = getState();
ASSERT_TRUE(state);
EXPECT_EQ(state->feedback.time_from_start.sec, 0u);
EXPECT_EQ(state->feedback.time_from_start.nanosec, 100000000u);
}
/**
* @brief check if dynamic parameters are updated
*/
Expand Down
Loading