Hey there,
I can not create a RobotModelConstPtr. I need this to create a RobotState (http://docs.ros.org/jade/api/moveit_core/html/classmoveit_1_1core_1_1RobotState.html#ac5944765b49ee074030c01010af36c07).
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/rko84pkkiigug9j/inv_node_end.cpp?dl=0).
It would be perfect if someone can help me out.
Thanks
The whole code:
#include
#include
#include
#include
// MoveIt!
#include
#include
#include
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;
}
↧