Dear All,
I am having some trouble importing an stl file into my scene. I am able to import the stl file into the scene trough the Rviz gui in the 'scene objects' tab and the part becomes visible in the Rviz 3D view. However when I try to import the file through the source code I get an error ' malformed'.
Source:
//Add STL object to world
ROS_INFO("Load mesh file...");
Eigen::Vector3d vectorScale(0.001, 0.001, 0.001);
moveit_msgs::CollisionObject collision_object_hBeam;
collision_object_hBeam.id = "hBeam";
std::string packagePath = ros::package::getPath("moveit_tutorials");
ROS_INFO("PackagePath: %s", packagePath.c_str());
shapes::Mesh* meshObject = shapes::createMeshFromResource(
packagePath + "/markerTool.stl", vectorScale);
shape_msgs::Mesh mesh;
shapes::ShapeMsg meshMessage;
shapes::constructMsgFromShape(meshObject, meshMessage);
mesh = boost::get<shape_msgs::Mesh>(meshMessage);
objectsQuaternionTransformation.setRPY(0,0,0);
geometry_msgs::Pose hBeamPose;
hBeamPose.orientation.w = objectsQuaternionTransformation.w();
hBeamPose.orientation.x = objectsQuaternionTransformation.x();
hBeamPose.orientation.y = objectsQuaternionTransformation.y();
hBeamPose.orientation.z = objectsQuaternionTransformation.z();
hBeamPose.position.x = 1.0;
hBeamPose.position.y = 1.0;
hBeamPose.position.z = 1.0;
collision_object_hBeam.meshes.push_back(mesh);
collision_object_hBeam.mesh_poses.push_back(hBeamPose);
collision_objects.push_back(collision_object_hBeam);
//Add objects to world
ROS_INFO_NAMED("tutorial", "Add an object into the world");
planning_scene_interface.addCollisionObjects(collision_objects);
The path to the file is correct when I check it in the terminal, the error message path is the same as the path to the file:
[ INFO] [1588177076.809570135]: Load mesh file... [ INFO] [1588177076.809648012]: PackagePath: /home/dvdv/ws_robotplatform/src/moveit_tutorials [ERROR] [1588177076.809757275]: Error retrieving file [/home/dvdv/ws_robotplatform/src/moveit_tutorials/markerTool.stl]: <url> malformed [move_group_interface_tutorial-1] process has died [pid 20898, exit code -11, cmd /home/dvdv/ws_robotplatform/devel/lib/moveit_tutorials/move_group_interface_tutorial __name:=move_group_interface_tutorial __log:=/home/dvdv/.ros/log/f5fee402-89e5-11ea-8d3a-0800272243ce/move_group_interface_tutorial-1.log]. log file: /home/dvdv/.ros/log/f5fee402-89e5-11ea-8d3a-0800272243ce/move_group_interface_tutorial-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done
File is present:
dvdv@dvdv-ROS:~/ws_robotplatform$ cd src/moveit_tutorials/
<font color="#8AE234"><b>dvdv@dvdv-ROS</b></font>:<font color="#729FCF"><b>~/ws_robotplatform/src/moveit_tutorials</b></font>$ ls
build_locally.sh conf.py index.rst mark_tool_text.stl README.md _scripts _themes
CMakeLists.txt doc markerTool.stl package.xml rosdoc.yaml _static
dvdv@dvdv-ROS:~/ws_robotplatform/src/moveit_tutorials$
Something seems to go wrong with locating the file as far as I can interpreted this error message.
Does anybody have a suggestion in the right direction? Thanks in advance.
Originally posted by BrandDebiel on ROS Answers with karma: 47 on 2020-04-29
Post score: 0