moveit_msgs::CollisionObjects has no member named meshs/ meshes_pose etc
Hello,
I'm trying to add a mesh into rviz as a collision object on ros_kinetic. Below is the code i'm using:
// ROS
#include <ros/ros.h>
// MoveIt!
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit_msgs/CollisionObject.h>
#include "geometric_shapes/shapes.h"
#include "geometric_shapes/mesh_operations.h"
#include "geometric_shapes/shape_operations.h"
// TF2
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
void addCollisionObjects(moveit::planning_interface::PlanningSceneInterface& planning_scene_interface)
{
// Creating Environment
std::vector<moveit_msgs::CollisionObject> collision_object;
collision_object.resize(1);
Eigen::Vector3d b(0.001, 0.001, 0.001);
collision_object[0].id = "shelf";
shapes::Mesh* m = shapes::createMeshFromResource("package://robot_description/meshes/RVIZ/shelf_dae.dae",b);
shape_msgs::Mesh mesh;
shapes::ShapeMsg mesh_msg;
shapes::constructMsgFromShape(m, mesh_msg);
mesh = boost::get<shape_msgs::Mesh>(mesh_msg);
collision_object.meshes.resize(1);
collision_object.mesh_poses.resize(1);
collision_object.meshes[0] = mesh;
collision_object.header.frame_id = "panda_link0";
collision_object.mesh_poses[0].position.x = 0.283853;
collision_object.mesh_poses[0].position.y = 0.730556;
collision_object.mesh_poses[0].position.z = -0.003741;
collision_object.mesh_poses[0].orientation.x = 0.999850;
collision_object.mesh_poses[0].orientation.y= 0.006747;
collision_object.mesh_poses[0].orientation.z= 0.000108;
collision_object.mesh_poses[0].orientation.w= 0.015920;
collision_object.meshes.push_back(mesh);
collision_object.mesh_poses.push_back(collision_object.mesh_poses[0]);
collision_object.operation = collision_object[0].ADD;
std::vector<moveit_msgs::CollisionObject> collision_vector;
collision_vector.push_back(collision_object);
planning_scene_interface.applyCollisionObjects(collision_vector);
planning_scene_interface.(collision_object[0].id);
}
int main(int argc, char** argv)
{
ros::init(argc, argv, "moveit_interface");
ros::NodeHandle nh;
ros::AsyncSpinner spinner(1);
spinner.start();
ros::WallDuration(1.0).sleep();
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
moveit::planning_interface::MoveGroupInterface group("panda_arm");
group.setPlanningTime(45.0);
addCollisionObjects(planning_scene_interface);
// Wait a bit for ROS things to initialize
ros::WallDuration(1.0).sleep();
//pick(group);
}
When i run catkin_make i get lot of errors which can be seen below
[ 50%] Built target fetch_model_poses
[ 75%] Building CXX object robot_moveit_config/CMakeFiles/moveit_interface.dir/src/moveit_interface.cpp.o
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp: In function ‘void addCollisionObjects(moveit::planning_interface::PlanningSceneInterface&)’:
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:35:18: error: ‘class std::vector<moveit_msgs::CollisionObject_<std::allocator<void> > >’ has no member named ‘meshes’
collision_object.meshes.resize(1);
^
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:36:18: error: ‘class std::vector<moveit_msgs::CollisionObject_<std::allocator<void> > >’ has no member named ‘mesh_poses’
collision_object.mesh_poses.resize(1);
^
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:37:18: error: ‘class std::vector<moveit_msgs::CollisionObject_<std::allocator<void> > >’ has no member named ‘meshes’
collision_object.meshes[0] = mesh;
^
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:38:18: error: ‘class std::vector<moveit_msgs::CollisionObject_<std::allocator<void> > >’ has no member named ‘header’
collision_object.header.frame_id = "panda_link0";
^
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:39:18: error: ‘class std::vector<moveit_msgs::CollisionObject_<std::allocator<void> > >’ has no member named ‘mesh_poses’
collision_object.mesh_poses[0].position.x = 0.283853;
^
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:40:18: error: ‘class std::vector<moveit_msgs::CollisionObject_<std::allocator<void> > >’ has no member named ‘mesh_poses’
collision_object.mesh_poses[0].position.y = 0.730556;
^
/home/mvish7/ws_panda_gazebo_moveit/src/robot_moveit_config/src/moveit_interface.cpp:41:18: error: ‘class std::vector ...