Problem
Hi, I've exported a cad model from Soldiworks 2023 to URDF using the plugin from: http://wiki.ros.org/sw_urdf_exporter
I've put this STL that generates the geometry into my own package to load the stil file in RVIZ but. as shown in the code below, RVIZ can't retrieve the file but doesn't say why. Also please find below the error message.
What I've done already
I've included the stl file in my setup.py file. I've also tried to convert the STL to a dae file but that also couldn't be read.
If someone could help me out on this that would be great, thanks.
Edit
I've loaded the stl into Ignition Gazebo today using the same urdf file and its worked fine. Rviz continues not to load the the urdf :/
error message
user@user-ENVY:~/ws/forfly_ws$ ros2 launch forfly forfly_launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-05-15-19-20-45-191071-user-ENVY-22221
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [22222]
[INFO] [rviz2-2]: process started with pid [22224]
[rviz2-2] Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[robot_state_publisher-1] [INFO] [1715797245.277170403] [robot_state_publisher]: got segment air_layer
[robot_state_publisher-1] [INFO] [1715797245.277246959] [robot_state_publisher]: got segment testbed
[rviz2-2] [INFO] [1715797245.575394086] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-2] [INFO] [1715797245.575574429] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[rviz2-2] [INFO] [1715797245.590267725] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-2] [ERROR] [1715797245.693698129] [rviz2]: Error retrieving file [/home/user/ws/forfly_ws/install/forfly/share/forfly/base_link.stl]:
[rviz2-2] [ERROR] [1715797245.693800373] [rviz2]: Error retrieving file [/home/user/ws/forfly_ws/install/forfly/share/forfly/base_link.stl]:
[rviz2-2] [ERROR] [1715797245.693840460] [rviz2]: Error retrieving file [/home/user/ws/forfly_ws/install/forfly/share/forfly/base_link.stl]:
[rviz2-2] [ERROR] [1715797245.693887790] [rviz2]: Error retrieving file [/home/user/ws/forfly_ws/install/forfly/share/forfly/base_link.stl]:
launch.py file
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
import xacro
def generate_launch_description():
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
urdf_file_name = 'forfly_solidworks_v1.urdf'
urdf = os.path.join(
get_package_share_directory('forfly'),
urdf_file_name)
robot_desc = xacro.process_file(urdf).toxml()
rviz_file = os.path.join(get_package_share_directory('forfly'),'urdf.rviz')
return LaunchDescription([
DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true'),
Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{'use_sim_time': use_sim_time,
'robot_description': robot_desc}],
arguments=[urdf]),
Node(
package='rviz2',
namespace='',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d' + rviz_file],
),
])
Setup.py file
import os
from glob import glob
package_name = 'forfly'
setup(
name=package_name,
version='0.0.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*'))),
(os.path.join('share', package_name), glob('urdf/*')),
(os.path.join('share', package_name), glob('rviz/*urdf.rviz')),
(os.path.join('share', package_name), glob('meshes/*')),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='joe',
maintainer_email='[email protected]',
description='TODO: Package description',
license='Apache-2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
],
},
)
urdf file
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner ([email protected])
Commit Version: 1.6.0-4-g7f85cfe Build Version: 1.6.7995.38578
For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot
name="forfly_solidworks_v1">
<link name="air_layer">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.3 0.3 0.000005"/>
</geometry>
<material
name="">
<color
rgba="0 0 0 0" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.3 0.3 0.000005"/>
</geometry>
</collision>
</link>
<link
name="testbed">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="$(find forfly)/base_link.stl" />
</geometry>
<material
name="">
<color
rgba="0.75294 0.75294 0.75294 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="$(find forfly)/base_link.stl" />
</geometry>
</collision>
<inertial>
<origin
xyz="-0.00096272 0.0016866 0.27122"
rpy="0 0 0" />
<mass
value="9.6165" />
<inertia
ixx="0.073252"
ixy="-2.4392E-08"
ixz="2.8224E-08"
iyy="0.073114"
iyz="-1.951E-09"
izz="0.045766" />
</inertial>
</link>
<joint name="air_layer_to_robot_joint" type="fixed">
<parent link="air_layer" />
<child link="testbed" />
<origin xyz="0 0 0.0000025" rpy="0 0 0" />
</joint>
</robot>
```