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

<trajectory_msgs::JointTrajectory> Question

asked 2013-02-22 11:00:36 -0500

MartinW gravatar image

Hello all,

How do I declare positions in a trajectory_msgs::JointTrajectory variable? I am trying to input a IK service reply into a JointTrajectory positions:

trajectory_msgs::JointTrajectory l_traj_goal;

for(unsigned int i=0; i <; i ++)
l_traj_goal.points.positions[i] = l_gpik_res.solution.joint_state.position[i];          

but I get a compiling error:

error: ‘trajectory_msgs::JointTrajectory_<std::allocator<void> >::_points_type’ has no member named ‘positions’

Does anyone know what's going on here? I think this is a small coding error but my C++ skills are lacking

Kind Regards, Martin

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2013-02-22 13:39:32 -0500

fergs gravatar image

Points is an array, you need to select an element in the array:

l_traj_goal.points[0].positions[i] = ...
edit flag offensive delete link more


Hey Fergs, thanks for the reply. It compiles now but I get a segmentation fault when I run the program. Any suggestions how to fix that? (FIXED: I had to resize the elements in the array first)

MartinW gravatar image MartinW  ( 2013-02-25 07:44:53 -0500 )edit

Question Tools


Asked: 2013-02-22 11:00:36 -0500

Seen: 1,062 times

Last updated: Feb 22 '13