Skip to content

Commit c2f500a

Browse files
195 panther add collision monitoring to the panther (#203)
Add collision monitoring to the panther --------- Signed-off-by: Max Waterhout <[email protected]> Signed-off-by: Jelmer de Wolde <[email protected]> Co-authored-by: Jelmer de Wolde <[email protected]> Co-authored-by: Jelmer de Wolde <[email protected]>
1 parent 0dece93 commit c2f500a

File tree

16 files changed

+754
-191
lines changed

16 files changed

+754
-191
lines changed

docs/content/panther.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ A map should be visualized in Rviz and be updated when driving around.
154154
ros2 launch rcdt_panther panther.launch.py collision_monitor:=True
155155
```
156156

157-
Next, start the collision monitor in a second terminal:
158-
159-
```bash
160-
ros2 launch rcdt_panther collision_monitor.launch.py
161-
```
162-
163157
Rviz should visualize "slow-down" regions around the Panther and the Panther should slow down when objects are in these regions.
164158

165159
**Navigation:**

ros2_ws/src/rcdt_joystick/launch/joystick.launch.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use_sim_arg = LaunchArgument("simulation", True, [True, False])
1212
robots_arg = LaunchArgument("robots", "")
13+
use_collision_monitor_arg = LaunchArgument("collision_monitor", False, [True, False])
1314
scale_speed_arg = LaunchArgument(
1415
"scale_speed", default_value=0.4, min_value=0.0, max_value=1.0
1516
)
@@ -26,6 +27,7 @@ def launch_setup(context: LaunchContext) -> list:
2627
"""
2728
use_sim = use_sim_arg.bool_value(context)
2829
robots = robots_arg.string_value(context).split(" ")
30+
use_collision_monitor = use_collision_monitor_arg.bool_value(context)
2931
scale_speed = scale_speed_arg.float_value(context)
3032

3133
joy = Node(
@@ -62,12 +64,16 @@ def launch_setup(context: LaunchContext) -> list:
6264
namespace="franka",
6365
)
6466

67+
pub_topic = (
68+
"/panther/cmd_vel" if not use_collision_monitor else "/panther/cmd_vel_raw"
69+
)
70+
6571
joy_to_twist_panther = Node(
6672
package="rcdt_joystick",
6773
executable="joy_to_twist.py",
6874
parameters=[
6975
{"sub_topic": "/panther/joy"},
70-
{"pub_topic": "/panther/cmd_vel"},
76+
{"pub_topic": pub_topic},
7177
{"config_pkg": "rcdt_panther"},
7278
{"scale": 1.0 if use_sim else scale_speed},
7379
],
@@ -97,6 +103,7 @@ def generate_launch_description() -> LaunchDescription:
97103
[
98104
use_sim_arg.declaration,
99105
robots_arg.declaration,
106+
use_collision_monitor_arg.declaration,
100107
scale_speed_arg.declaration,
101108
OpaqueFunction(function=launch_setup),
102109
]

ros2_ws/src/rcdt_panther/config/collision_monitor.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-FileCopyrightText: Alliander N. V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Based on: https://docs.nav2.org/configuration/packages/configuring-behavior-server.html
6+
7+
behavior_server:
8+
ros__parameters:
9+
enable_stamped_cmd_vel: true
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# SPDX-FileCopyrightText: Alliander N. V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
## Based on https://docs.nav2.org/tutorials/docs/using_collision_monitor.html
6+
7+
collision_monitor:
8+
ros__parameters:
9+
base_frame_id: "panther/base_footprint"
10+
odom_frame_id: "panther/odom"
11+
cmd_vel_in_topic: "panther/cmd_vel_raw"
12+
cmd_vel_out_topic: "panther/cmd_vel"
13+
enable_stamped_cmd_vel: True
14+
polygons: ["PolygonSlow", "VelocityPolygonStop"]
15+
16+
PolygonSlow:
17+
type: "polygon"
18+
points: "[[-1.5, 0.9], [1.5, 0.9], [1.5, -0.9], [-1.5, -0.9]]"
19+
action_type: "slowdown"
20+
min_points: 4
21+
slowdown_ratio: 0.7
22+
visualize: True
23+
polygon_pub_topic: "polygon_slower"
24+
enabled: True
25+
26+
VelocityPolygonStop:
27+
type: "velocity_polygon"
28+
action_type: "stop"
29+
min_points: 6
30+
visualize: True
31+
enabled: True
32+
polygon_pub_topic: "velocity_polygon_stop"
33+
velocity_polygons: ["rotation", "translation_forward", "translation_backward", "stopped"]
34+
holonomic: false
35+
36+
rotation:
37+
points: "[[0.65, 0.65], [0.65, -0.65], [-0.65, -0.65], [-0.65, 0.65]]"
38+
linear_min: 0.0
39+
linear_max: 0.05
40+
theta_min: -1.0
41+
theta_max: 1.0
42+
43+
translation_forward:
44+
points: "[[0.90, 0.65], [0.90, -0.65], [-0.50, -0.65], [-0.50, 0.65]]"
45+
linear_min: 0.0
46+
linear_max: 1.0
47+
theta_min: -1.0
48+
theta_max: 1.0
49+
50+
translation_backward:
51+
points: "[[0.50, 0.65], [0.50, -0.65], [-0.90, -0.65], [-0.90, 0.65]]"
52+
linear_min: -1.0
53+
linear_max: 0.0
54+
theta_min: -1.0
55+
theta_max: 1.0
56+
57+
stopped:
58+
points: "[[0.60, 0.60], [0.60, -0.60], [-0.60, -0.60], [-0.60, 0.60]]"
59+
linear_min: -1.0
60+
linear_max: 1.0
61+
theta_min: -1.0
62+
theta_max: 1.0
63+
64+
observation_sources: ["pointcloud"]
65+
pointcloud:
66+
type: "pointcloud"
67+
topic: "/velodyne/scan/points"
68+
min_height: 0.1
69+
max_height: 1.0
70+
enabled: True

ros2_ws/src/rcdt_panther/launch/collision_monitor.launch.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

ros2_ws/src/rcdt_panther/launch/core.launch.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from rcdt_utilities.launch_utils import (
99
SKIP,
1010
LaunchArgument,
11+
LaunchPosition,
1112
get_file_path,
1213
get_robot_description,
1314
)
@@ -17,6 +18,7 @@
1718
child_arg = LaunchArgument("child", "", ["", "franka", "velodyne"])
1819
load_gazebo_ui_arg = LaunchArgument("load_gazebo_ui", False, [True, False])
1920
world_arg = LaunchArgument("world", "empty_camera.sdf")
21+
panther_xyz_arg = LaunchArgument("panther_xyz", "0,0,0.2")
2022

2123

2224
def launch_setup(context: LaunchContext) -> list:
@@ -32,6 +34,7 @@ def launch_setup(context: LaunchContext) -> list:
3234
child = child_arg.string_value(context)
3335
load_gazebo_ui = load_gazebo_ui_arg.bool_value(context)
3436
world = world_arg.string_value(context)
37+
panther_xyz = LaunchPosition(panther_xyz_arg.string_value(context))
3538

3639
namespace = "panther"
3740
frame_prefix = namespace + "/" if namespace else ""
@@ -50,10 +53,11 @@ def launch_setup(context: LaunchContext) -> list:
5053
)
5154

5255
robots = ["panther"]
53-
positions = ["0,0,0.2"]
56+
positions = [panther_xyz.string]
5457
if child == "velodyne":
5558
robots.append("velodyne")
56-
positions.append("0.13,-0.13,0.55")
59+
velodyne_relative_position = [0.13, -0.13, 0.55]
60+
positions.append(panther_xyz.absolute(velodyne_relative_position))
5761
robot = RegisteredLaunchDescription(
5862
get_file_path("rcdt_gazebo", ["launch"], "gazebo_robot.launch.py"),
5963
launch_arguments={
@@ -83,6 +87,7 @@ def generate_launch_description() -> LaunchDescription:
8387
child_arg.declaration,
8488
load_gazebo_ui_arg.declaration,
8589
world_arg.declaration,
90+
panther_xyz_arg.declaration,
8691
OpaqueFunction(function=launch_setup),
8792
]
8893
)

0 commit comments

Comments
 (0)