ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

why need a dummy trajectory in joint_trajectory_action_controller.cpp

asked 2013-06-03 08:37:39 -0500

AdrianPeng gravatar image

updated 2013-11-18 16:55:30 -0500

tfoote gravatar image

Hi,

in joint_trajectory_action_controller.cpp (robot_mechanism_controllers package)

// Creates a dummy trajectory
boost::shared_ptr<SpecifiedTrajectory> traj_ptr(new SpecifiedTrajectory(1));
SpecifiedTrajectory &traj = *traj_ptr;
traj[0].start_time = robot_->getTime().toSec();
traj[0].duration = 0.0;
traj[0].splines.resize(joints_.size());
for (size_t j = 0; j < joints_.size(); ++j)
  traj[0].splines[j].coef[0] = 0.0;
current_trajectory_box_.set(traj_ptr);

Why need to create a dummy trajectory?

Thanks for any help in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-06-03 21:23:32 -0500

Adolfo Rodriguez T gravatar image

This is a hold position trajectory: A single-waypoint at the current time set to maintain the current joint positions.

When the JointTrajectoryActionController starts, it defaults to holding the current position while it awaits for the first command to arrive.

Note: The code snippet you reference is from the init() method. Something similar also happens in starting(), so it seems that the snippet in init() is unnecessary and IMO could be removed.

Since you are asking many questions about this controller, are you planning on reimplementing it for a custom non-PR2 robot, or are you simply studying its internals?. FYI, a robot-agnostic implementation of this controller should land in the ros_control project sometime in the next 3 months.

edit flag offensive delete link more

Comments

Right now, I am just studying its internals. I might write other package to interface with it later.

AdrianPeng gravatar image AdrianPeng  ( 2013-06-04 07:53:55 -0500 )edit

Question Tools

Stats

Asked: 2013-06-03 08:37:39 -0500

Seen: 842 times

Last updated: Jun 03 '13