Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSOC-46] Fuel model usage and migration to ROS 2 launch files #2

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions dave_demos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.8)
project(dave_demos)

find_package(ament_cmake REQUIRED)

install(
DIRECTORY launch
DESTINATION share/dave_demos
)

ament_package()
35 changes: 35 additions & 0 deletions dave_demos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Examples

### 1. Launching a Dave Model using Fuel URI

To launch a Dave model directly from a Fuel URI, follow these steps:

1. Build and source the workspace:
```bash
colcon build && source install/setup.bash
```
2. Launch the model using the specified launch file:
```bash
ros2 launch dave_demos mossy_cinder_block.launch.yaml
```

This method simplifies the process by pulling the model directly from Fuel, ensuring you always have the latest version without needing to manage local files.

### 2. Launching a Dave Model using Downloaded Model Files

If you prefer to use model files downloaded from Fuel, proceed as follows:

1. Set the resource path to your local model files:
```bash
export GZ_SIM_RESOURCE_PATH=<Path-to-dave_ws>/src/dave/dave_model_description

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gazebosim/ros_gz#492 Could you try this to get rid of this step?

Copy link

@woensug-choi woensug-choi Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've no experience with hooks but it seems it's another alternative
Reference: https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_sim_demos

Also... hard to ask, but with best wishes, it seems ros_gz's demo is now all in python. What do you think of working with python from this and now on? With power of chatgpt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other parts worked fine! Thank you so much for investigating the previous dave structure and attempt to follow how it was done 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, I'll make those changes!

```
2. Build and source the workspace:
```bash
colcon build && source install/setup.bash
```
3. Launch the model using the provided launch file:
```bash
ros2 launch dave_demos nortek_dvl500_300_bare_model.launch.yaml
```

This approach gives you more control over the models you use, allowing for offline use and customization. It's especially useful when working in environments with limited internet connectivity or when specific model versions are required.
26 changes: 26 additions & 0 deletions dave_demos/launch/mossy_cinder_block.launch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
launch:
- arg:
name: gazebo_world_file
default: empty.sdf

- arg:
name: use_sim
default: "true"

- arg:
name: model_name
default: mossy_cinder_block

- include:
file: $(find-pkg-share ros_gz_sim)/launch/gz_sim.launch.py
arg:
- name: gz_args
value: -v 4 -r $(var gazebo_world_file)

- include:
file: $(find-pkg-share dave_model_description)/launch/$(var model_name)/upload_$(var model_name).launch.yaml
arg:
- name: namespace
value: $(var model_name)
- name: use_sim
value: $(var use_sim)
26 changes: 26 additions & 0 deletions dave_demos/launch/nortek_dvl500_300_bare_model.launch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
launch:
- arg:
name: gazebo_world_file
default: empty.sdf

- arg:
name: use_sim
default: "true"

- arg:
name: model_name
default: nortek_dvl500_300_bare_model

- include:
file: $(find-pkg-share ros_gz_sim)/launch/gz_sim.launch.py
arg:
- name: gz_args
value: -v 4 -r $(var gazebo_world_file)

- include:
file: $(find-pkg-share dave_model_description)/launch/$(var model_name)/upload_$(var model_name).launch.yaml
arg:
- name: namespace
value: $(var model_name)
- name: use_sim
value: $(var use_sim)
18 changes: 18 additions & 0 deletions dave_demos/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">

<name>dave_demos</name>
<version>0.1.0</version>
<description> A package for demo launch files.</description>

<maintainer email="[email protected]">Rakesh Vivekanandan</maintainer>

<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
11 changes: 11 additions & 0 deletions dave_model_description/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.8)
project(dave_model_description)

find_package(ament_cmake REQUIRED)

install(
DIRECTORY description launch meshes
DESTINATION share/dave_model_description
)

ament_package()
10 changes: 10 additions & 0 deletions dave_model_description/description/mossy_cinder_block/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<sdf version="1.5">
<include>
<name>mossy_cinder_block</name>
<pose>0 0 0 0 0 0</pose>
<uri>
https://fuel.gazebosim.org/1.0/hmoyen/models/mossy_cinder_block
</uri>
</include>
</sdf>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0"?>
<sdf version="1.6">
<model name="dvl500_300">
<link name="dvl500_base_link">
<pose>0 0 0 0 0 0</pose>
<inertial>
<pose>0 0 0 0 0 0</pose>
<mass>3.5</mass>
<inertia>
<ixx>0.0195872</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.0195872</iyy>
<iyz>0</iyz>
<izz>0.0151357</izz>
</inertia>
</inertial>
<velocity_decay/>
<gravity>1</gravity>
<velocity_decay/>
<!-- Removed sensor -->
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
<visual name="dvl500_base_link_visual">
<pose>0 0 0 0 0 3.14159</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<!-- Mesh is actually for a Nortek DVL1000-4000m for now -->
<uri>model://meshes/nortek_dvl500_300_bare_model/DVL500-300m.dae</uri>
</mesh>
</geometry>
<transparency>0</transparency>
<cast_shadows>1</cast_shadows>
</visual>
<collision name="dvl500_base_link_collision">
<laser_retro>0</laser_retro>
<max_contacts>10</max_contacts>
<pose>0 0 0 3.14159 0 0</pose>
<geometry>
<cylinder>
<radius>0.093</radius>
<length>0.203</length>
</cylinder>
</geometry>
<surface>
<friction>
<ode>
<mu>1</mu>
<mu2>1</mu2>
<fdir1>0 0 0</fdir1>
<slip1>0</slip1>
<slip2>0</slip2>
</ode>
<torsional>
<coefficient>1</coefficient>
<patch_radius>0</patch_radius>
<surface_radius>0</surface_radius>
<use_patch_radius>1</use_patch_radius>
<ode>
<slip>0</slip>
</ode>
</torsional>
</friction>
<bounce>
<restitution_coefficient>0</restitution_coefficient>
<threshold>1e+06</threshold>
</bounce>
<contact>
<collide_without_contact>0</collide_without_contact>
<collide_without_contact_bitmask>1</collide_without_contact_bitmask>
<collide_bitmask>1</collide_bitmask>
<ode>
<soft_cfm>0</soft_cfm>
<soft_erp>0.2</soft_erp>
<kp>1e+13</kp>
<kd>1</kd>
<max_vel>0.01</max_vel>
<min_depth>0</min_depth>
</ode>
<bullet>
<split_impulse>1</split_impulse>
<split_impulse_penetration_threshold>-0.01</split_impulse_penetration_threshold>
<soft_cfm>0</soft_cfm>
<soft_erp>0.2</soft_erp>
<kp>1e+13</kp>
<kd>1</kd>
</bullet>
</contact>
</surface>
</collision>
</link>
<static>0</static>
<allow_auto_disable>1</allow_auto_disable>
</model>
</sdf>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
launch:

- arg:
name: use_sim
default: "true"

- arg:
name: model_name
default: mossy_cinder_block

- let:
name: description_file
value: $(find-pkg-share dave_model_description)/description/$(var model_name)/model.sdf

- node:
pkg: ros_gz_sim
exec: create
args: -name $(var model_name) -file $(var description_file)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
launch:

- arg:
name: use_sim
default: "true"

- arg:
name: model_name
default: nortek_dvl500_300_bare_model

- let:
name: description_file
value: $(find-pkg-share dave_model_description)/description/$(var model_name)/model.sdf

- node:
pkg: ros_gz_sim
exec: create
args: -name $(var model_name) -x 0 -y 0 -z 0 -file $(var description_file)

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions dave_model_description/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">

<name>dave_model_description</name>
<version>0.1.0</version>
<description> Dave model description files are placed here. </description>

<maintainer email="[email protected]">Rakesh Vivekanandan</maintainer>

<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>