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

Add namespaces #81

Merged
merged 35 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2213a81
added namespaces to ros2_control
delihus Nov 13, 2023
2b479a6
removed action group
delihus Nov 13, 2023
ae14e26
Added namespace to robot description
delihus Nov 13, 2023
2b37af8
added tests for namespaces in rosbot_controller
delihus Nov 13, 2023
72bef34
update worldlist
delihus Nov 13, 2023
0d82f27
fixed ros2_control namespaces | added namespace to ekf
delihus Nov 13, 2023
ad2ef7c
added mecanum
delihus Nov 13, 2023
64952ce
added ros2_controllers to .gitignore
delihus Nov 13, 2023
9a3e90d
ignored ros2_controllers during Industrial CI
delihus Nov 14, 2023
539cd89
fixed tests
delihus Nov 14, 2023
976a6da
added tf_prefix to imu_sensor_broadcaster
delihus Nov 14, 2023
d0274a6
copied only diff_drive and imu_broadcaster
delihus Nov 14, 2023
1df3216
changed comments | changed timeout for controller test
delihus Nov 14, 2023
86c7588
param changed to parameter
delihus Nov 14, 2023
4a783a6
Multi robot diff drive example
delihus Nov 28, 2023
9d850bf
imu also works
delihus Nov 28, 2023
02fe7d2
Added use_multirobot_system | found imu error
delihus Nov 28, 2023
1b8d92f
changed all topics to ns
delihus Nov 28, 2023
5cd3a69
removed tf_prefix from xacro tests
delihus Nov 28, 2023
f5a9597
removed comments | add use_multirobot_system arg
delihus Nov 28, 2023
297ebc1
moved multi robot system controllers config to rosbot_controller
delihus Nov 28, 2023
9cf6c1b
fixed rosbot_gazebo test
delihus Nov 28, 2023
1ad2db6
separated namespaced tests | added multirobot gazebo example with bro…
delihus Nov 29, 2023
1e0f69d
add multicontroller test
delihus Nov 29, 2023
3ea4d16
add multibringup test
delihus Nov 29, 2023
568063b
add multibringup test
delihus Nov 29, 2023
2e5b6cf
Added remove rosbot_macro
delihus Nov 29, 2023
cd3e104
fixed miss spelling
delihus Nov 29, 2023
b831fd5
The change from robot_hardware_interface seems to be unnecessary
delihus Nov 29, 2023
11fcac8
moved multirobot tests to arrays
delihus Nov 29, 2023
5802601
move rosbot_hardware_interfaces to main
delihus Nov 29, 2023
9019ff3
Fixed len
delihus Nov 29, 2023
165085b
Added updated controllers info to readme
delihus Nov 30, 2023
1a2e6d1
Update README.md
delihus Nov 30, 2023
9d6bae4
Update README.md
rafal-gorecki Dec 1, 2023
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
3 changes: 3 additions & 0 deletions .github/workflows/industrial_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- name: Clone installation requirements
shell: bash
run: python3 -m pip install -U vcstool && vcs import . < ./rosbot/rosbot_hardware.repos && vcs import . < ./rosbot/rosbot_simulation.repos
- name: Copy only diff_drive_controller and imu_sensor_broadcaster, waits for features from ros2-control
shell: bash
run: cp -r ros2_controllers/diff_drive_controller . && cp -r ros2_controllers/imu_sensor_broadcaster . && rm -rf ros2_controllers
delihus marked this conversation as resolved.
Show resolved Hide resolved
- uses: ros-industrial/industrial_ci@master
env:
ROS_DISTRO: ${{matrix.ROS_DISTRO}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ros_components_description/
rosbot_controllers/
husarion/husarion_office_gz
gazebosim/gz_ros2_control
diff_drive_controller
imu_sensor_broadcaster

# pyspelling
*.dic
5 changes: 5 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ Palacios
env
pids
pgrep
namespace
TODO
delipl
microros
namespaces
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ source /opt/ros/$ROS_DISTRO/setup.bash

vcs import src < src/rosbot/rosbot_hardware.repos

# Build only diff_drive_controller and imu_sensor_broadcaster from ros2_controllers
cp -r src/ros2_controllers/diff_drive_controller src && cp -r src/ros2_controllers/imu_sensor_broadcaster src && rm -rf src/ros2_controllers

rm -r src/rosbot_gazebo

rosdep init
Expand Down Expand Up @@ -94,6 +97,9 @@ source /opt/ros/$ROS_DISTRO/setup.bash
vcs import src < src/rosbot/rosbot_hardware.repos
vcs import src < src/rosbot/rosbot_simulation.repos

# Build only diff_drive_controller and imu_sensor_broadcaster from ros2_controllers
cp -r src/ros2_controllers/diff_drive_controller src && cp -r src/ros2_controllers/imu_sensor_broadcaster src && rm -rf src/ros2_controllers

rosdep init
rosdep update --rosdistro $ROS_DISTRO
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
Expand Down
7 changes: 7 additions & 0 deletions rosbot/rosbot_hardware.repos
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ repositories:
type: git
url: https://github.com/husarion/rosbot_controllers
version: main
# Waiting for backporting to the humble version
# https://github.com/ros-controls/ros2_controllers/pull/726 and
# https://github.com/ros-controls/ros2_controllers/pull/831
ros2_controllers:
type: git
url: https://github.com/delihus/ros2_controllers
version: humble-backport
4 changes: 1 addition & 3 deletions rosbot/rosbot_simulation.repos
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ repositories:
gazebosim/gz_ros2_control:
type: git
url: https://github.com/ros-controls/gz_ros2_control.git
# on branch humble hardware isn't activated
# recently on master API breaking change was introduced, it is necessary to use commit before this change
version: b296ff2f5c3758b637a70bd496fe6ed875ab03ce
version: humble

husarion/husarion_office_gz:
type: git
Expand Down
6 changes: 3 additions & 3 deletions rosbot_bringup/config/ekf.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ref: http://docs.ros.org/en/noetic/api/robot_localization/html/state_estimation_nodes.html

## ekf config file ###
ekf_filter_node:
/**/ekf_filter_node:
ros__parameters:
frequency: 25.0
sensor_timeout: 0.05
Expand All @@ -17,7 +17,7 @@ ekf_filter_node:
publish_tf: true
publish_acceleration: false

odom0: /rosbot_base_controller/odom
odom0: rosbot_base_controller/odom
odom0_config: [false, false, false, # X , Y , Z
false, false, false, # roll , pitch ,yaw
true, true, false, # dX , dY , dZ
Expand All @@ -29,7 +29,7 @@ ekf_filter_node:
odom0_differential: false
odom0_relative: true

imu0: /imu_broadcaster/imu
imu0: imu_broadcaster/imu
imu0_config: [false, false, false, # X , Y , Z
false, false, true, # roll , pitch ,yaw
false, false, false, # dX , dY , dZ
Expand Down
23 changes: 23 additions & 0 deletions rosbot_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@


def generate_launch_description():
namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
default_value="",
description="Namespace for all topics and tfs",
)

use_sim = LaunchConfiguration("use_sim")
declare_use_sim_arg = DeclareLaunchArgument(
"use_sim",
Expand Down Expand Up @@ -55,6 +62,13 @@ def generate_launch_description():
),
)

use_multirobot_system = LaunchConfiguration("use_multirobot_system")
declare_use_multirobot_system_arg = DeclareLaunchArgument(
"use_multirobot_system",
default_value="false",
description="Enable correct Ignition Gazebo configuration in URDF",
)

controller_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
Expand All @@ -70,6 +84,8 @@ def generate_launch_description():
"mecanum": mecanum,
"use_gpu": use_gpu,
"simulation_engine": simulation_engine,
"namespace": namespace,
"use_multirobot_system": use_multirobot_system,
}.items(),
)

Expand All @@ -81,13 +97,20 @@ def generate_launch_description():
name="ekf_filter_node",
output="screen",
parameters=[ekf_config],
remappings=[
("/tf", "tf"),
("/tf_static", "tf_static"),
],
namespace=namespace,
)

actions = [
declare_namespace_arg,
declare_mecanum_arg,
declare_use_sim_arg,
declare_use_gpu_arg,
declare_simulation_engine_arg,
declare_use_multirobot_system_arg,
SetParameter(name="use_sim_time", value=use_sim),
controller_launch,
robot_localization_node,
Expand Down
1 change: 1 addition & 0 deletions rosbot_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<test_depend>robot_localization</test_depend>
<test_depend>rosbot_controller</test_depend>
<test_depend>nav_msgs</test_depend>

<export>
<build_type>ament_python</build_type>
Expand Down
4 changes: 2 additions & 2 deletions rosbot_bringup/test/test_diff_drive_ekf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def test_bringup_startup_success():
node.start_publishing_fake_hardware()

node.start_node_thread()
msgs_received_flag = node.odom_tf_event.wait(timeout=10.0)
msgs_received_flag = node.odom_msg_event.wait(timeout=10.0)
assert (
msgs_received_flag
), "Expected odom to base_link tf but it was not received. Check robot_localization!"
), "Expected odometry/filtered message but it was not received. Check robot_localization!"

finally:
rclpy.shutdown()
4 changes: 2 additions & 2 deletions rosbot_bringup/test/test_mecanum_ekf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def test_bringup_startup_success():
node.start_publishing_fake_hardware()

node.start_node_thread()
msgs_received_flag = node.odom_tf_event.wait(timeout=10.0)
msgs_received_flag = node.odom_msg_event.wait(timeout=10.0)
assert (
msgs_received_flag
), "Expected odom to base_link tf but it was not received. Check robot_localization!"
), "Expected odometry/filtered message but it was not received. Check robot_localization!"

finally:
rclpy.shutdown()
79 changes: 79 additions & 0 deletions rosbot_bringup/test/test_multirobot_ekf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2021 Open Source Robotics Foundation, Inc.
# Copyright 2023 Intel Corporation. All Rights Reserved.
# Copyright 2023 Husarion
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import launch_pytest
import pytest
import rclpy

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, TimerAction
from launch.substitutions import PathJoinSubstitution
from launch.launch_description_sources import PythonLaunchDescriptionSource
from test_utils import BringupTestNode

robot_names = ["rosbot1", "rosbot2", "rosbot3", "rosbot4"]


@launch_pytest.fixture
def generate_test_description():
rosbot_bringup = get_package_share_directory("rosbot_bringup")
actions = []
for i in range(len(robot_names)):
bringup_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
rosbot_bringup,
"launch",
"bringup.launch.py",
]
)
),
launch_arguments={
"use_sim": "False",
"mecanum": "False",
"use_gpu": "False",
"namespace": robot_names[i],
}.items(),
)
if i > 0:
delayed_bringup_launch = TimerAction(period=i * 10.0, actions=[bringup_launch])
actions.append(delayed_bringup_launch)
else:
actions.append(bringup_launch)

return LaunchDescription(actions)


@pytest.mark.launch(fixture=generate_test_description)
def test_multirobot_bringup_startup_success():
for robot_name in robot_names:
rclpy.init()
try:
node = BringupTestNode("test_bringup", namespace=robot_name)
node.create_test_subscribers_and_publishers()
node.start_publishing_fake_hardware()

node.start_node_thread()
msgs_received_flag = node.odom_msg_event.wait(timeout=20.0)
assert msgs_received_flag, (
f"Expected {robot_name}/odometry/filtered message but it was not received. "
"Check robot_localization!"
)

finally:
rclpy.shutdown()
68 changes: 68 additions & 0 deletions rosbot_bringup/test/test_namespaced_diff_drive_ekf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright 2021 Open Source Robotics Foundation, Inc.
# Copyright 2023 Intel Corporation. All Rights Reserved.
# Copyright 2023 Husarion
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import launch_pytest
import pytest
import rclpy

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.substitutions import PathJoinSubstitution
from launch.launch_description_sources import PythonLaunchDescriptionSource
from test_utils import BringupTestNode


@launch_pytest.fixture
def generate_test_description():
rosbot_bringup = get_package_share_directory("rosbot_bringup")
bringup_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
rosbot_bringup,
"launch",
"bringup.launch.py",
]
)
),
launch_arguments={
"use_sim": "False",
"mecanum": "False",
"use_gpu": "False",
"namespace": "rosbot2r",
}.items(),
)

return LaunchDescription([bringup_launch])


@pytest.mark.launch(fixture=generate_test_description)
def test_namespaced_bringup_startup_success():
rclpy.init()
try:
node = BringupTestNode("test_bringup", namespace="rosbot2r")
node.create_test_subscribers_and_publishers()
node.start_publishing_fake_hardware()

node.start_node_thread()
msgs_received_flag = node.odom_msg_event.wait(timeout=10.0)
assert (
msgs_received_flag
), "Expected odometry/filtered message but it was not received. Check robot_localization!"

finally:
rclpy.shutdown()
Loading
Loading