nasa-jpl / osr-rover-code

Code that runs on the Open Source Rover
Apache License 2.0
435 stars 148 forks source link

Created osr gazebo simluation #192

Closed dongjineee closed 6 months ago

dongjineee commented 6 months ago

Hello,

I closed the previous PR due to issues with my branch and created a new one. I would like to work on the simulation with others.

Achllle commented 6 months ago

Hi @dongjineee, just getting around to trying this out now!

I saw you added dependencies in the package.xml files so I gave things a try with rosdep. I had tried at first with ros:iron but got

#9 1.449 osr_gazebo: Cannot locate rosdep definition for [joint_state_controller]

Since joint_state_controller doesn't seem to be in rosdistro yet and you mention foxy in the readme, I tried ros:foxy but got

#9 5.695 ERROR: the following rosdeps failed to install
#9 5.695   apt: command [apt-get install ros-foxy-diff-drive-controller] failed

I noticed diff-drive-controller isn't listed in the readme as a dependency (not sure if it's part of some other metapackage though)

I then manually installed dependencies as directed in the readme and got

#9 10.76 --- stderr: osr_gazebo
#9 10.76 CMake Error at ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:100 (message):
#9 10.76   ament_cmake_symlink_install_directory() can't find
#9 10.76   '/osr_ws/src/osr_gazebo/rviz'
#9 10.76 Call Stack (most recent call first):
#9 10.76   ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:314 (ament_cmake_symlink_install_directory)
#9 10.76   cmake_install.cmake:41 (include)

when compiling. I will take a look at this again soon and try to figure out what's going on but in the meantime perhaps if you could remedy these as it would be good to have something that just works out of the box, especially since we already use rosdep in the other code chunks. I'm also wondering if we can use a more recent version of ROS 2 or perhaps be more version-agnostic? ROS 2 Foxy reached EOL last year.

dongjineee commented 6 months ago

Hi, @Achllle Updated package.xml(delete diff_drive) and Readme(rewrite about method build) file!!

I used ros::foxy beacause I am currently using Ubuntu 20.04. and I didn't use rosdep but instead used 'colcon build' to build the osr_gazebo package!

I haven't tried it yet, but I anticipate thatjoint_trajectory_controller/JointTrajectoryController and velocity_controllers/JointGroupVelocityController exist in ros::iron and can be used with the latest version.

For these reasons, I expect it to be version-agnostic.

Currently, I'm not using diff-drive-controller in the controller, but I'll need to check the package.xml again!

dongjineee commented 6 months ago

@Achllle

I've made some modifications to make it usable with ROS2 Foxy, Iron, and Humble. Could you check them out?

Achllle commented 6 months ago

I gave this another try but it still doesn't work on versions of ROS 2 after foxy for the same reason I mentioned before:

Since joint_state_controller doesn't seem to be in rosdistro

You still depend on this package which doesn't exist any more. It seems like it was renamed since humble.

You can check availability of packages in rosdep with the rosdistro repo.

Achllle commented 6 months ago

I replaced joint_state_controller with joint_state_broadcaster and am able to launch gazebo with the rover now. Since ROS 2 Foxy is end of life, I would make this change and only support the current versions Iron and Humble

dongjineee commented 6 months ago

I am not using joint_state_controller in ROS2.

Instead, I am using joint_trajectory_controller

However, the launch part is different for versions after Foxy.

Please check this part in the following link: https://github.com/dongjineee/osr-rover-code/blob/gazebo/ROS/osr_gazebo/README.md

If you need any more help , feel free to ask!

And, I will update the README for Iron and Humble accordingly.

Achllle commented 6 months ago

You definitely were using it :wink:

As mentioned, Foxy is no longer supported so we shouldn't have instructions for it either. Given this is a volunteer-run project, we're not interested in maintaining old versions as maintenance is enough work as is.

dongjineee commented 6 months ago

I fully agree with you. 👍

I will update this accordingly.

Achllle commented 6 months ago

When you launch empty_world.launch, what real-time factor are you getting? I'm only getting 0.08 which means it's really laggy and slow.

EDIT: from your video on Slack I see you had a RTF of ~0.13 but your FPS was ~60. I'm only getting ~0.5 FPS for some reason. EDIT2: It's also causing RViz2 to crash which initially runs at 30Hz. The model looks very detailed, is there a step that's missing to downsample the meshes?

Achllle commented 6 months ago

It would also be good to have the instructions on how these models were created elaborated in the README. You wrote high-level instructions here

dongjineee commented 6 months ago

I suspect that the reason for getting 0.5fps is related to GPU issues.

With my current GPU, the GTX 1650, Gazebo runs at 30-40fps and when using an RTX 3060 Ti, it achieved around 60fps.

Since the OSR model is heavy, it probably requires GPU usage. Alternatively, making the modeling lighter would also be a good approach.

Thank you for your review. 👍👍👍

image

dongjineee commented 6 months ago

EDIT2: It's also causing RViz2 to crash which initially runs at 30Hz. The model looks very detailed, is there a step that's missing to downsample the meshes?

To keep it very simple, I used the filters in MeshLab to downsample. To reduce the size further, a new modeling would be necessary.