MoveIt moveit::core::RobotModel::RobotModel
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;
}
Can you please update your question with a copy and paste of your code? That way the question is self-contained.
I have updated my question. I hope the formatation is good enough.