Ask Your Question
0

MoveIt moveit::core::RobotModel::RobotModel

asked 2018-05-23 13:18:12 -0500

JonasG gravatar image

updated 2018-05-23 14:32:07 -0500

ahendrix gravatar image

Hey there,

I can not create a RobotModelConstPtr. I need this to create a RobotState ( http://docs.ros.org/jade/api/moveit_c... ).

A part of my Code:
// Construct a kinematic model const RobotModelConstPtr kinematic_model; //need it later for RobotState robot_model::RobotModel kinematic_model = (RDFLoader.getURDF(), RDFLoader.getSRDF());

The error is " 'RobotModelConstPtr' does not name a type".

This is a link to my hole code ( https://www.dropbox.com/s/rko84pkkiig... ).

It would be perfect if someone can help me out.

Thanks

The whole code:

 #include <ros/ros.h>
 #include <fstream>
 #include <sstream>
 #include <urdf/model.h>

// MoveIt!
 #include <moveit/robot_model/robot_model.h>
 #include <moveit/robot_state/robot_state.h>
 #include <moveit/rdf_loader/rdf_loader.h>

int main(int argc, char **argv)
{
  ros::init(argc, argv, "inv_node");

  ros::AsyncSpinner spinner(1);

  spinner.start();

  ros::NodeHandle nh;


// Convert urdf file in a string

  std::ifstream u("youbot_arm.urdf");

  std::stringstream su;

  su << u.rdbuf();


// upload the urdf to the parameter server

  nh.setParam("robot_description", su.str());


// Convert srdf file in a string

  std::ifstream s("youbot.srdf");

  std::stringstream ss;

  ss << s.rdbuf();


// upload the srdf to the parameter server

  nh.setParam("robot_description_semantic", ss.str());


// Initialize the robot model

  rdf_loader::RDFLoader RDFLoader(su.str(), ss.str()); 


// Construct a kinematic model

  const RobotModelConstPtr kinematic_model; //need it later for RobotState

  robot_model::RobotModel kinematic_model = (RDFLoader.getURDF(), RDFLoader.getSRDF());

  ROS_INFO("Model frame: %s", kinematic_model->getModelFrame().c_str());


// RobotStat that maintains the configuration

  robot_state::RobotStatePtr kinematic_state(new robot_state::RobotState(RobotModel);

  kinemati_state->setToDefaultValues();


// choose JointGroup

  const robot_state::JointModelGroup* joint_model_group = RobotModel.getJointModelGroup("arm_1");


// Forward Kinematics

  kinematic_state->setToRandomPositions(joint_model_group);

  const Eigen::Affine3d &end_effector_state = kinematic_state->getGlobalLinkTransform("arm_link_0");


/* Print end-effector pose. Remember that this is in the model frame */

  ROS_INFO_STREAM("Translation: " << end_effector_state.translation());

  ROS_INFO_STREAM("Rotation: " << end_effector_state.rotation());

  ros::shutdown();

  return 0;
}
edit retag flag offensive close merge delete

Comments

Can you please update your question with a copy and paste of your code? That way the question is self-contained.

jayess gravatar imagejayess ( 2018-05-23 14:04:08 -0500 )edit

I have updated my question. I hope the formatation is good enough.

JonasG gravatar imageJonasG ( 2018-05-23 14:29:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-05-23 22:12:19 -0500

ahendrix gravatar image

It looks like RobotModelConstPrt is declared in http://docs.ros.org/jade/api/moveit_c... by MOVEIT_CLASS_FORWARD(RobotModel); .

This is in the moveit::core namespace, so the fully qualified type name would be moveit::core::RobotModelConstPtr

Instead of:

const RobotModelConstPtr kinematic_model; //need it later for RobotState

Try:

const moveit::core::RobotModelConstPtr kinematic_model; //need it later for RobotState
edit flag offensive delete link more

Comments

@ahendrix Do you have experience by using KDL PLugins for computing inverse kinematics?

JonasG gravatar imageJonasG ( 2018-06-06 03:45:27 -0500 )edit

Nope. I don't know anything about MoveIt, I'm just good at reading and interpreting software documentation.

ahendrix gravatar imageahendrix ( 2018-06-06 12:54:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-05-23 13:18:12 -0500

Seen: 192 times

Last updated: May 23 '18