space-ros / simulation

Simulation assets of space-ros demos
9 stars 19 forks source link

How to update curiosity_mars_rover.xacro.urdf #5

Closed mkhansenbot closed 1 year ago

mkhansenbot commented 1 year ago

I'm trying to add odometry and a lidar to the mars rover model. I have updated the curiosity_mars_rover.gazebo file but when I run xacro on the curiosity_mars_rover.xacro file to re-generate the urdf file, I get an error. I'm not sure what the proper process is to regenerate that urdf. How do I do that?

mkhansenbot commented 1 year ago

@quarkytale - I'm hoping maybe you know the answer to this

quarkytale commented 1 year ago

Can you please share the error you were getting?

mkhansenbot commented 1 year ago

Sorry for the delay, I haven't had much time to work on this. However, I have answered this and in the process, I believe I've discovered a bug (or two?)

First, this is the command I can use to generate the curiosity_mars_rover.xacro.urdf file:

# from the space-ros workspace folder
colcon build --packages-up-to simulation
source install/setup.bash
xacro -o curiosity_mars_rover.xacro.urdf curiosity_mars_rover.xacro

That ran fine, except that the paths were wrong in the source file and need to include /models (I'll file an issue for this).

However this causes the urdf file to be generated with the full expanded path to the urdf files. For example: /home/space-ros-user/space-ros-ws/install/simulation/share/simulation/models/curiosity_path/meshes/chassis_full_fixed_glitch_v2.dae

We don't want hard-coded paths in any files. It looks like someone previously hand-edited the urdf file to use $(find simulation) instead. We shouldn't hand-edit that file.

In fact, looking deeper at this, we shouldn't use this urdf file at all, but we should simply use the curiosity_path.xacro file directly in the demos/launch/mars_rover.launch.py file. That will always use the install path directly at load time.

quarkytale commented 1 year ago

Thanks for looking into and fixing this!