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

MoveIt moveit::core::RobotModel::RobotModel

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

JonasG gravatar image

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

ahendrix gravatar image

Hey there,

I can not create a RobotModelConstPtr. I need this to create a RobotState ( ).

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 ( ).

It would be perfect if someone can help me out.


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);


  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);


// choose JointGroup

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

// Forward Kinematics


  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());


  return 0;
edit retag flag offensive close merge delete


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

jayess gravatar image jayess  ( 2018-05-23 14:04:08 -0600 )edit

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

JonasG gravatar image JonasG  ( 2018-05-23 14:29:02 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

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

ahendrix gravatar image

It looks like RobotModelConstPrt is declared in 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


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


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

JonasG gravatar image JonasG  ( 2018-06-06 03:45:27 -0600 )edit

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

ahendrix gravatar image ahendrix  ( 2018-06-06 12:54:17 -0600 )edit

@ahendrix Sir can you suggest me any tutorial where i can learn how to interpreter c++ documantation

saztyga gravatar image saztyga  ( 2020-08-31 17:22:23 -0600 )edit

Question Tools



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

Seen: 938 times

Last updated: May 23 '18