Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Dec 24, 2024
2 parents 7b81d7e + 8cff292 commit 99fcc4d
Show file tree
Hide file tree
Showing 33 changed files with 929 additions and 425 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
Changelog for package mvsim
^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.13.0 (2024-12-24)
-------------------
* Add ROS1 generic launcher
* Port demos to the generic ros2 launch file so all rosargs are now exposed in all demos
* create generic launch_world ros2 file
* ROS node: new param "publish_tf_odom2baselink"
* ROS2 warehouse demo launch: add use_rviz argument
* Update README.md: Mark ROS2 Iron as EOL
* Readme: remove obsolete ROS1 wiki link
* ElevationMap from XML: Ensure trimmed input string in kernel
* Alternative reference method for UTM world coordinates
* Implement world georeferenciation via UTM zone number
* Fix targets order for prev commit
* Fix build without ZMQ
* Contributors: Jose Luis Blanco-Claraco

0.12.1 (2024-12-04)
-------------------
* Merge pull request `#58 <https://github.com/MRPT/mvsim/issues/58>`_ from MichaelGrupp/fix-navsatfix-ros1
Expand Down
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,21 @@ if (BUILD_FOR_ROS)
PACKAGE_ROS_VERSION=${PACKAGE_ROS_VERSION}
)

if (TARGET mvsim::comms)
set(DEP_MVSIM_COMMS_TRG mvsim::comms)
endif()
if (TARGET mvsim::msgs)
set(DEP_MVSIM_MSGS_TRG mvsim::msgs)
endif()


# Specify libraries to link a library or executable target against
target_link_libraries(
mvsim_node
#PRIVATE # ros ament already used the plain signature, we cannot use this here...
mvsim::simulator
mvsim::msgs
mvsim::comms
${DEP_MVSIM_MSGS_TRG}
${DEP_MVSIM_COMMS_TRG}
${BOX2D_LIBRARIES} # Box2D libs
${catkin_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
Expand Down Expand Up @@ -391,6 +399,7 @@ if (BUILD_FOR_ROS)
definitions
mvsim_tutorial
models
launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ Build matrix status
| --- | --- | --- | --- |
| ROS 1 Noetic (u20.04) | [![Build Status](https://build.ros.org/job/Ndev__mvsim__ubuntu_focal_amd64/badge/icon)](https://build.ros.org/job/Ndev__mvsim__ubuntu_focal_amd64/) | amd64 [![Build Status](https://build.ros.org/job/Nbin_uF64__mvsim__ubuntu_focal_amd64__binary/badge/icon)](https://build.ros.org/job/Nbin_uF64__mvsim__ubuntu_focal_amd64__binary/) <br> arm64 [![Build Status](https://build.ros.org/job/Nbin_ufv8_uFv8__mvsim__ubuntu_focal_arm64__binary/badge/icon)](https://build.ros.org/job/Nbin_ufv8_uFv8__mvsim__ubuntu_focal_arm64__binary/) <br> armhf [![Build Status](https://build.ros.org/job/Nbin_ufhf_uFhf__mvsim__ubuntu_focal_armhf__binary/badge/icon)](https://build.ros.org/job/Nbin_ufhf_uFhf__mvsim__ubuntu_focal_armhf__binary/) | [![Version](https://img.shields.io/ros/v/noetic/mvsim)](https://index.ros.org/search/?term=mvsim) |
| ROS 2 Humble (u22.04) | [![Build Status](https://build.ros2.org/job/Hdev__mvsim__ubuntu_jammy_amd64/badge/icon)](https://build.ros2.org/job/Hdev__mvsim__ubuntu_jammy_amd64/) | amd64 [![Build Status](https://build.ros2.org/job/Hbin_uJ64__mvsim__ubuntu_jammy_amd64__binary/badge/icon)](https://build.ros2.org/job/Hbin_uJ64__mvsim__ubuntu_jammy_amd64__binary/) <br> arm64 [![Build Status](https://build.ros2.org/job/Hbin_ujv8_uJv8__mvsim__ubuntu_jammy_arm64__binary/badge/icon)](https://build.ros2.org/job/Hbin_ujv8_uJv8__mvsim__ubuntu_jammy_arm64__binary/) | [![Version](https://img.shields.io/ros/v/humble/mvsim)](https://index.ros.org/search/?term=mvsim) |
| ROS 2 Iron (u22.04) | [![Build Status](https://build.ros2.org/job/Idev__mvsim__ubuntu_jammy_amd64/badge/icon)](https://build.ros2.org/job/Idev__mvsim__ubuntu_jammy_amd64/) | amd64 [![Build Status](https://build.ros2.org/job/Ibin_uJ64__mvsim__ubuntu_jammy_amd64__binary/badge/icon)](https://build.ros2.org/job/Ibin_uJ64__mvsim__ubuntu_jammy_amd64__binary/) <br> arm64 [![Build Status](https://build.ros2.org/job/Ibin_ujv8_uJv8__mvsim__ubuntu_jammy_arm64__binary/badge/icon)](https://build.ros2.org/job/Ibin_ujv8_uJv8__mvsim__ubuntu_jammy_arm64__binary/) | [![Version](https://img.shields.io/ros/v/iron/mvsim)](https://index.ros.org/search/?term=mvsim) |
| ROS 2 Jazzy @ u24.04 | [![Build Status](https://build.ros2.org/job/Jdev__mvsim__ubuntu_noble_amd64/badge/icon)](https://build.ros2.org/job/Jdev__mvsim__ubuntu_noble_amd64/) | amd64 [![Build Status](https://build.ros2.org/job/Jbin_uN64__mvsim__ubuntu_noble_amd64__binary/badge/icon)](https://build.ros2.org/job/Jbin_uN64__mvsim__ubuntu_noble_amd64__binary/) <br> arm64 [![Build Status](https://build.ros2.org/job/Jbin_unv8_uNv8__mvsim__ubuntu_noble_arm64__binary/badge/icon)](https://build.ros2.org/job/Jbin_unv8_uNv8__mvsim__ubuntu_noble_arm64__binary/) | [![Version](https://img.shields.io/ros/v/jazzy/mvsim)](https://index.ros.org/search/?term=mvsim) |
| ROS 2 Rolling (u24.04) | [![Build Status](https://build.ros2.org/job/Rdev__mvsim__ubuntu_noble_amd64/badge/icon)](https://build.ros2.org/job/Rdev__mvsim__ubuntu_noble_amd64/) | amd64 [![Build Status](https://build.ros2.org/job/Rbin_uN64__mvsim__ubuntu_noble_amd64__binary/badge/icon)](https://build.ros2.org/job/Rbin_uN64__mvsim__ubuntu_noble_amd64__binary/) <br> arm64 [![Build Status](https://build.ros2.org/job/Rbin_unv8_uNv8__mvsim__ubuntu_noble_arm64__binary/badge/icon)](https://build.ros2.org/job/Rbin_unv8_uNv8__mvsim__ubuntu_noble_arm64__binary/) | [![Version](https://img.shields.io/ros/v/rolling/mvsim)](https://index.ros.org/search/?term=mvsim) |

Expand All @@ -71,13 +70,12 @@ Build matrix status
| --- | --- |
| ROS 1 Melodic (u18.04) | [![Version](https://img.shields.io/ros/v/melodic/mvsim)](https://index.ros.org/search/?term=mvsim) |
| ROS 2 Foxy (u20.04) | [![Version](https://img.shields.io/ros/v/foxy/mvsim)](https://index.ros.org/search/?term=mvsim) |

| ROS 2 Iron (u22.04) | [![Version](https://img.shields.io/ros/v/iron/mvsim)](https://index.ros.org/search/?term=mvsim) |


Docs
----------
* [Main documentation site](https://mvsimulator.readthedocs.io/en/latest/)
* https://wiki.ros.org/mvsim

If you clone this repository, remember to checkout the git submodules too:

Expand Down
157 changes: 152 additions & 5 deletions docs/mvsim_node.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,162 @@
mvsim ROS node
Use from ROS
===================

This page describes the ROS 1 and ROS 2 node for MVSim, which
is an executable named `mvsim_node` that is shipped with the
ROS package named `mvsim`.
MVSim comes with a ROS 1 and ROS 2 **node** (an executable named `mvsim_node`),
which is shipped with the **ROS package** named `mvsim`.

.. note::
You can also use the cli application ``mvsim`` if you want to test or run your world without launching a whole ROS system.
See :ref:`mvsim cli`.


Generic launch file
-------------------------
This launch file can be used to launch a simulated world integrated with ROS from the command line,
or can be also included into your own launch file by setting its **ROS launch arguments**.

Write me!
|
Basic usage from the command line
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

.. code-block:: bash
roslaunch mvsim launch_world.launch \
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 \
headless:=True
|
All launch parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All these parameters apply to both, ROS 1 and ROS 2 launch files above:

.. code-block:: bash
$ 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
'headless':
no description given
(default: 'False')
'do_fake_localization':
publish fake identity tf "map" -> "odom"
(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')
'use_rviz':
Whether to launch RViz2
(default: 'True')
'rviz_config_file':
If use_rviz:="True", the configuration file for rviz
(default: '')
|
How to include it into your own launch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can use this code to bootstrap your own launch files:
.. tab-set::
.. tab-item:: ROS 1
.. 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:
.. code-block:: python
import os
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
# *** REMEMBER: Change this to your actual world file ***
world_file = os.path.join(
get_package_share_directory('my_package'), 'mvsim', 'demo.world.xml')
# and replace this RViz file with yours as needed:
rviz_config_file = os.path.join(
get_package_share_directory('mvsim'), 'mvsim_tutorial', 'demo_depth_camera_ros2.rviz')
headless = 'False'
do_fake_localization = 'True'
publish_tf_odom2baselink = 'True'
force_publish_vehicle_namespace = 'False'
use_rviz = 'True'
# Create LaunchDescription
ld = LaunchDescription()
# Add actions to LaunchDescription
ld.add_action(IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('mvsim'), 'launch', 'launch_world.launch.py')
),
launch_arguments={
'world_file': world_file,
'headless': headless,
'do_fake_localization': do_fake_localization,
'publish_tf_odom2baselink': publish_tf_odom2baselink,
'force_publish_vehicle_namespace': force_publish_vehicle_namespace,
'use_rviz': use_rviz,
'rviz_config_file': rviz_config_file
}.items()
))
return ld
|
10 changes: 7 additions & 3 deletions docs/world_georeference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ This can be specified with a ``<georeference>`` tag as documented below.
...
<!-- Define georeferenced coordinates to the world so GNSS/GPS sensors can be properly simulated -->
<georeference>
<utm_zone>30</utm_zone>
<world_is_utm>true</world_is_utm>
<!-- A reference point roughly within the area of the map to linearize coordinates -->
<latitude>36.894718</latitude>
<longitude>-2.316988</longitude>
<height>100.0</height>
</georeference>
...
</mvsim_world>
Expand All @@ -42,9 +46,9 @@ Parameters for worlds in local coordinates and GNSS geodetic reference:

- ``<height>zz</height>``: The height over the WGS84 ellipsoid for the world (0,0,0).

- ``<world_to_enu_rotation_deg>tt</world_to_enu_rotation_deg>``: An optional rotation (in degrees) if you want North not to be aligned with +Y as it is the default.
- ``<world_to_enu_rotation_deg>tt</world_to_enu_rotation_deg>``: An optional rotation (in degrees) if you want North not to be aligned with +Y as it is the default. Does not apply when using UTM coordinates.


Parameters for worlds with local coordinates as `UTM coordinates <https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system>`_:

- ``<utm_zone>nn</utm_zone>``: Specify the UTM zone number (longitude), positive/negative for Northern/Southern Hemisphere.
- ``<world_is_utm>true</world_is_utm>``: Indicates that world coordinates are UTM coordinates, defined in the zone of the reference (lat,lon) geodetic coordinates.
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>
75 changes: 75 additions & 0 deletions launch/launch_world.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Generic ROS2 launch file
# Read: https://mvsimulator.readthedocs.io/en/latest/mvsim_node.html

from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
import os


def generate_launch_description():

# args that can be set from the command line or a default will be used
world_file_launch_arg = DeclareLaunchArgument(
"world_file", description='Path to the *.world.xml file to load')

headless_launch_arg = DeclareLaunchArgument(
"headless", default_value='False')

do_fake_localization_arg = DeclareLaunchArgument(
"do_fake_localization", default_value='True', description='publish fake identity tf "map" -> "odom"')

publish_tf_odom2baselink_arg = DeclareLaunchArgument(
"publish_tf_odom2baselink", default_value='True', description='publish tf "odom" -> "base_link"')

force_publish_vehicle_namespace_arg = DeclareLaunchArgument(
"force_publish_vehicle_namespace", default_value='False',
description='Use vehicle name namespace even if there is only one vehicle')

use_rviz_arg = DeclareLaunchArgument(
'use_rviz', default_value='True',
description='Whether to launch RViz2'
)

rviz_config_file_arg = DeclareLaunchArgument(
'rviz_config_file', default_value='',
description='If use_rviz:="True", the configuration file for rviz'
)

mvsim_node = Node(
package='mvsim',
executable='mvsim_node',
name='mvsim',
output='screen',
parameters=[
{
"world_file": LaunchConfiguration('world_file'),
"headless": LaunchConfiguration('headless'),
"do_fake_localization": LaunchConfiguration('do_fake_localization'),
"publish_tf_odom2baselink": LaunchConfiguration('publish_tf_odom2baselink'),
"force_publish_vehicle_namespace": LaunchConfiguration('force_publish_vehicle_namespace'),
}]
)

rviz2_node = Node(
condition=IfCondition(LaunchConfiguration('use_rviz')),
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=[] if LaunchConfiguration('rviz_config_file') == '' else [
'-d', LaunchConfiguration('rviz_config_file')]
)

return LaunchDescription([
world_file_launch_arg,
headless_launch_arg,
do_fake_localization_arg,
publish_tf_odom2baselink_arg,
force_publish_vehicle_namespace_arg,
use_rviz_arg,
rviz_config_file_arg,
mvsim_node,
rviz2_node
])
5 changes: 3 additions & 2 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,14 @@ endfunction()


# ========================== Targets ====================================
add_subdirectory(simulator)

if (MVSIM_WITH_PROTOBUF)
add_subdirectory(comms)
add_subdirectory(msgs)
endif()

add_subdirectory(simulator)


# From: https://github.com/ament/ament_cmake/blob/rolling/ament_cmake_python/ament_cmake_python-extras.cmake
macro(mvsim_ament_cmake_python_get_python_install_dir)
if(NOT DEFINED PYTHON_INSTALL_DIR)
Expand Down
Loading

0 comments on commit 99fcc4d

Please sign in to comment.