Skip to content

Commit 65154a9

Browse files
delihusrafal-goreckiaction-bot
authored
Add gazebo namespace (#93)
* added namespaces to ros2_control Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed action group Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added namespace to robot description Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added tests for namespaces in rosbot_controller Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * update worldlist Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed ros2_control namespaces | added namespace to ekf Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added mecanum Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added ros2_controllers to .gitignore Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * ignored ros2_controllers during Industrial CI Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed tests Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added tf_prefix to imu_sensor_broadcaster Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * copied only diff_drive and imu_broadcaster Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * changed comments | changed timeout for controller test Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * param changed to parameter Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Multi robot diff drive example Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * imu also works Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added use_multirobot_system | found imu error Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * changed all topics to ns Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed tf_prefix from xacro tests Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed comments | add use_multirobot_system arg Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * moved multi robot system controllers config to rosbot_controller Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed rosbot_gazebo test Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * separated namespaced tests | added multirobot gazebo example with broken imu Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * add multicontroller test Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * add multibringup test Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * add multibringup test Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added remove rosbot_macro Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed miss spelling Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * The change from robot_hardware_interface seems to be unnecessary Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * moved multirobot tests to arrays Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * move rosbot_hardware_interfaces to main Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Fixed len Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added updated controllers info to readme Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Gazebo test (#86) * Wait for velocity stabilization * Apply suggestions from code review Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com> * Apply suggestions from code review * refactor * test * headless * fix sim time * update * Update rosbot_gazebo/test/test_mecanum_simulation.py Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com> --------- Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com> * Update changelog * 0.10.5 * Added gazebo remappings file Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added namespace to mappings Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed clock | added camera Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * working without multisystem Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * parse robots arg | removed delays from rosbot_controller Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * TEsting Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed imu while testing Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Multirobots tests Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * all gazebo tests Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * changed to namespaced repositories Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * revert headless to tests Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * IMU name with slash Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed delay from spawning Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added name for ign_ros2_controller Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fixed submodule Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * checking mecanum controller sim time true Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Update industrial_ci.yaml * removed coltroller test for testing timeout Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed bringup tests for testing timeout Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * used launch_ros features Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added unbuffered to skip list Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added microros submodules to ignore and removed ros2 control demos from tests Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Revert "removed bringup tests for testing timeout" This reverts commit f58a967. * Revert "removed coltroller test for testing timeout" This reverts commit 50c90e5. * Added nav2_common to dependencies Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * added readme Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Get the newest version of gz_ros2_control Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed sim_time from yaml Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added range sensor Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added tests for ranges and camera Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * removed unnecesary if Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Added me to the authors Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * Update rosbot_hardware.repos * Update rosbot_simulation.repos * Update .github/workflows/industrial_ci.yaml Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> * Update .github/workflows/industrial_ci.yaml Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> * default simulator is ignition-gazebo Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * merged multiple_simulation.launch.py with simulation.launch.py Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * unnecessary event Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> * fix simulation.launch.py * test max 3 robots + env(NS) + readme * Better diagnostic in multirobot test * simplify test --------- Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com> Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> Co-authored-by: action-bot <action-bot@action-bot.com> Co-authored-by: rafal-gorecki <rafal.gorecki@husarion.com>
1 parent eb5f820 commit 65154a9

40 files changed

+878
-975
lines changed

.github/workflows/industrial_ci.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
ros_industrial_ci:
3030
name: ROS Industrial CI
3131
runs-on: ubuntu-22.04
32-
timeout-minutes: 30 # Set the job timeout to 30 minutes
32+
timeout-minutes: 30
3333
needs:
3434
- black
3535
- spellcheck
@@ -54,7 +54,8 @@ jobs:
5454
shell: bash
5555
run: |
5656
python3 -m pip install -U vcstool
57-
vcs import src < src/rosbot/rosbot_hardware.repos && vcs import src < src/rosbot/rosbot_simulation.repos
57+
vcs import src < src/rosbot/rosbot_hardware.repos &&
58+
vcs import src < src/rosbot/rosbot_simulation.repos
5859
5960
- name: Copy only diff_drive_controller and imu_sensor_broadcaster, waits for features from ros2-control
6061
shell: bash
@@ -63,6 +64,10 @@ jobs:
6364
cp -r src/ros2_controllers/imu_sensor_broadcaster src/
6465
rm -rf src/ros2_controllers
6566
67+
- name: Remove ign_ros2_control demo and tests
68+
shell: bash
69+
run: rm -rf src/gazebosim/gz_ros2_control/ign_ros2_control_demos src/gazebosim/gz_ros2_control/gz_ros2_control_tests
70+
6671
# Package micro_ros_msgs does not have industrial ci and tests does not pass.
6772
# For more information see https://github.com/micro-ROS/micro_ros_msgs/issues/7
6873
- name: Remove tests from micro_ros_msgs

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ husarion/husarion_office_gz
1414
gazebosim/gz_ros2_control
1515
diff_drive_controller
1616
imu_sensor_broadcaster
17+
micro-ROS-Agent/
18+
micro_ros_msgs/
1719

1820
# pyspelling
1921
*.dic

.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,4 @@ stm
148148
ttyUSB
149149
subprocess
150150
cbus
151+
unbuffered

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ rm -r src/rosbot_gazebo
6262
sudo rosdep init
6363
rosdep update --rosdistro $ROS_DISTRO
6464
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
65-
colcon build
65+
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
6666
```
6767

6868
> **Prerequisites**
@@ -100,10 +100,13 @@ vcs import src < src/rosbot/rosbot_simulation.repos
100100
# Build only diff_drive_controller and imu_sensor_broadcaster from ros2_controllers
101101
cp -r src/ros2_controllers/diff_drive_controller src && cp -r src/ros2_controllers/imu_sensor_broadcaster src && rm -rf src/ros2_controllers
102102
103+
# Remove ign_ros2_control demo and test
104+
rm -rf src/gazebosim/gz_ros2_control/ign_ros2_control_demos src/gazebosim/gz_ros2_control/gz_ros2_control_tests
105+
103106
sudo rosdep init
104107
rosdep update --rosdistro $ROS_DISTRO
105108
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
106-
colcon build
109+
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
107110
```
108111

109112
Running:

ROS_API.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Use `bringup.launch.py` from `rosbot_bringup` to start all base functionalities
1111
- `/odometry/filtered` (_nav_msgs/Odometry_)
1212

1313

14-
- `controller.launch.py` from `rosbot_controller`, it loads robot model defined in `rosbot_description` as well as ros2 control [rosbot_hardware_interfaces](https://github.com/husarion/rosbot_hardware_interfaces). It also starts controllers:
14+
Use `controller.launch.py` from `rosbot_controller`, it loads robot model defined in `rosbot_description` as well as ros2 control [rosbot_hardware_interfaces](https://github.com/husarion/rosbot_hardware_interfaces). It also starts controllers:
1515
* `joint_state_broadcaster`
1616
* `rosbot_base_controller`
1717
* `imu_broadcaster`
@@ -29,5 +29,16 @@ Use `bringup.launch.py` from `rosbot_bringup` to start all base functionalities
2929
- `/imu_broadcaster/imu` (_sensor_msgs/Imu_)
3030

3131
Use `simulation.launch.py` from `rosbot_gazebo` to start all base functionalities for ROSbot 2, 2 PRO, 2R in the Gazebo simulator.
32+
If you want to spawn multiple robots use `simulation.launch.py` with the `robots` argument e. g.:
33+
```bash
34+
ros2 launch rosbot_gazebo simulation.launch.py robots:='robot1={x: 0.0, y: -1.0}; robot2={x: 1.0, y: -1.0}; robot3={x: 2.0, y: -1.0}; robot4={x: 3.0, y: -1.0}'
35+
```
36+
37+
If you want to use your own world add to the world's sdf file gazebo sensors plugins inside any `<model>` tag:
38+
```xml
39+
<plugin filename="ignition-gazebo-imu-system" name="gz::sim::systems::Imu"/>
40+
<plugin filename="ignition-gazebo-sensors-system" name="gz::sim::systems::Sensors"/>
41+
```
42+
3243
> **Warning**
3344
> The distance sensors' topics types from Gazebo simulation mismatch with the real ones. The range sensors are not implemented yet in the Gazebo Ignition (for more information look [here](https://github.com/gazebosim/gz-sensors/issues/19)). The real type is [sensor_msgs/msg/Range](https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/Range.msg) but simulated [sensor_msgs/msg/LaserScan](https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/LaserScan.msg). The first value of the `ranges` in [sensor_msgs/msg/LaserScan](https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/LaserScan.msg) is the `range` field of [sensor_msgs/msg/Range](https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/Range.msg).

rosbot/rosbot_hardware.repos

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repositories:
66
ros_components_description:
77
type: git
88
url: https://github.com/husarion/ros_components_description.git
9-
version: ros2
9+
version: ros2
1010
rosbot_controllers:
1111
type: git
1212
url: https://github.com/husarion/rosbot_controllers
@@ -17,7 +17,7 @@ repositories:
1717
ros2_controllers:
1818
type: git
1919
url: https://github.com/delihus/ros2_controllers
20-
version: humble-backport
20+
version: humble
2121
micro_ros_msgs:
2222
type: git
2323
url: https://github.com/micro-ROS/micro_ros_msgs.git

rosbot/rosbot_simulation.repos

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repositories:
22
gazebosim/gz_ros2_control:
33
type: git
4-
url: https://github.com/ros-controls/gz_ros2_control.git
4+
url: https://github.com/ros-controls/gz_ros2_control
55
version: humble
66

77
husarion/husarion_office_gz:

rosbot_bringup/config/ekf.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## ekf config file ###
44
/**/ekf_filter_node:
55
ros__parameters:
6-
frequency: 25.0
6+
frequency: 20.0
77
sensor_timeout: 0.05
88
two_d_mode: true
99

rosbot_bringup/launch/bringup.launch.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
from ament_index_python.packages import get_package_share_directory
1818
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
1919
from launch.launch_description_sources import PythonLaunchDescriptionSource
20-
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
20+
from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution
2121

2222

2323
def generate_launch_description():
2424
namespace = LaunchConfiguration("namespace")
2525
declare_namespace_arg = DeclareLaunchArgument(
2626
"namespace",
27-
default_value="",
27+
default_value=EnvironmentVariable("ROBOT_NAMESPACE", default_value=""),
2828
description="Namespace for all topics and tfs",
2929
)
3030

@@ -62,13 +62,6 @@ def generate_launch_description():
6262
),
6363
)
6464

65-
use_multirobot_system = LaunchConfiguration("use_multirobot_system")
66-
declare_use_multirobot_system_arg = DeclareLaunchArgument(
67-
"use_multirobot_system",
68-
default_value="false",
69-
description="Enable correct Ignition Gazebo configuration in URDF",
70-
)
71-
7265
controller_launch = IncludeLaunchDescription(
7366
PythonLaunchDescriptionSource(
7467
PathJoinSubstitution(
@@ -85,7 +78,6 @@ def generate_launch_description():
8578
"use_gpu": use_gpu,
8679
"simulation_engine": simulation_engine,
8780
"namespace": namespace,
88-
"use_multirobot_system": use_multirobot_system,
8981
}.items(),
9082
)
9183

@@ -94,10 +86,10 @@ def generate_launch_description():
9486
robot_localization_node = Node(
9587
package="robot_localization",
9688
executable="ekf_node",
97-
name="ekf_filter_node",
9889
output="screen",
9990
parameters=[ekf_config],
10091
remappings=[
92+
("/diagnostics", "diagnostics"),
10193
("/tf", "tf"),
10294
("/tf_static", "tf_static"),
10395
],
@@ -110,7 +102,6 @@ def generate_launch_description():
110102
declare_use_sim_arg,
111103
declare_use_gpu_arg,
112104
declare_simulation_engine_arg,
113-
declare_use_multirobot_system_arg,
114105
SetParameter(name="use_sim_time", value=use_sim),
115106
controller_launch,
116107
robot_localization_node,

rosbot_bringup/test/test_multirobot_ekf.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
from ament_index_python.packages import get_package_share_directory
2222
from launch import LaunchDescription
23-
from launch.actions import IncludeLaunchDescription, TimerAction
23+
from launch.actions import IncludeLaunchDescription
2424
from launch.substitutions import PathJoinSubstitution
2525
from launch.launch_description_sources import PythonLaunchDescriptionSource
2626
from test_utils import BringupTestNode
2727

28-
robot_names = ["rosbot1", "rosbot2", "rosbot3", "rosbot4"]
28+
robot_names = ["robot1", "robot2", "robot3"]
2929

3030

3131
@launch_pytest.fixture
@@ -50,11 +50,8 @@ def generate_test_description():
5050
"namespace": robot_names[i],
5151
}.items(),
5252
)
53-
if i > 0:
54-
delayed_bringup_launch = TimerAction(period=i * 10.0, actions=[bringup_launch])
55-
actions.append(delayed_bringup_launch)
56-
else:
57-
actions.append(bringup_launch)
53+
54+
actions.append(bringup_launch)
5855

5956
return LaunchDescription(actions)
6057

rosbot_controller/config/diff_drive_controller.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**/controller_manager:
22
ros__parameters:
3-
use_sim_time: False
43
update_rate: 20 # Hz
54

65
joint_state_broadcaster:
@@ -13,6 +12,7 @@
1312
/**/imu_broadcaster:
1413
ros__parameters:
1514
tf_frame_prefix_enable: false
15+
use_namespace_as_sensor_name_prefix: true
1616

1717
sensor_name: imu
1818
frame_id: imu_link

rosbot_controller/config/mecanum_drive_controller.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**/controller_manager:
22
ros__parameters:
3-
use_sim_time: false
43
update_rate: 20 # Hz
54

65
joint_state_broadcaster:
@@ -13,6 +12,7 @@
1312
/**/imu_broadcaster:
1413
ros__parameters:
1514
tf_frame_prefix_enable: false
15+
use_namespace_as_sensor_name_prefix: true
1616

1717
sensor_name: imu
1818
frame_id: imu_link
@@ -33,9 +33,8 @@
3333
wheel_separation_y: 0.192
3434
wheel_radius: 0.047
3535

36-
37-
wheel_separation_multiplier_x: 1.0
38-
wheel_separation_multiplier_y: 1.0
36+
wheel_separation_x_multiplier: 1.0
37+
wheel_separation_y_multiplier: 1.0
3938

4039
wheel_radius_multiplier: 1.0
4140

0 commit comments

Comments
 (0)