diff --git a/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py b/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py
index 216fede11..2d505957a 100644
--- a/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py
+++ b/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py
@@ -18,14 +18,16 @@ def launch_setup(context):
P = LaunchConfiguration("P")
Y = LaunchConfiguration("Y")
gz_sensor = LaunchConfiguration("sensor")
+ gz_namespace = LaunchConfiguration("namespace")
+ gz_entity = LaunchConfiguration("entity")
package_dir = get_package_share_directory("custom_robots")
nodes_to_start = []
sensor = gz_sensor.perform(context)
-
- bridge_yaml = os.path.join(package_dir, "params", f"turtlebot2_{sensor}.yaml")
+ namespace = gz_namespace.perform(context)
+ entity = gz_entity.perform(context)
# =========================
# ROBOT DESCRIPTION (URDF)
@@ -42,6 +44,7 @@ def launch_setup(context):
mappings={
"camera": "true" if sensor == "camera" else "false",
"stereo": "true" if sensor == "stereo" else "false",
+ "namespace": namespace,
},
).toxml()
@@ -51,6 +54,7 @@ def launch_setup(context):
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
+ namespace=gz_namespace,
output="screen",
parameters=[robot_description, {"use_sim_time": True}],
)
@@ -58,11 +62,12 @@ def launch_setup(context):
gz_spawn_entity = Node(
package="ros_gz_sim",
executable="create",
+ namespace=gz_namespace,
arguments=[
"-topic",
- "/robot_description",
+ f"/{namespace}/robot_description",
"-name",
- "turtlebot2",
+ entity,
"-allow_renaming",
"true",
"-x",
@@ -84,7 +89,12 @@ def launch_setup(context):
gz_ros2_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
- arguments=["--ros-args", "-p", f"config_file:={bridge_yaml}"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/odom@nav_msgs/msg/Odometry[gz.msgs.Odometry",
+ f"/{namespace}/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist",
+ f"/{namespace}/laser/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ ],
output="screen",
)
@@ -94,27 +104,25 @@ def launch_setup(context):
# Sensor deppending on sensor arguments
if sensor == "stereo":
- gz_ros2_image_left_bridge = Node(
+ gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=["/cam_turtlebot_left/image_raw"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/camera_left/image_raw",
+ f"/{namespace}/camera_right/image_raw",
+ ],
output="screen",
)
- gz_ros2_image_right_bridge = Node(
- package="ros_gz_image",
- executable="image_bridge",
- arguments=["/cam_turtlebot_right/image_raw"],
- output="screen",
- )
+ nodes_to_start.append(gz_ros2_image_bridge)
- nodes_to_start.append(gz_ros2_image_left_bridge)
- nodes_to_start.append(gz_ros2_image_right_bridge)
- elif sensor == "":
+ elif sensor == "camera":
gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=["/depth_camera/image_raw"],
+ namespace=gz_namespace,
+ arguments=[f"/{namespace}/camera/image_raw"],
output="screen",
)
@@ -124,19 +132,18 @@ def launch_setup(context):
def generate_launch_description():
- declared_arguments = []
-
- # Add any entry parameter
- declared_arguments.append(
- DeclareLaunchArgument("use_sim_time", default_value="true")
- )
- declared_arguments.append(DeclareLaunchArgument("x", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("z", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("R", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("P", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("Y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("sensor", default_value="stereo"))
+ declared_arguments = [
+ DeclareLaunchArgument("use_sim_time", default_value="true"),
+ DeclareLaunchArgument("x", default_value="0"),
+ DeclareLaunchArgument("y", default_value="0"),
+ DeclareLaunchArgument("z", default_value="0"),
+ DeclareLaunchArgument("R", default_value="0"),
+ DeclareLaunchArgument("P", default_value="0"),
+ DeclareLaunchArgument("Y", default_value="0"),
+ DeclareLaunchArgument("sensor", default_value="stereo"),
+ DeclareLaunchArgument("namespace", default_value="turtlebot2"),
+ DeclareLaunchArgument("entity", default_value="turtlebot2"),
+ ]
return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
diff --git a/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2.urdf.xacro b/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2.urdf.xacro
index db8ef7f1b..58c073348 100755
--- a/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2.urdf.xacro
+++ b/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2.urdf.xacro
@@ -4,21 +4,23 @@
+
+
-
+
-
-
+
+
-
-
+
+
diff --git a/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_common.urdf.xacro b/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_common.urdf.xacro
index ede5b1644..b387bfbc8 100755
--- a/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_common.urdf.xacro
+++ b/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_common.urdf.xacro
@@ -60,7 +60,7 @@
-
+
-
-
-
+
+
+
diff --git a/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_gz.urdf.xacro b/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_gz.urdf.xacro
index e7830847a..c85b5f9c4 100644
--- a/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_gz.urdf.xacro
+++ b/CustomRobots/Turtlebot2/model/turtlebot2/turtlebot2_gz.urdf.xacro
@@ -1,7 +1,7 @@
-
+
@@ -24,9 +24,9 @@
true
false
5
- /${name}/image_raw
+ /${namespace}/${name}/image_raw
- /${name}/camera_info
+ /${namespace}/${name}/camera_info
1.0472
640
@@ -61,7 +61,7 @@
-
+
@@ -78,9 +78,9 @@
true
false
5
- /${name}/image_raw
+ /${namespace}/${name}/image_raw
- /${name}/camera_info
+ /${namespace}/${name}/camera_info
1.570000
640
@@ -101,7 +101,7 @@
-
+
@@ -121,7 +121,7 @@
1
1
5
- ${topic}
+ /${namespace}/${name}/scan
laser
@@ -142,20 +142,20 @@
-
+
true
20
${name}_collision
- ${topic}
+ /${namespace}/${topic}
-
+
@@ -164,7 +164,7 @@
1
50
- ${topic}
+ /${namespace}/imu
gaussian
@@ -225,7 +225,7 @@
-
+
1
@@ -233,18 +233,18 @@
wheel_right_joint
.230
0.070
- ${topic}
+ /${namespace}/cmd_vel
-
+
odom
base_footprint
${freq}
- ${topic}
+ /${namespace}/odom
3
diff --git a/CustomRobots/Turtlebot2/params/turtlebot2_camera.yaml b/CustomRobots/Turtlebot2/params/turtlebot2_camera.yaml
index 2b12e493a..4667b45e0 100644
--- a/CustomRobots/Turtlebot2/params/turtlebot2_camera.yaml
+++ b/CustomRobots/Turtlebot2/params/turtlebot2_camera.yaml
@@ -32,18 +32,6 @@
gz_type_name: "gz.msgs.Image"
direction: GZ_TO_ROS
-- ros_topic_name: "/depth_camera/depth_image"
- gz_topic_name: "/depth_camera/depth_image"
- ros_type_name: "sensor_msgs/msg/Image"
- gz_type_name: "gz.msgs.Image"
- direction: GZ_TO_ROS
-
-- ros_topic_name: "/depth_camera/points"
- gz_topic_name: "/depth_camera/points"
- ros_type_name: "sensor_msgs/msg/PointCloud2"
- gz_type_name: "gz.msgs.PointCloudPacked"
- direction: GZ_TO_ROS
-
- ros_topic_name: "/person/cmd_vel"
gz_topic_name: "/person/cmd_vel"
ros_type_name: "geometry_msgs/msg/Twist"
diff --git a/CustomRobots/autonomous_car/launch/autonomous_car.launch.py b/CustomRobots/autonomous_car/launch/autonomous_car.launch.py
index 9fdbe6ec7..4b6600687 100644
--- a/CustomRobots/autonomous_car/launch/autonomous_car.launch.py
+++ b/CustomRobots/autonomous_car/launch/autonomous_car.launch.py
@@ -19,6 +19,8 @@ def launch_setup(context):
Y = LaunchConfiguration("Y")
gz_sensor = LaunchConfiguration("sensor")
gz_mode = LaunchConfiguration("mode")
+ gz_namespace = LaunchConfiguration("namespace")
+ gz_entity = LaunchConfiguration("entity")
package_dir = get_package_share_directory("custom_robots")
@@ -26,10 +28,8 @@ def launch_setup(context):
sensor = gz_sensor.perform(context)
mode = gz_mode.perform(context)
-
- bridge_yaml = os.path.join(
- package_dir, "params", f"autonomous_car_{mode}_{sensor}.yaml"
- )
+ namespace = gz_namespace.perform(context)
+ entity = gz_entity.perform(context)
# =========================
# ROBOT DESCRIPTION (URDF)
@@ -48,6 +48,7 @@ def launch_setup(context):
"lidar": "true" if sensor == "lidar" else "false",
"laser": "true" if sensor == "laser" else "false",
"steering": mode,
+ "namespace": namespace,
},
).toxml()
@@ -57,6 +58,7 @@ def launch_setup(context):
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
+ namespace=gz_namespace,
output="screen",
parameters=[robot_description, {"use_sim_time": True}],
)
@@ -64,11 +66,12 @@ def launch_setup(context):
gz_spawn_entity = Node(
package="ros_gz_sim",
executable="create",
+ namespace=gz_namespace,
arguments=[
"-topic",
- "/robot_description",
+ f"/{namespace}/robot_description",
"-name",
- "autonomous_car",
+ entity,
"-allow_renaming",
"true",
"-x",
@@ -90,7 +93,11 @@ def launch_setup(context):
gz_ros2_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
- arguments=["--ros-args", "-p", f"config_file:={bridge_yaml}"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/odom@nav_msgs/msg/Odometry[gz.msgs.Odometry",
+ f"/{namespace}/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist",
+ ],
output="screen",
)
@@ -103,29 +110,53 @@ def launch_setup(context):
gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=["/prius_autoparking/image_raw"],
+ namespace=gz_namespace,
+ arguments=[f"/{namespace}/camera/image_raw"],
output="screen",
)
nodes_to_start.append(gz_ros2_image_bridge)
+ elif sensor == "laser":
+ gz_ros2_laser_bridge = Node(
+ package="ros_gz_bridge",
+ executable="parameter_bridge",
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/laser_front/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ f"/{namespace}/laser_side/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ f"/{namespace}/laser_back/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ ],
+ output="screen",
+ )
+ nodes_to_start.append(gz_ros2_laser_bridge)
+ elif sensor == "lidar":
+ gz_ros2_lidar_bridge = Node(
+ package="ros_gz_bridge",
+ executable="parameter_bridge",
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/lidar/pc2/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked",
+ ],
+ output="screen",
+ )
+ nodes_to_start.append(gz_ros2_lidar_bridge)
return nodes_to_start
def generate_launch_description():
- declared_arguments = []
-
- # Add any entry parameter
- declared_arguments.append(
- DeclareLaunchArgument("use_sim_time", default_value="true")
- )
- declared_arguments.append(DeclareLaunchArgument("x", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("z", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("R", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("P", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("Y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("sensor", default_value="none"))
- declared_arguments.append(DeclareLaunchArgument("mode", default_value="ackermann"))
+ declared_arguments = [
+ DeclareLaunchArgument("use_sim_time", default_value="true"),
+ DeclareLaunchArgument("x", default_value="0"),
+ DeclareLaunchArgument("y", default_value="0"),
+ DeclareLaunchArgument("z", default_value="0"),
+ DeclareLaunchArgument("R", default_value="0"),
+ DeclareLaunchArgument("P", default_value="0"),
+ DeclareLaunchArgument("Y", default_value="0"),
+ DeclareLaunchArgument("sensor", default_value="none"),
+ DeclareLaunchArgument("mode", default_value="ackermann"),
+ DeclareLaunchArgument("namespace", default_value="autonomous_car"),
+ DeclareLaunchArgument("entity", default_value="autonomous_car"),
+ ]
return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
diff --git a/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car.urdf.xacro b/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car.urdf.xacro
index 7ea77daed..13e5660a2 100644
--- a/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car.urdf.xacro
+++ b/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car.urdf.xacro
@@ -6,25 +6,27 @@
+
+
-
+
-
+
-
+
-
-
-
+
+
+
diff --git a/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_common.urdf.xacro b/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_common.urdf.xacro
index b077c2450..34c354cb1 100644
--- a/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_common.urdf.xacro
+++ b/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_common.urdf.xacro
@@ -3,7 +3,7 @@
xmlns:xacro="http://ros.org/wiki/xacro">
-
+
@@ -209,15 +209,15 @@
-->
-
+
-
+
-
+
diff --git a/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_gz.urdf.xacro b/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_gz.urdf.xacro
index 8792311f5..61ce5109e 100644
--- a/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_gz.urdf.xacro
+++ b/CustomRobots/autonomous_car/models/autonomous_car/autonomous_car_gz.urdf.xacro
@@ -1,7 +1,7 @@
-
+
@@ -16,9 +16,9 @@
true
false
20
- /${name}/image_raw
+ /${namespace}/${name}/image_raw
- /${name}/camera_info
+ /${namespace}/${name}/camera_info
2.094
gnomonical
@@ -52,7 +52,7 @@
-
+
@@ -66,7 +66,7 @@
1
1
20
- ${topic}
+ /${namespace}/${name}/scan
base_scan
@@ -87,7 +87,7 @@
-
+
@@ -141,7 +141,7 @@
1
1
20
- ${topic}
+ /${namespace}/${name}/pc2
base_scan
@@ -173,7 +173,7 @@
-
+
fl_axle
@@ -191,27 +191,27 @@
50
-50
50
- ${topic}
+ /${namespace}/cmd_vel
-
+
odom
chassis_link
${freq}
- ${topic}
+ /${namespace}/odom
3
-
+
- ${topic}
+ /${namespace}/cmd_vel
diff --git a/CustomRobots/f1/launch/f1.launch.py b/CustomRobots/f1/launch/f1.launch.py
index 34723a881..61884efc9 100644
--- a/CustomRobots/f1/launch/f1.launch.py
+++ b/CustomRobots/f1/launch/f1.launch.py
@@ -17,33 +17,27 @@ def launch_setup(context):
R = LaunchConfiguration("R")
P = LaunchConfiguration("P")
Y = LaunchConfiguration("Y")
- sensor = LaunchConfiguration("sensor")
- mode = LaunchConfiguration("mode")
+ gz_sensor = LaunchConfiguration("sensor")
+ gz_mode = LaunchConfiguration("mode")
+ gz_namespace = LaunchConfiguration("namespace")
+ gz_entity = LaunchConfiguration("entity")
package_dir = get_package_share_directory("custom_robots")
nodes_to_start = []
- f1_sensor = "camera"
- f1_model = "holonomic"
+ sensor = gz_sensor.perform(context)
+ mode = gz_mode.perform(context)
+ namespace = gz_namespace.perform(context)
+ entity = gz_entity.perform(context)
- if sensor.perform(context) == "laser":
- f1_sensor = "laser"
-
- if mode.perform(context) == "ackermann":
- f1_model = "ackermann"
-
- bridge_yaml = os.path.join(package_dir, "params", "f1_renault.yaml")
+ f1_sensor = "laser" if sensor == "laser" else "camera"
+ f1_model = "ackermann" if mode == "ackermann" else "holonomic"
# =========================
# ROBOT DESCRIPTION (URDF)
# =========================
- xacro_file = os.path.join(
- package_dir,
- "models",
- "f1",
- "f1.urdf.xacro",
- )
+ xacro_file = os.path.join(package_dir, "models", "f1", "f1.urdf.xacro")
robot_description_content = xacro.process_file(
xacro_file,
@@ -52,6 +46,7 @@ def launch_setup(context):
"ackermann": "true" if f1_model == "ackermann" else "false",
"camera": "true" if f1_sensor == "camera" else "false",
"laser": "true" if f1_sensor == "laser" else "false",
+ "namespace": namespace,
},
).toxml()
@@ -61,6 +56,7 @@ def launch_setup(context):
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
+ namespace=gz_namespace,
output="screen",
parameters=[robot_description, {"use_sim_time": True}],
)
@@ -68,11 +64,12 @@ def launch_setup(context):
gz_spawn_entity = Node(
package="ros_gz_sim",
executable="create",
+ namespace=gz_namespace,
arguments=[
"-topic",
- "/robot_description",
+ f"/{namespace}/robot_description",
"-name",
- "f1",
+ entity,
"-allow_renaming",
"true",
"-x",
@@ -94,7 +91,11 @@ def launch_setup(context):
gz_ros2_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
- arguments=["--ros-args", "-p", f"config_file:={bridge_yaml}"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/odom@nav_msgs/msg/Odometry[gz.msgs.Odometry",
+ f"/{namespace}/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist",
+ ],
output="screen",
)
@@ -107,29 +108,40 @@ def launch_setup(context):
gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=["/cam_f1_left/image_raw"],
+ arguments=[f"/{namespace}/camera/image_raw"],
output="screen",
)
nodes_to_start.append(gz_ros2_image_bridge)
+ else:
+ gz_ros2_laser_bridge = Node(
+ package="ros_gz_bridge",
+ executable="parameter_bridge",
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/laser/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ ],
+ output="screen",
+ )
+ nodes_to_start.append(gz_ros2_laser_bridge)
return nodes_to_start
def generate_launch_description():
- declared_arguments = []
-
# Add any entry parameter
- declared_arguments.append(
- DeclareLaunchArgument("use_sim_time", default_value="true")
- )
- declared_arguments.append(DeclareLaunchArgument("x", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("z", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("R", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("P", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("Y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("sensor", default_value="camera"))
- declared_arguments.append(DeclareLaunchArgument("mode", default_value="holo"))
+ declared_arguments = [
+ DeclareLaunchArgument("use_sim_time", default_value="true"),
+ DeclareLaunchArgument("x", default_value="0"),
+ DeclareLaunchArgument("y", default_value="0"),
+ DeclareLaunchArgument("z", default_value="0"),
+ DeclareLaunchArgument("R", default_value="0"),
+ DeclareLaunchArgument("P", default_value="0"),
+ DeclareLaunchArgument("Y", default_value="0"),
+ DeclareLaunchArgument("sensor", default_value="camera"),
+ DeclareLaunchArgument("mode", default_value="holo"),
+ DeclareLaunchArgument("namespace", default_value="f1"),
+ DeclareLaunchArgument("entity", default_value="f1"),
+ ]
return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
diff --git a/CustomRobots/f1/models/f1/f1.urdf.xacro b/CustomRobots/f1/models/f1/f1.urdf.xacro
index 406b42e39..4e37411a6 100644
--- a/CustomRobots/f1/models/f1/f1.urdf.xacro
+++ b/CustomRobots/f1/models/f1/f1.urdf.xacro
@@ -6,23 +6,25 @@
+
+
-
+
-
+
-
+
-
+
diff --git a/CustomRobots/f1/models/f1/f1_common.urdf.xacro b/CustomRobots/f1/models/f1/f1_common.urdf.xacro
index e4851f51b..d63be0aa4 100644
--- a/CustomRobots/f1/models/f1/f1_common.urdf.xacro
+++ b/CustomRobots/f1/models/f1/f1_common.urdf.xacro
@@ -3,7 +3,7 @@
xmlns:xacro="http://ros.org/wiki/xacro">
-
+
@@ -24,11 +24,11 @@
-
-
+
+
-
+
@@ -216,9 +216,9 @@
-->
-
+
-
+
diff --git a/CustomRobots/f1/models/f1/f1_gz.urdf.xacro b/CustomRobots/f1/models/f1/f1_gz.urdf.xacro
index 7efb48238..35416f696 100644
--- a/CustomRobots/f1/models/f1/f1_gz.urdf.xacro
+++ b/CustomRobots/f1/models/f1/f1_gz.urdf.xacro
@@ -1,7 +1,7 @@
-
+
@@ -22,9 +22,9 @@
true
true
20.000000
- /${name}/image_raw
+ /${namespace}/${name}/image_raw
- /${name}/camera_info
+ /${namespace}/${name}/camera_info
1.570000
640
@@ -45,7 +45,7 @@
-
+
@@ -65,7 +65,7 @@
1
1
20
- f1/laser/scan
+ /${namespace}/laser/scan
base_scan
diff --git a/CustomRobots/quadrotor/launch/quadrotor.launch.py b/CustomRobots/quadrotor/launch/quadrotor.launch.py
index 503617b14..937cd3412 100644
--- a/CustomRobots/quadrotor/launch/quadrotor.launch.py
+++ b/CustomRobots/quadrotor/launch/quadrotor.launch.py
@@ -12,6 +12,7 @@
from launch_ros.actions import Node
from launch_ros.parameter_descriptions import ParameterValue
from launch.launch_description_sources import PythonLaunchDescriptionSource
+from ros_gz_bridge.actions import RosGzBridge
def launch_setup(context):
@@ -24,6 +25,7 @@ def launch_setup(context):
Y = LaunchConfiguration("Y")
gz_sensor = LaunchConfiguration("sensor")
gz_namespace = LaunchConfiguration("namespace")
+ gz_entity = LaunchConfiguration("entity")
package_dir = get_package_share_directory("custom_robots")
@@ -31,8 +33,7 @@ def launch_setup(context):
sensor = gz_sensor.perform(context)
namespace = gz_namespace.perform(context)
-
- bridge_yaml = os.path.join(package_dir, "params", f"quadrotor_{sensor}.yaml")
+ entity = gz_entity.perform(context)
# =========================
# ROBOT DESCRIPTION (URDF)
@@ -71,7 +72,7 @@ def launch_setup(context):
"-topic",
"robot_description",
"-name",
- namespace,
+ entity,
"-allow_renaming",
"true",
"-x",
@@ -89,13 +90,13 @@ def launch_setup(context):
],
output="screen",
)
+ bridge_yaml = os.path.join(package_dir, "params", f"quadrotor_{sensor}.yaml")
- gz_ros2_bridge = Node(
- package="ros_gz_bridge",
- executable="parameter_bridge",
+ gz_ros2_bridge = RosGzBridge(
+ bridge_name="bridge1",
namespace=gz_namespace,
- parameters=[{"config_file": bridge_yaml}],
- output="screen",
+ config_file=bridge_yaml,
+ use_composition=str(True),
)
as2_gt_bridge = Node(
@@ -107,7 +108,7 @@ def launch_setup(context):
{
"name_space": namespace,
"pose_frame_id": "earth",
- "twist_frame_id": namespace + "/base_link",
+ "twist_frame_id": f"{namespace}/base_link",
},
],
)
@@ -119,9 +120,7 @@ def launch_setup(context):
"/as2_default_gazebo_sim.launch.py",
]
),
- launch_arguments={
- "namespace": gz_namespace,
- }.items(),
+ launch_arguments={"namespace": gz_namespace}.items(),
)
nodes_to_start.append(gz_spawn_entity)
@@ -132,45 +131,35 @@ def launch_setup(context):
# Sensor deppending on sensor arguments
if sensor == "camera":
- gz_ros2_frontal_image_bridge = Node(
+ gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=[f"/{namespace}/frontal_cam/image_raw"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/frontal_cam/image_raw",
+ f"/{namespace}/ventral_cam/image_raw",
+ ],
output="screen",
)
- gz_ros2_ventral_image_bridge = Node(
- package="ros_gz_image",
- executable="image_bridge",
- arguments=[f"/{namespace}/ventral_cam/image_raw"],
- output="screen",
- )
-
- nodes_to_start.append(gz_ros2_frontal_image_bridge)
- nodes_to_start.append(gz_ros2_ventral_image_bridge)
+ nodes_to_start.append(gz_ros2_image_bridge)
return nodes_to_start
def generate_launch_description():
- declared_arguments = []
-
- # Add any entry parameter
- declared_arguments.append(
- DeclareLaunchArgument("use_sim_time", default_value="true")
- )
- declared_arguments.append(DeclareLaunchArgument("x", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("z", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("R", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("P", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("Y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("sensor", default_value="camera"))
- declared_arguments.append(
- DeclareLaunchArgument(
- "namespace", description="Namespace to use", default_value="drone0"
- )
- )
+ declared_arguments = [
+ DeclareLaunchArgument("use_sim_time", default_value="true"),
+ DeclareLaunchArgument("x", default_value="0"),
+ DeclareLaunchArgument("y", default_value="0"),
+ DeclareLaunchArgument("z", default_value="0"),
+ DeclareLaunchArgument("R", default_value="0"),
+ DeclareLaunchArgument("P", default_value="0"),
+ DeclareLaunchArgument("Y", default_value="0"),
+ DeclareLaunchArgument("sensor", default_value="camera"),
+ DeclareLaunchArgument("namespace", default_value="drone"),
+ DeclareLaunchArgument("entity", default_value="drone"),
+ ]
return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
diff --git a/CustomRobots/quadrotor/models/quadrotor/quadrotor.sdf b/CustomRobots/quadrotor/models/quadrotor/quadrotor.sdf
deleted file mode 100644
index 521a872f9..000000000
--- a/CustomRobots/quadrotor/models/quadrotor/quadrotor.sdf
+++ /dev/null
@@ -1,657 +0,0 @@
-
-
-
-
-
-
- true
- 0 0 0 0 -0 0
-
- 0 0 0 0 -0 0
- 1.5
-
- 0.025
- 0
- 0
- 0.009
- 0
- 0.033
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.47 0.47 0.11
-
-
-
-
- 0 0 0 0 -0 0
-
-
- 1 1 1
- model://quadrotor/meshes/quadrotor.dae
-
-
-
-
- -0.07 0 0.065 0 -0 0
-
-
- model://quadrotor/meshes/led.dae
-
-
-
-
- -0.08 0.037 0.04 -1.0472 -0 0.2
-
-
- model://quadrotor/meshes/led.dae
-
-
-
-
- -0.08 -0.035 0.04 1.0472 -0 -0.1
-
-
- model://quadrotor/meshes/led.dae
-
-
-
-
-
-
-
-
- 0.005
-
- 8.33e-06
- 0
- 0
- 8.33e-06
- 0
- 8.33e-06
-
-
-
- 1
- 250
-
-
-
-
- 0
- 0.009
- 0.00075
- 0.005
- 0.00002
- 400.0
- 0.00025
-
-
-
-
- 0
- 0.009
- 0.00075
- 0.005
- 0.00002
- 400.0
- 0.00025
-
-
-
-
- 0
- 0.009
- 0.00075
- 0.005
- 0.00002
- 400.0
- 0.00025
-
-
-
-
-
-
- 0
- 0.021
- 0.05
- 0.0075
- 0.000375
- 175.0
- 0.005
-
-
-
-
- 0
- 0.021
- 0.05
- 0.0075
- 0.000375
- 175.0
- 0.005
-
-
-
-
- 0
- 0.021
- 0.05
- 0.0075
- 0.000375
- 175.0
- 0.005
-
-
-
-
-
-
-
-
- base_link
- imu
-
-
-
- 0.13 -0.22 0.023 0 -0 0
-
- 0 0 0 0 -0 0
- 0.005
-
- 9.75e-07
- 0
- 0
- 4.17041e-05
- 0
- 4.26041e-05
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.005
- 0.1
-
-
-
-
-
-
-
-
-
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.1 0.1 0.1
- model://quadrotor/meshes/propeller_ccw.dae
-
-
-
- 0 0 1 1
- 0 0 0 1
-
- 0
-
- 1
-
-
-
- rotor_0
- base_link
-
- 0 0 1
-
- -1e+16
- 1e+16
-
-
- 0
- 0
-
-
-
-
- -0.13 0.2 0.023 0 -0 0
-
- 0 0 0 0 -0 0
- 0.005
-
- 9.75e-07
- 0
- 0
- 4.17041e-05
- 0
- 4.26041e-05
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.005
- 0.1
-
-
-
-
-
-
-
-
-
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.1 0.1 0.1
- model://quadrotor/meshes/propeller_ccw.dae
-
-
-
- 1 0 0 1
- 0 0 0 1
-
- 0
-
- 1
-
-
-
- rotor_1
- base_link
-
- 0 0 1
-
- -1e+16
- 1e+16
-
-
- 0
- 0
-
-
-
-
- 0.13 0.22 0.023 0 -0 0
-
- 0 0 0 0 -0 0
- 0.005
-
- 9.75e-07
- 0
- 0
- 4.17041e-05
- 0
- 4.26041e-05
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.005
- 0.1
-
-
-
-
-
-
-
-
-
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.1 0.1 0.1
- model://quadrotor/meshes/propeller_cw.dae
-
-
-
- 0 0 1 1
- 0 0 0 1
-
- 0
-
- 1
-
-
-
- rotor_2
- base_link
-
- 0 0 1
-
- -1e+16
- 1e+16
-
-
- 0
- 0
-
-
-
-
- -0.13 -0.2 0.023 0 -0 0
-
- 0 0 0 0 -0 0
- 0.005
-
- 9.75e-07
- 0
- 0
- 4.17041e-05
- 0
- 4.26041e-05
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.005
- 0.1
-
-
-
-
-
-
-
-
-
-
-
-
- 0 0 0 0 -0 0
-
-
- 0.1 0.1 0.1
- model://quadrotor/meshes/propeller_cw.dae
-
-
-
- 1 0 0 1
- 0 0 0 1
-
- 0
-
- 1
-
-
-
- rotor_3
- base_link
-
- 0 0 1
-
- -1e+16
- 1e+16
-
-
- 0
- 0
-
-
-
-
-
-
- true
- true
- false
- false
- true
- false
- true
- true
- 100
-
-
-
- model/drone0
- rotor_0_joint
- rotor_0
- ccw
- 0.0125
- 0.025
- 800.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 0
- 8.06428e-05
- 1e-06
- motor_speed/0
- 10
- velocity
-
-
- model/drone0
- rotor_1_joint
- rotor_1
- ccw
- 0.0125
- 0.025
- 800.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 1
- 8.06428e-05
- 1e-06
- motor_speed/1
- 10
- velocity
-
-
- model/drone0
- rotor_2_joint
- rotor_2
- cw
- 0.0125
- 0.025
- 800.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 2
- 8.06428e-05
- 1e-06
- motor_speed/2
- 10
- velocity
-
-
- model/drone0
- rotor_3_joint
- rotor_3
- cw
- 0.0125
- 0.025
- 800.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 3
- 8.06428e-05
- 1e-06
- motor_speed/3
- 10
- velocity
-
-
-
-
- model/drone0
- cmd_vel
- command/motor_speed
- velocity_controller/enable
- base_link
- 2.7 2.7 2.7
- 2 3 0.15
- 0.4 0.52 0.18
- 1 1 2
- 5 5 5
- 3 3 3
- 0 0 0.05
-
-
-
- 0.1105 0.1261 0.00947
- 0 0 0
-
-
- 0.004 0.004 0.004
-
-
- rotor_0_joint
- 8.54858e-06
- 0.016
- 1
-
-
- rotor_1_joint
- 8.54858e-06
- 0.016
- 1
-
-
- rotor_2_joint
- 8.54858e-06
- 0.016
- -1
-
-
- rotor_3_joint
- 8.54858e-06
- 0.016
- -1
-
-
-
-
-
-
- 3
- 100
-
-
-
-
-
-
-
-
-
- 0 0 0.05 0 0 0
-
- 0.001
- 0.000
- 0.000
- 0.001
- 0.000
- 0.001
-
- 0.035
-
-
- 0 0 0.05 0 0 0
-
- true
- true
- 30
- drone0/frontal_cam/image_raw
- camera_rgb_frame
-
- drone0/frontal_cam/camera_info
- 1.02974
-
- 320
- 240
- R8G8B8
-
-
- 0.02
- 300
-
-
- gaussian
- 0.0
- 0.007
-
-
-
-
-
-
-
- 0 0 -0.05 0 1.57 0
-
- 0.001
- 0.000
- 0.000
- 0.001
- 0.000
- 0.001
-
- 0.035
-
-
- 0 0 -0.05 0 1.57 0
-
- true
- true
- 30
- drone0/ventral_cam/image_raw
- camera_rgb_frame
-
- drone0/ventral_cam/camera_info
- 1.02974
-
- 320
- 240
- R8G8B8
-
-
- 0.02
- 300
-
-
- gaussian
- 0.0
- 0.007
-
-
-
-
-
-
- base_link
- frontal_cam
-
-
-
- base_link
- ventral_cam
-
-
-
-
\ No newline at end of file
diff --git a/CustomRobots/quadrotor/models/quadrotor/quadrotor.urdf.xacro b/CustomRobots/quadrotor/models/quadrotor/quadrotor.urdf.xacro
index 3de702d7e..b565b48e8 100644
--- a/CustomRobots/quadrotor/models/quadrotor/quadrotor.urdf.xacro
+++ b/CustomRobots/quadrotor/models/quadrotor/quadrotor.urdf.xacro
@@ -3,7 +3,7 @@
xmlns:xacro="http://ros.org/wiki/xacro">
-
+
diff --git a/CustomRobots/quadrotor/models/quadrotor/quadrotor_common.urdf.xacro b/CustomRobots/quadrotor/models/quadrotor/quadrotor_common.urdf.xacro
index 913703ff3..d4bad8cba 100644
--- a/CustomRobots/quadrotor/models/quadrotor/quadrotor_common.urdf.xacro
+++ b/CustomRobots/quadrotor/models/quadrotor/quadrotor_common.urdf.xacro
@@ -10,7 +10,7 @@
-
+
@@ -86,14 +86,14 @@
-
-
-
-
+
+
+
+
-
+
diff --git a/CustomRobots/quadrotor/models/quadrotor/quadrotor_gz.urdf.xacro b/CustomRobots/quadrotor/models/quadrotor/quadrotor_gz.urdf.xacro
index 400fd85fb..b5f28b451 100644
--- a/CustomRobots/quadrotor/models/quadrotor/quadrotor_gz.urdf.xacro
+++ b/CustomRobots/quadrotor/models/quadrotor/quadrotor_gz.urdf.xacro
@@ -100,12 +100,12 @@
-
+
+ /model/${namespace}/odometry -->
${freq}
3
diff --git a/CustomRobots/quadrotor/params/quadrotor_camera.yaml b/CustomRobots/quadrotor/params/quadrotor_camera.yaml
index d4059ec7d..80fce5e01 100644
--- a/CustomRobots/quadrotor/params/quadrotor_camera.yaml
+++ b/CustomRobots/quadrotor/params/quadrotor_camera.yaml
@@ -1,10 +1,3 @@
-# Clock
-- ros_topic_name: "/clock"
- gz_topic_name: "/clock"
- ros_type_name: "rosgraph_msgs/msg/Clock"
- gz_type_name: "gz.msgs.Clock"
- direction: GZ_TO_ROS
-
# gz topic published by IMU plugin
- ros_topic_name: "sensor_measurements/imu"
gz_topic_name: "/world/default/model/drone0/model/imu/link/internal/sensor/imu/imu"
@@ -19,24 +12,12 @@
gz_type_name: "gz.msgs.Pose_V"
direction: GZ_TO_ROS
-- ros_topic_name: "/tf"
- gz_topic_name: "/world/default/model/drone0/pose"
- ros_type_name: "tf2_msgs/msg/TFMessage"
- gz_type_name: "gz.msgs.Pose_V"
- direction: GZ_TO_ROS
-
- ros_topic_name: "/tf"
gz_topic_name: "/model/drone0/pose_static"
ros_type_name: "tf2_msgs/msg/TFMessage"
gz_type_name: "gz.msgs.Pose_V"
direction: GZ_TO_ROS
-- ros_topic_name: "/tf"
- gz_topic_name: "/world/default/model/drone0/pose_static"
- ros_type_name: "tf2_msgs/msg/TFMessage"
- gz_type_name: "gz.msgs.Pose_V"
- direction: GZ_TO_ROS
-
# Battery plugin
- ros_topic_name: "sensor_measurements/battery"
gz_topic_name: "/model/drone0/battery/linear_battery/state"
@@ -56,28 +37,3 @@
ros_type_name: "std_msgs/msg/Bool"
gz_type_name: "gz.msgs.Boolean"
direction: ROS_TO_GZ
-
-# Payload plugin
-- ros_topic_name: "sensor_measurements/frontal_camera/image_raw"
- gz_topic_name: "/world/default/model/drone0/model/frontal_cam/link/hd_camera/sensor/camera/image"
- ros_type_name: "sensor_msgs/msg/Image"
- gz_type_name: "gz.msgs.Image"
- direction: GZ_TO_ROS
-
-- ros_topic_name: "sensor_measurements/frontal_camera/camera_info"
- gz_topic_name: "/world/default/model/drone0/model/frontal_cam/link/hd_camera/sensor/camera/camera_info"
- ros_type_name: "sensor_msgs/msg/CameraInfo"
- gz_type_name: "gz.msgs.CameraInfo"
- direction: GZ_TO_ROS
-
-- ros_topic_name: "sensor_measurements/ventral_camera/image_raw"
- gz_topic_name: "/world/default/model/drone0/model/ventral_cam/link/hd_camera/sensor/camera/image"
- ros_type_name: "sensor_msgs/msg/Image"
- gz_type_name: "gz.msgs.Image"
- direction: GZ_TO_ROS
-
-- ros_topic_name: "sensor_measurements/ventral_camera/camera_info"
- gz_topic_name: "/world/default/model/drone0/model/ventral_cam/link/hd_camera/sensor/camera/camera_info"
- ros_type_name: "sensor_msgs/msg/CameraInfo"
- gz_type_name: "gz.msgs.CameraInfo"
- direction: GZ_TO_ROS
diff --git a/CustomRobots/turtlebot3/launch/turtlebot3.launch.py b/CustomRobots/turtlebot3/launch/turtlebot3.launch.py
index 3eb768b62..76fb888d1 100644
--- a/CustomRobots/turtlebot3/launch/turtlebot3.launch.py
+++ b/CustomRobots/turtlebot3/launch/turtlebot3.launch.py
@@ -19,14 +19,16 @@ def launch_setup(context):
Y = LaunchConfiguration("Y")
gz_sensor = LaunchConfiguration("sensor")
gz_noise = LaunchConfiguration("noise")
+ gz_namespace = LaunchConfiguration("namespace")
+ gz_entity = LaunchConfiguration("entity")
package_dir = get_package_share_directory("custom_robots")
nodes_to_start = []
sensor = gz_sensor.perform(context)
-
- bridge_yaml = os.path.join(package_dir, "params", f"turtlebot3.yaml")
+ namespace = gz_namespace.perform(context)
+ entity = gz_entity.perform(context)
# =========================
# ROBOT DESCRIPTION (URDF)
@@ -43,20 +45,17 @@ def launch_setup(context):
mappings={
"camera": "true" if sensor == "camera" else "false",
"noise_level": gz_noise.perform(context),
+ "namespace": namespace,
},
).toxml()
- ## Temporary SDF load
- # sdf_file = os.path.join(package_dir, 'models', 'turtlebot3', 'turtlebot3.sdf')
- # with open(sdf_file, 'r') as infp:
- # robot_description_content = infp.read()
-
robot_description = {"robot_description": robot_description_content}
robot_state_publisher_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
+ namespace=gz_namespace,
output="screen",
parameters=[robot_description, {"use_sim_time": True}],
)
@@ -64,11 +63,12 @@ def launch_setup(context):
gz_spawn_entity = Node(
package="ros_gz_sim",
executable="create",
+ namespace=gz_namespace,
arguments=[
"-topic",
- "/robot_description",
+ f"/{namespace}/robot_description",
"-name",
- "turtlebot3",
+ entity,
"-allow_renaming",
"true",
"-x",
@@ -90,7 +90,11 @@ def launch_setup(context):
gz_ros2_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
- arguments=["--ros-args", "-p", f"config_file:={bridge_yaml}"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/odom@nav_msgs/msg/Odometry[gz.msgs.Odometry",
+ f"/{namespace}/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist",
+ ],
output="screen",
)
@@ -103,30 +107,41 @@ def launch_setup(context):
gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=["/turtlebot3/camera/image_raw"],
+ namespace=gz_namespace,
+ arguments=[f"/{namespace}/camera/image_raw"],
output="screen",
)
nodes_to_start.append(gz_ros2_image_bridge)
+ elif sensor == "laser":
+ gz_ros2_laser_bridge = Node(
+ package="ros_gz_bridge",
+ executable="parameter_bridge",
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/laser/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ ],
+ output="screen",
+ )
+ nodes_to_start.append(gz_ros2_laser_bridge)
return nodes_to_start
def generate_launch_description():
- declared_arguments = []
-
- # Add any entry parameter
- declared_arguments.append(
- DeclareLaunchArgument("use_sim_time", default_value="true")
- )
- declared_arguments.append(DeclareLaunchArgument("x", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("z", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("R", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("P", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("Y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("sensor", default_value="camera"))
- declared_arguments.append(DeclareLaunchArgument("noise", default_value="none"))
+ declared_arguments = [
+ DeclareLaunchArgument("use_sim_time", default_value="true"),
+ DeclareLaunchArgument("x", default_value="0"),
+ DeclareLaunchArgument("y", default_value="0"),
+ DeclareLaunchArgument("z", default_value="0"),
+ DeclareLaunchArgument("R", default_value="0"),
+ DeclareLaunchArgument("P", default_value="0"),
+ DeclareLaunchArgument("Y", default_value="0"),
+ DeclareLaunchArgument("sensor", default_value="camera"),
+ DeclareLaunchArgument("noise", default_value="none"),
+ DeclareLaunchArgument("namespace", default_value="turtlebot3"),
+ DeclareLaunchArgument("entity", default_value="turtlebot3"),
+ ]
return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
diff --git a/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3.urdf.xacro b/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3.urdf.xacro
index c80383c79..955221a90 100644
--- a/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3.urdf.xacro
+++ b/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3.urdf.xacro
@@ -4,7 +4,9 @@
+
+
@@ -31,13 +33,13 @@
-
+
-
+
-
+
diff --git a/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_common.urdf.xacro b/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_common.urdf.xacro
index a2e525416..a958e3cd4 100644
--- a/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_common.urdf.xacro
+++ b/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_common.urdf.xacro
@@ -2,7 +2,7 @@
-
+
@@ -79,7 +79,7 @@
-
+
@@ -90,7 +90,7 @@
-
+
@@ -154,9 +154,9 @@
-
-
-
-
+
+
+
+
diff --git a/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_gz.urdf.xacro b/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_gz.urdf.xacro
index 1330df498..403a98d26 100644
--- a/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_gz.urdf.xacro
+++ b/CustomRobots/turtlebot3/models/turtlebot3/turtlebot3_gz.urdf.xacro
@@ -1,6 +1,6 @@
-
+
@@ -20,10 +20,10 @@
true
true
30
- /${topic}/image_raw
+ /${namespace}/${name}/image_raw
${name}_link
- /${topic}/camera_info
+ /${namespace}/${name}/camera_info
1.02974
640
@@ -44,7 +44,7 @@
-
+
@@ -76,7 +76,7 @@
1
1
5
- ${topic}
+ /${namespace}/${name}/scan
${name}_link
@@ -97,7 +97,7 @@
-
+
@@ -116,7 +116,7 @@
1
200
- ${topic}
+ /${namespace}/imu
@@ -164,7 +164,7 @@
-
+
@@ -178,7 +178,7 @@
1.0
- ${topic}
+ /${namespace}/cmd_vel
odom
@@ -189,22 +189,22 @@
-
+
odom
base_footprint
${freq}
- ${topic}
+ /${namespace}/odom
3
-
+
- ${topic}
+ /${namespace}/odom_noisy
odom
base
diff --git a/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py b/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py
index 8e3a022f4..b5488b947 100644
--- a/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py
+++ b/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py
@@ -18,14 +18,16 @@ def launch_setup(context):
P = LaunchConfiguration("P")
Y = LaunchConfiguration("Y")
gz_sensor = LaunchConfiguration("sensor")
+ gz_namespace = LaunchConfiguration("namespace")
+ gz_entity = LaunchConfiguration("entity")
package_dir = get_package_share_directory("custom_robots")
nodes_to_start = []
sensor = gz_sensor.perform(context)
-
- bridge_yaml = os.path.join(package_dir, "params", f"vacuum_cleaner_{sensor}.yaml")
+ namespace = gz_namespace.perform(context)
+ entity = gz_entity.perform(context)
# =========================
# ROBOT DESCRIPTION (URDF)
@@ -42,6 +44,7 @@ def launch_setup(context):
mappings={
"camera": "true" if sensor == "camera" else "false",
"laser": "true" if sensor == "laser" else "false",
+ "namespace": namespace,
},
).toxml()
# if sensor == "camera":
@@ -59,6 +62,7 @@ def launch_setup(context):
package="robot_state_publisher",
executable="robot_state_publisher",
name="robot_state_publisher",
+ namespace=gz_namespace,
output="screen",
parameters=[robot_description, {"use_sim_time": True}],
)
@@ -66,11 +70,12 @@ def launch_setup(context):
gz_spawn_entity = Node(
package="ros_gz_sim",
executable="create",
+ namespace=gz_namespace,
arguments=[
"-topic",
- "/robot_description",
+ f"/{namespace}/robot_description",
"-name",
- "vacuum_cleaner",
+ entity,
"-allow_renaming",
"true",
"-x",
@@ -92,7 +97,15 @@ def launch_setup(context):
gz_ros2_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
- arguments=["--ros-args", "-p", f"config_file:={bridge_yaml}"],
+ namespace=gz_namespace,
+ arguments=[
+ f"/{namespace}/odom@nav_msgs/msg/Odometry[gz.msgs.Odometry",
+ f"/{namespace}/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist",
+ f"/{namespace}/laser/scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan",
+ f"/{namespace}/events/center_bumper@ros_gz_interfaces/msg/Contacts[gz.msgs.Contacts",
+ f"/{namespace}/events/right_bumper@ros_gz_interfaces/msg/Contacts[gz.msgs.Contacts",
+ f"/{namespace}/events/left_bumper@ros_gz_interfaces/msg/Contacts[gz.msgs.Contacts",
+ ],
output="screen",
)
@@ -105,7 +118,8 @@ def launch_setup(context):
gz_ros2_image_bridge = Node(
package="ros_gz_image",
executable="image_bridge",
- arguments=["/camera/image_raw"],
+ namespace=gz_namespace,
+ arguments=[f"/{namespace}/camera/image_raw"],
output="screen",
)
nodes_to_start.append(gz_ros2_image_bridge)
@@ -114,19 +128,18 @@ def launch_setup(context):
def generate_launch_description():
- declared_arguments = []
-
- # Add any entry parameter
- declared_arguments.append(
- DeclareLaunchArgument("use_sim_time", default_value="true")
- )
- declared_arguments.append(DeclareLaunchArgument("x", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("z", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("R", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("P", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("Y", default_value="0"))
- declared_arguments.append(DeclareLaunchArgument("sensor", default_value="laser"))
+ declared_arguments = [
+ DeclareLaunchArgument("use_sim_time", default_value="true"),
+ DeclareLaunchArgument("x", default_value="0"),
+ DeclareLaunchArgument("y", default_value="0"),
+ DeclareLaunchArgument("z", default_value="0"),
+ DeclareLaunchArgument("R", default_value="0"),
+ DeclareLaunchArgument("P", default_value="0"),
+ DeclareLaunchArgument("Y", default_value="0"),
+ DeclareLaunchArgument("sensor", default_value="laser"),
+ DeclareLaunchArgument("namespace", default_value="vacuum_cleaner"),
+ DeclareLaunchArgument("entity", default_value="vacuum_cleaner"),
+ ]
return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
diff --git a/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner.urdf.xacro b/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner.urdf.xacro
index 333315c19..166b4764d 100644
--- a/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner.urdf.xacro
+++ b/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner.urdf.xacro
@@ -4,17 +4,19 @@
+
+
-
+
-
+
-
+
diff --git a/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_common.urdf.xacro b/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_common.urdf.xacro
index aad456cd7..7bc9c7b06 100644
--- a/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_common.urdf.xacro
+++ b/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_common.urdf.xacro
@@ -2,7 +2,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
@@ -170,8 +170,8 @@
-
-
-
+
+
+
diff --git a/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_gz.urdf.xacro b/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_gz.urdf.xacro
index c7b6df966..3d0f51ba7 100644
--- a/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_gz.urdf.xacro
+++ b/CustomRobots/vacuum_cleaner/models/vacuum_cleaner/vacuum_cleaner_gz.urdf.xacro
@@ -1,7 +1,7 @@
-
+
@@ -16,9 +16,9 @@
true
false
20
- /${name}/image_raw
+ /${namespace}/${name}/image_raw
- /${name}/camera_info
+ /${namespace}/${name}/camera_info
1.089
0.0
@@ -47,7 +47,7 @@
-
+
@@ -67,7 +67,7 @@
1
1
20
- ${topic}
+ /${namespace}/laser/scan
laser
@@ -88,7 +88,7 @@
-
+
0.1
0.1
@@ -102,7 +102,7 @@
true
${name}_collision
- ${topic}
+ /${namespace}/${topic}
@@ -110,30 +110,30 @@
-
+
- ${topic}
+ /${namespace}/cmd_vel
-
+
odom
base
${freq}
- ${topic}
+ /${namespace}/odom
3
-
+
- ${topic}
+ /${namespace}/odom_noisy
odom
base
diff --git a/Launchers/follow_person_teleop_harmonic.launch.py b/Launchers/follow_person_teleop_harmonic.launch.py
index 2cf78378f..10b99c389 100644
--- a/Launchers/follow_person_teleop_harmonic.launch.py
+++ b/Launchers/follow_person_teleop_harmonic.launch.py
@@ -32,8 +32,18 @@ def generate_launch_description():
output="screen",
)
+ gz_ros2_bridge = Node(
+ package="ros_gz_bridge",
+ executable="parameter_bridge",
+ arguments=[
+ "/person/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist",
+ ],
+ output="screen",
+ )
+
ld = LaunchDescription()
ld.add_action(gazebo_server)
ld.add_action(world_entity_cmd)
+ ld.add_action(gz_ros2_bridge)
return ld
diff --git a/Launchers/rescue_people.launch.py b/Launchers/rescue_people.launch.py
index ec3bf3db2..2507a43c7 100755
--- a/Launchers/rescue_people.launch.py
+++ b/Launchers/rescue_people.launch.py
@@ -32,8 +32,18 @@ def generate_launch_description():
output="screen",
)
+ gz_ros2_bridge = Node(
+ package="ros_gz_bridge",
+ executable="parameter_bridge",
+ arguments=[
+ "/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock",
+ ],
+ output="screen",
+ )
+
ld = LaunchDescription()
ld.add_action(gazebo_server)
ld.add_action(world_entity_cmd)
+ ld.add_action(gz_ros2_bridge)
return ld
diff --git a/database/worlds.sql b/database/worlds.sql
index 9a8de8d81..0d9fba2d0 100644
--- a/database/worlds.sql
+++ b/database/worlds.sql
@@ -308,28 +308,28 @@ COPY public.scenes (id, name, launch_file_path, tools_config, ros_version, type,
COPY public.robots (id, name, launch_file_path, entity, extra_config) FROM stdin;
1 Ur5 /home/ws/src/CustomRobots/robot_arms/launch/ur5.launch.py ur5_robotiq None
-2 F1 Holonomic Camera /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=holo sensor:=camera
-3 F1 Holonomic Laser /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=holo sensor:=laser
-4 F1 Ackermann Camera /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=ackermann sensor:=camera
-5 F1 Ackermann Laser /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=ackermann sensor:=laser
-6 Autonomous car Camera /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car sensor:=camera
-7 Autonomous car Lidar /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car sensor:=lidar
-8 Autonomous car 3 Lasers /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car sensor:=laser
-9 Vacuum cleaner Laser /home/ws/src/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py vacuum_cleaner sensor:=laser
-10 Vacuum cleaner Camera /home/ws/src/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py vacuum_cleaner sensor:=camera
-11 Quadrotor /home/ws/src/CustomRobots/quadrotor/launch/quadrotor.launch.py drone0 sensor:=camera namespace:=drone0
+2 F1 Holonomic Camera /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=holo sensor:=camera namespace:=f1
+3 F1 Holonomic Laser /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=holo sensor:=laser namespace:=f1
+4 F1 Ackermann Camera /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=ackermann sensor:=camera namespace:=f1
+5 F1 Ackermann Laser /home/ws/src/CustomRobots/f1/launch/f1.launch.py f1 mode:=ackermann sensor:=laser namespace:=f1
+6 Autonomous car Camera /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car sensor:=camera namespace:=autonomous_car
+7 Autonomous car Lidar /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car sensor:=lidar namespace:=autonomous_car
+8 Autonomous car 3 Lasers /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car sensor:=laser namespace:=autonomous_car
+9 Vacuum cleaner Laser /home/ws/src/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py vacuum_cleaner sensor:=laser namespace:=vacuum_cleaner
+10 Vacuum cleaner Camera /home/ws/src/CustomRobots/vacuum_cleaner/launch/vacuum_cleaner.launch.py vacuum_cleaner sensor:=camera namespace:=vacuum_cleaner
+11 Quadrotor /home/ws/src/CustomRobots/quadrotor/launch/quadrotor.launch.py drone sensor:=camera namespace:=drone
12 Rover 4wd /home/ws/src/CustomRobots/rover_4wd/launch/rover_4wd.launch.py rover_4wd noise:=none
13 Holonomic Logistic /home/ws/src/CustomRobots/logistic_holonomic_robot/launch/logistic_holonomic_robot.launch.py logistic_holonomic_robot None
14 Ackermann Logistic /home/ws/src/CustomRobots/logistic_ackermann_robot/launch/logistic_ackermann_robot.launch.py logistic_ackermann_robot None
-15 TurtleBot 2 /home/ws/src/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py turtlebot2 sensor:=camera
-16 TurtleBot 2 Stereo /home/ws/src/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py turtlebot2 sensor:=stereo
-17 Turtlebot 3 /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 None
-18 Autonomous holonomic car /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car mode:=holonomic
+15 TurtleBot 2 /home/ws/src/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py turtlebot2 sensor:=camera namespace:=turtlebot2
+16 TurtleBot 2 Stereo /home/ws/src/CustomRobots/Turtlebot2/launch/turtlebot2.launch.py turtlebot2 sensor:=stereo namespace:=turtlebot2
+17 Turtlebot 3 /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 namespace:=turtlebot3
+18 Autonomous holonomic car /home/ws/src/CustomRobots/autonomous_car/launch/autonomous_car.launch.py autonomous_car mode:=holonomic namespace:=autonomous_car
19 Rover 4wd Low Noise /home/ws/src/CustomRobots/rover_4wd/launch/rover_4wd.launch.py rover_4wd noise:=low
20 Rover 4wd High Noise /home/ws/src/CustomRobots/rover_4wd/launch/rover_4wd.launch.py rover_4wd noise:=high
-21 Turtlebot 3 Low Noise /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 noise:=low
-22 Turtlebot 3 Medium Noise /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 noise:=med
-23 Turtlebot 3 High Noise /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 noise:=high
+21 Turtlebot 3 Low Noise /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 noise:=low namespace:=turtlebot3
+22 Turtlebot 3 Medium Noise /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 noise:=med namespace:=turtlebot3
+23 Turtlebot 3 High Noise /home/ws/src/CustomRobots/turtlebot3/launch/turtlebot3.launch.py turtlebot3 noise:=high namespace:=turtlebot3
24 Ur5 Camera /home/ws/src/CustomRobots/robot_arms/launch/ur5.launch.py ur5_robotiq sensor:=camera
25 Ur3 /home/ws/src/CustomRobots/robot_arms/launch/ur3.launch.py ur3_robotiq None
26 Ur3 Camera /home/ws/src/CustomRobots/robot_arms/launch/ur3.launch.py ur3_robotiq sensor:=camera
diff --git a/jderobot_drones/launch/as2_default_classic_gazebo.launch.py b/jderobot_drones/launch/as2_default_classic_gazebo.launch.py
deleted file mode 100644
index 99b8c9f67..000000000
--- a/jderobot_drones/launch/as2_default_classic_gazebo.launch.py
+++ /dev/null
@@ -1,112 +0,0 @@
-"""Launch file for Aerostack2 default classic Gazebo."""
-
-import os
-from ament_index_python.packages import get_package_share_directory
-from launch import LaunchDescription
-from launch.actions import (
- IncludeLaunchDescription,
- DeclareLaunchArgument,
- ExecuteProcess,
-)
-from launch.launch_description_sources import PythonLaunchDescriptionSource
-from launch.substitutions import LaunchConfiguration
-
-
-def generate_launch_description():
- """Launch micro_xrce and aerostack2 nodes."""
- # If needed
- # rviz_config = os.path.join(os.getcwd(), 'swarm_config.rviz')
- # print(f'{os.path.isfile(rviz_config)=}')
- micro_xrce_cmd = ["MicroXRCEAgent", "udp4", "-p", "8888"]
-
- micro_xrce = ExecuteProcess(cmd=micro_xrce_cmd, output="screen")
-
- sim_config = os.path.join(
- get_package_share_directory("jderobot_drones"), "sim_config/px4_classic"
- )
-
- aerial_platform = IncludeLaunchDescription(
- PythonLaunchDescriptionSource(
- [
- os.path.join(
- get_package_share_directory("as2_platform_pixhawk"), "launch"
- ),
- "/pixhawk_launch.py",
- ]
- ),
- launch_arguments={
- "namespace": LaunchConfiguration("namespace"),
- "use_sim_time": "false",
- "simulation_config_file": LaunchConfiguration("world_file"),
- "platform_config_file": sim_config + "/platform_config.yaml",
- }.items(),
- )
- state_estimator = IncludeLaunchDescription(
- PythonLaunchDescriptionSource(
- [
- os.path.join(
- get_package_share_directory("as2_state_estimator"), "launch"
- ),
- "/state_estimator_launch.py",
- ]
- ),
- launch_arguments={
- "namespace": LaunchConfiguration("namespace"),
- "use_sim_time": "false",
- "plugin_name": "raw_odometry",
- "plugin_config_file": sim_config + "/state_estimator_odom.yaml",
- }.items(),
- )
- motion_controller = IncludeLaunchDescription(
- PythonLaunchDescriptionSource(
- [
- os.path.join(
- get_package_share_directory("as2_motion_controller"), "launch"
- ),
- "/controller_launch.py",
- ]
- ),
- launch_arguments={
- "namespace": LaunchConfiguration("namespace"),
- "use_sim_time": "false",
- "motion_controller_config_file": sim_config + "/motion_controller.yaml",
- "plugin_name": "pid_speed_controller",
- "plugin_config_file": sim_config + "/pid_speed_controller.yaml",
- }.items(),
- )
- _behaviors = IncludeLaunchDescription( # noqa: F841
- PythonLaunchDescriptionSource(
- [
- os.path.join(
- get_package_share_directory("as2_behaviors_motion"), "launch"
- ),
- "/motion_behaviors_launch.py",
- ]
- ),
- launch_arguments={
- "namespace": LaunchConfiguration("namespace"),
- "use_sim_time": "false",
- "takeoff_plugin_name": "takeoff_plugin_position",
- "go_to_plugin_name": "go_to_plugin_position",
- "follow_path_plugin_name": "follow_path_plugin_position",
- "land_plugin_name": "land_plugin_speed",
- }.items(),
- )
-
- return LaunchDescription(
- [
- DeclareLaunchArgument(
- "namespace", default_value="drone0", description="Drone namespace."
- ),
- DeclareLaunchArgument(
- "world_file",
- default_value=sim_config + "/world.json",
- description="json world file",
- ),
- micro_xrce,
- aerial_platform,
- state_estimator,
- motion_controller,
- # behaviors
- ]
- )
diff --git a/jderobot_drones/launch/as2_default_gazebo_sim.launch.py b/jderobot_drones/launch/as2_default_gazebo_sim.launch.py
index b8012f83d..adbe441fb 100644
--- a/jderobot_drones/launch/as2_default_gazebo_sim.launch.py
+++ b/jderobot_drones/launch/as2_default_gazebo_sim.launch.py
@@ -114,7 +114,7 @@ def generate_launch_description():
# ground. so force sim time on for everything we start here.
SetParameter(name="use_sim_time", value=True),
DeclareLaunchArgument(
- "namespace", default_value="drone0", description="Drone namespace."
+ "namespace", default_value="drone", description="Drone namespace."
),
DeclareLaunchArgument(
"cmd_vel_topic",