ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi everyone, I had the same problem. The code doesn't work.
When the code arrive @ std::stringstream ss; line I read :
please input e to execute the plan, r to replan, others to skip: e Errore di segmentazione (core dump creato)
group.execute(my_plan);
std::stringstream ss;
count++;
moveit_msgs::RobotTrajectory msg;
msg =my_plan.trajectory_;
std::vector<trajectory_msgs::MultiDOFJointTrajectoryPoint> trajectory_points;
std::vector<int>::size_type size1 = msg.joint_trajectory.points.size();
for (unsigned i=0; i<size1; i++)
{
ss << "point_index: " << i << std::endl
<< "positions: "
<< "[" << msg.joint_trajectory.points[i].positions[0]
<< "," << msg.joint_trajectory.points[i].positions[1]
<< "," << msg.joint_trajectory.points[i].positions[2]
<< "," << msg.joint_trajectory.points[i].positions[3]
<< "," << msg.joint_trajectory.points[i].positions[4]
<< "," << msg.joint_trajectory.points[i].positions[5]
<< "," << msg.joint_trajectory.points[i].positions[6]
<< "]" << std::endl;
}
std::ofstream outfile ("/home/points.txt",std::ios::app); outfile<<"trajectory"<<count<<std::endl;
outfile<<msg.multi_dof_joint_trajectory.joint_names[0]<<std::endl; outfile<<ss.str()<<std::endl;
outfile.close();
}