Loading a plan to MoveGroupInterface::Plan

asked 2019-01-22 01:27:16 -0600

pranavb104 gravatar image

Hey all!

I have a set of waypoints on a txt file, which I wanna use to compute a plan. (I'm doing this because Moveit does not reproduce the same path/trajectory when I plan it everytime).

My questions is, how do I load a set of points to Plan and compute a new plan ? For now I have the code below, But i gives a segmentation fault since I'm not able to define the array size to moveit_msgs::RobotTrajectory msg (there is no way to do it)

std::ifstream infile("wet_points.txt");
  ROS_INFO( "Loaded file");

  float a,b,c;

  moveit_msgs::RobotTrajectory msg;  
  msg = my_plan.trajectory_;


  while (infile >> a >> b >> c)
{
    msg.joint_trajectory.points[count].positions[0] = a;
    msg.joint_trajectory.points[count].positions[1] = b;
    msg.joint_trajectory.points[count].positions[2] = c;


}
  my_plan.trajectory_ = msg;
  move_group.plan(my_plan);
  ROS_INFO( "New plan planned");
edit retag flag offensive close merge delete

Comments

Have you seen the tutorial? The link points directly to where waypoints are explained.

aPonza gravatar imageaPonza ( 2019-01-22 02:40:32 -0600 )edit

Im looking at it now! This seems like an option... I have also looked at descartes ( http://wiki.ros.org/descartes ) . Is this something more promising because as next steps I would have to make reliable repetitive motions with my robot. Let me know

pranavb104 gravatar imagepranavb104 ( 2019-01-22 03:15:39 -0600 )edit

I've seen Descartes mentioned here as well (a question you now reminded me also talks about something similar to what you need), but know nothing more, so I can't help on the choice. I'm having myself a challenging time with MoveIt.

aPonza gravatar imageaPonza ( 2019-01-22 03:42:18 -0600 )edit