Skip to content

Commit

Permalink
Add ROS1 generic launcher too
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Dec 23, 2024
1 parent 4536dca commit 3be233d
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 120 deletions.
89 changes: 51 additions & 38 deletions docs/mvsim_node.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,55 @@ Basic usage from the command line
.. code-block:: bash
roslaunch mvsim launch_world.launch \
XX
world_file:=/path/to/your/my.world.xml \
headless:=True
.. tab-item:: ROS 2
:selected:

.. code-block:: bash
ros2 launch mvsim launch_world.launch.py \
world_file:=/path/to/your/my.world.xml
world_file:=/path/to/your/my.world.xml \
headless:=True
|
All launch parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All these parameters apply to both, ROS 1 and ROS 2 launch files above:

.. tab-set::
.. tab-item:: ROS 1

.. code-block:: bash
xxx
.. tab-item:: ROS 2
:selected:

.. code-block:: bash
.. code-block:: bash
$ ros2 launch mvsim launch_world.launch.py --show-args
Arguments (pass arguments as '<name>:=<value>'):
$ ros2 launch mvsim launch_world.launch.py --show-args
Arguments (pass arguments as '<name>:=<value>'):
'world_file':
Path to the *.world.xml file to load
'world_file':
Path to the *.world.xml file to load
'headless':
no description given
(default: 'False')
'headless':
no description given
(default: 'False')
'do_fake_localization':
publish fake identity tf "map" -> "odom"
(default: 'True')
'do_fake_localization':
publish fake identity tf "map" -> "odom"
(default: 'True')
'publish_tf_odom2baselink':
publish tf "odom" -> "base_link"
(default: 'True')
'publish_tf_odom2baselink':
publish tf "odom" -> "base_link"
(default: 'True')
'force_publish_vehicle_namespace':
Use vehicle name namespace even if there is only one vehicle
(default: 'False')
'force_publish_vehicle_namespace':
Use vehicle name namespace even if there is only one vehicle
(default: 'False')
'use_rviz':
Whether to launch RViz2
(default: 'True')
'use_rviz':
Whether to launch RViz2
(default: 'True')
'rviz_config_file':
If use_rviz:="True", the configuration file for rviz
(default: '')
'rviz_config_file':
If use_rviz:="True", the configuration file for rviz
(default: '')
|
Expand All @@ -92,9 +85,29 @@ You can use this code to bootstrap your own launch files:
.. tab-set::
.. tab-item:: ROS 1
.. code-block:: bash
xxx
.. code-block:: xml
<launch>
<!-- Arguments -->
<arg name="world_file" default="$(find my_package)/mvsim/demo.world.xml" />
<arg name="headless" default="False" />
<arg name="do_fake_localization" default="True" />
<arg name="publish_tf_odom2baselink" default="True" />
<arg name="force_publish_vehicle_namespace" default="False" />
<arg name="use_rviz" default="True" />
<arg name="rviz_config_file" default="$(find mvsim)/mvsim_tutorial/demo_depth_camera.rviz" />
<!-- Include the original launch file -->
<include file="$(find mvsim)/launch/launch_world.launch">
<arg name="world_file" value="$(arg world_file)" />
<arg name="headless" value="$(arg headless)" />
<arg name="do_fake_localization" value="$(arg do_fake_localization)" />
<arg name="publish_tf_odom2baselink" value="$(arg publish_tf_odom2baselink)" />
<arg name="force_publish_vehicle_namespace" value="$(arg force_publish_vehicle_namespace)" />
<arg name="use_rviz" value="$(arg use_rviz)" />
<arg name="rviz_config_file" value="$(arg rviz_config_file)" />
</include>
</launch>
.. tab-item:: ROS 2
:selected:
Expand Down
27 changes: 27 additions & 0 deletions launch/launch_world.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- Generic ROS1 launch file -->
<!-- Read: https://mvsimulator.readthedocs.io/en/latest/mvsim_node.html -->

<launch>
<!-- Arguments -->
<arg name="world_file" />
<arg name="headless" default="False" />
<arg name="do_fake_localization" default="True" />
<arg name="publish_tf_odom2baselink" default="True" />
<arg name="force_publish_vehicle_namespace" default="False" />
<arg name="use_rviz" default="True" />
<arg name="rviz_config_file" default="$(find mvsim)/mvsim_tutorial/demo_depth_camera.rviz" />

<!-- mvsim Node -->
<node pkg="mvsim" type="mvsim_node" name="mvsim" output="screen">
<param name="world_file" value="$(arg world_file)"/>
<param name="headless" value="$(arg headless)"/>
<param name="do_fake_localization" value="$(arg do_fake_localization)"/>
<param name="publish_tf_odom2baselink" value="$(arg publish_tf_odom2baselink)"/>
<param name="force_publish_vehicle_namespace" value="$(arg force_publish_vehicle_namespace)"/>
</node>

<!-- RViz Node (conditional launch based on use_rviz argument) -->
<group if="$(arg use_rviz)">
<node pkg="rviz" type="rviz" name="rviz" args="-d $(arg rviz_config_file)"/>
</group>
</launch>
1 change: 1 addition & 0 deletions launch/launch_world.launch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generic ROS2 launch file
# Read: https://mvsimulator.readthedocs.io/en/latest/mvsim_node.html

from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
Expand Down
93 changes: 58 additions & 35 deletions mvsim_tutorial/demo_depth_camera.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ Panels:
Expanded:
- /Global Options1
- /Status1
- /MarkerArray1
- /Image1
Splitter Ratio: 0.4941176474094391
Tree Height: 538
Tree Height: 559
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expand All @@ -27,7 +25,7 @@ Panels:
- Class: rviz/Time
Name: Time
SyncMode: 0
SyncSource: LaserScan
SyncSource: Image
- Class: rviz_plugin_tutorials/Teleop
Name: Teleop
Topic: /cmd_vel
Expand Down Expand Up @@ -58,24 +56,22 @@ Visualization Manager:
Value: true
- Class: rviz/TF
Enabled: true
Filter (blacklist): ""
Filter (whitelist): ""
Frame Timeout: 15
Frames:
All Enabled: true
base_footprint:
Value: true
base_link:
Value: true
camera1_image:
Value: true
camera1_points:
cam1:
Value: true
laser1:
lidar1_points:
Value: true
map:
Value: true
odom:
Value: true
world:
scanner1:
Value: true
Marker Alpha: 1
Marker Scale: 1
Expand All @@ -84,18 +80,15 @@ Visualization Manager:
Show Axes: true
Show Names: true
Tree:
world:
map:
odom:
base_link:
base_footprint:
{}
camera1_image:
{}
camera1_points:
{}
laser1:
{}
map:
odom:
base_link:
cam1:
{}
lidar1_points:
{}
scanner1:
{}
Update Interval: 0
Value: true
- Class: rviz/MarkerArray
Expand All @@ -106,6 +99,8 @@ Visualization Manager:
mvsim.chassis_shape: true
mvsim.chassis_shape.wheel0: true
mvsim.chassis_shape.wheel1: true
mvsim.chassis_shape.wheel2: true
mvsim.chassis_shape.wheel3: true
Queue Size: 100
Value: true
- Alpha: 1
Expand Down Expand Up @@ -166,7 +161,7 @@ Visualization Manager:
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /camera1_image
Image Topic: /cam1/image_raw
Max Value: 1
Median window: 5
Min Value: 0
Expand All @@ -176,6 +171,34 @@ Visualization Manager:
Transport Hint: raw
Unreliable: false
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: z
Class: rviz/PointCloud2
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: 3D LiDAR
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.029999999329447746
Style: Flat Squares
Topic: /lidar1_points
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Expand Down Expand Up @@ -204,35 +227,35 @@ Visualization Manager:
Views:
Current:
Class: rviz/Orbit
Distance: 14.817850112915039
Distance: 21.356739044189453
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 8.227726936340332
Y: -0.9801739454269409
Z: 0.4060775637626648
X: 8.40973949432373
Y: -0.6488088369369507
Z: 0.9110875725746155
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.180398091673851
Pitch: 0.24039803445339203
Target Frame: <Fixed Frame>
Yaw: 2.8854002952575684
Yaw: 2.8703999519348145
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1016
Height: 1043
Hide Left Dock: false
Hide Right Dock: false
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd0000000400000000000001560000035afc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002a5000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00540065006c0065006f007001000002e8000000af0000004700ffffff00000001000001f80000035afc0200000004fb0000000a0049006d006100670065010000003d0000035a0000001600fffffffb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000339000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007380000003efc0100000002fb0000000800540069006d0065010000000000000738000003bc00fffffffb0000000800540069006d00650100000000000004500000000000000000000003de0000035a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd00000004000000000000015600000375fc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002ba000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00540065006c0065006f007001000002fd000000b50000004700ffffff00000001000001f800000375fc0200000004fb0000000a0049006d006100670065010000003d000003750000001600fffffffb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000339000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007800000003efc0100000002fb0000000800540069006d0065010000000000000780000003cc00fffffffb0000000800540069006d00650100000000000004500000000000000000000004260000037500000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Teleop:
Expand All @@ -243,6 +266,6 @@ Window Geometry:
collapsed: false
Views:
collapsed: false
Width: 1848
X: 1152
Y: 27
Width: 1920
X: 1920
Y: 0
Loading

0 comments on commit 3be233d

Please sign in to comment.