Skip to content

Commit ab1e33a

Browse files
committed
Merge branch 'main' into dev/eskf_fuse_depth
2 parents 95b70dc + 0530974 commit ab1e33a

115 files changed

Lines changed: 5576 additions & 1535 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ repos:
9090
- id: ament_cpplint
9191
name: ament_cpplint
9292
description: Static code analysis of C/C++ files.
93-
entry: ament_cpplint
93+
entry: bash -c 'out=$(ament_cpplint "$@" 2>&1); rc=$?; printf "%s\n" "$out" | grep -Ev "^Using|Done processing|No problems found"; exit $rc' --
9494
language: system
9595
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
9696
args: [

auv_setup/README.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,64 @@ The config folder contains physical parameters related to the AUV and the enviro
1010
* thrusters: Thruster configs for different thruster types
1111

1212
### Launch
13-
This package contains a launchfile for each specific AUV. Additionally the topside.launch file is to
14-
be used on the topside computer that the joystick is connected to, for ROV operations.
13+
14+
This package contains launchfiles for each specific AUV. Additionally `topside.launch.py` is used on the topside computer that the joystick is connected to, for ROV operations.
15+
16+
```bash
17+
ros2 launch auv_setup topside.launch.py --orientation_mode:=your_argument
18+
```
19+
20+
| Argument | Default | Description |
21+
|---|---|---|
22+
| `orientation_mode` |`euler`| Types to choose from `euler` or `quat` |
23+
24+
25+
26+
**`adaptive`** — launches `dp_adapt_backs_controller` with `reference_filter_dp` (Euler/RPY reference filter). Controller params are loaded from `dp_adapt_backs_controller/config/adapt_params_<drone>.yaml`.
27+
28+
```bash
29+
ros2 launch auv_setup dp.launch.py controller_type:=adaptive drone:=nautilus
30+
```
31+
32+
**`adaptive_quat`** — launches `dp_adapt_backs_controller` with `reference_filter_dp` (Quaternion reference filter). Controller params are loaded from `dp_adapt_backs_controller_quat/config/adapt_params_<drone>.yaml`.
33+
34+
```bash
35+
ros2 launch auv_setup dp_quat.launch.py controller_type:=adaptive drone:=nautilus
36+
```
37+
38+
#### dp.launch.py or dp_quat.launch.py
39+
40+
Both launch the DP (dynamic positioning) stack, consisting of a reference filter and a controller launched together in a composable node container to limit intra process communication and allow for shared memory.
41+
42+
```bash
43+
ros2 launch auv_setup dp.launch.py
44+
```
45+
46+
| Argument | Default | Description |
47+
|---|---|---|
48+
| `drone` | `nautilus` | Drone model — loads `auv_setup/config/robots/<drone>.yaml` |
49+
| `namespace` | `<drone>` | ROS namespace. Defaults to the drone name if left empty |
50+
| `controller_type` | `adaptive` | Controller to use: `adaptive`, `adaptive_quat` or `pid` |
51+
52+
**`adaptive`** — launches `dp_adapt_backs_controller` with `reference_filter_dp` (Euler/RPY reference filter). Controller params are loaded from `dp_adapt_backs_controller/config/adapt_params_<drone>.yaml`.
53+
54+
```bash
55+
ros2 launch auv_setup dp.launch.py controller_type:=adaptive drone:=nautilus
56+
```
57+
58+
**`adaptive_quat`** — launches `dp_adapt_backs_controller` with `reference_filter_dp` (Quaternion reference filter). Controller params are loaded from `dp_adapt_backs_controller_quat/config/adapt_params_<drone>.yaml`.
59+
60+
```bash
61+
ros2 launch auv_setup dp_quat.launch.py controller_type:=adaptive drone:=nautilus
62+
```
63+
64+
**`pid`** — launches `pid_controller_dp` with `reference_filter_dp_quat` (quaternion reference filter). Controller params are loaded from `pid_controller_dp/config/pid_params.yaml`.
65+
66+
```bash
67+
ros2 launch auv_setup dp.launch.py controller_type:=pid drone:=nautilus
68+
```
69+
70+
> When using the joystick to send references, make sure `orientation_mode` in `joystick_interface_auv` matches the controller: use `euler` with `adaptive` and `quat` with `pid`.
1571
1672
### Description
1773
The description folder contains the URDF and xacro files for the AUVs. The main description launch file is drone_description.launch.py, which makes all static transforms available to the ros graph.

auv_setup/auv_setup/launch_arg_common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,15 @@ def resolve_drone_and_namespace(context):
2323
if namespace == "":
2424
namespace = drone
2525
return drone, namespace
26+
27+
28+
def declare_config_type_arg(default_config_type="physical"):
29+
return DeclareLaunchArgument(
30+
"config_type",
31+
default_value=default_config_type,
32+
description="Controller config variant: 'sim' or 'physical'",
33+
)
34+
35+
36+
def resolve_config_type(context):
37+
return LaunchConfiguration("config_type").perform(context)

auv_setup/config/robots/nautilus.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**:
1717
ros__parameters:
1818
physical:
19-
center_of_mass: [0.0, 0.0, 0.01] # CO is aligned with CM Position (x,y) in meters (M), small cg offset in z to keep drone naturally stable in roll/pitch
19+
center_of_mass: [0.0, 0.0, 0.025] # CO is aligned with CM Position (x,y) in meters (M), small cg offset in z to keep drone naturally stable in roll/pitch
2020
mass_matrix: [53.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 53.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 53.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.0628, 1.086, -3.17502, 0.0, 0.0, 0.0, 1.086, 23.1128, 0.1025, 0.0, 0.0, 0.0, -3.17502, 0.1025, 26.23998]
2121
# 6x6 mass_inertia_matrix
2222
propulsion:
@@ -53,22 +53,22 @@
5353
0.00000, # Heave
5454
]
5555
thruster_position: [ # Position (x0,x1 ... x7,y1,y2, ...,y7,z1,z2, ... ,z7) in meters (M). i.e thruster0 has position (x0,y0,z0)
56-
0.413892,
57-
0.140095,
58-
-0.163904,
59-
-0.413892,
60-
-0.413892,
61-
-0.163904,
62-
0.140095,
63-
0.413892, # x-positions of the thrusters
56+
0.45015,
57+
0.24060,
58+
-0.22970,
59+
-0.43861,
60+
-0.43861,
61+
-0.22970,
62+
0.240600,
63+
0.450150, # x-positions of the thrusters
64+
0.305680,
6465
0.313022,
6566
0.313022,
66-
0.313022,
67-
0.313022,
68-
-0.313022,
67+
0.305680,
68+
-0.305680,
6969
-0.313022,
7070
-0.313022,
71-
-0.313022, # y-positions of the thrusters
71+
-0.305680, # y-positions of the thrusters
7272
0.021736,
7373
0.021736,
7474
0.021736,
@@ -80,8 +80,8 @@
8080
]
8181

8282
constraints:
83-
max_force: 40.0
84-
min_force: -40.0
83+
max_force: 39.0
84+
min_force: -41.0
8585
input_matrix_weights: [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
8686
slack_matrix_weights: [2000.0,2000.0,2000.0,2000.0,2000.0,2000.0]
8787

@@ -90,6 +90,10 @@
9090

9191
thrust_update_rate: 100.0 # [Hz]
9292
watchdog_timeout: 1.0 # [s]
93+
thruster_to_pin_mapping: [4, 5, 7, 6, 0, 1, 2, 3] # I.e. if thruster_to_pin = [ 7, 6, 5, 4, 3, 2, 1, 0 ] then thruster 0 is pin 1 etc..
94+
thruster_direction: [-1, -1, 1, 1, -1, -1, 1, 1] # Disclose during thruster mapping (+/- 1)
95+
thruster_PWM_min: [1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050] # Minimum PWM value, Recommended: [1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100]
96+
thruster_PWM_max: [1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950] # Maximum PWM value, Recommended: [1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900]
9397

9498
topics:
9599
wrench_input: "wrench_input"
@@ -110,7 +114,7 @@
110114
waypoint: "waypoint"
111115
guidance:
112116
los: "guidance/los"
113-
dp: "guidance/dp"
117+
dp_rpy: "guidance/dp_rpy"
114118
dp_quat: "guidance/dp_quat"
115119
dvl_twist: "dvl/twist"
116120
dvl_altitude: "dvl/altitude"

auv_setup/config/robots/orca.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
waypoint: "waypoint"
135135
guidance:
136136
los: "guidance/los"
137-
dp: "guidance/dp"
137+
dp_rpy: "guidance/dp_rpy"
138138
dp_quat: "guidance/dp_quat"
139139
fsm:
140140
active_controller: "fsm/active_controller"

auv_setup/description/nautilus.urdf.xacro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
<joint name="base_to_imu" type="fixed">
1919
<parent link="base_link"/>
2020
<child link="imu_link"/>
21-
<origin xyz="0.0057 0.0 0.0827" rpy="0.0 0.0 0.0"/>
21+
<origin xyz="-0.1 -0.001 0.085" rpy="0.0 0.0 0.0"/>
2222
</joint>
2323

2424
<!-- base to dvl -->
2525
<joint name="base_to_dvl" type="fixed">
2626
<parent link="base_link"/>
2727
<child link="dvl_link"/>
28-
<origin xyz="-0.130 0.003 0.2414" rpy="0.0 0.0 0.0"/>
28+
<origin xyz="-0.130 0.003 0.2414" rpy="0.0 0.0 3.14159"/>
2929
</joint>
3030

3131
<!-- base to pressure sensor -->
@@ -46,7 +46,7 @@
4646
<joint name="base_to_downwards_camera" type="fixed">
4747
<parent link="base_link"/>
4848
<child link="downwards_camera_link"/>
49-
<origin xyz="0.283615 -0.085021 0.094186" rpy="-1.5708 -1.5708 -1.5708"/>
49+
<origin xyz="0.283615 -0.158 0.12" rpy="-1.5708 -1.5708 -1.5708"/>
5050
</joint>
5151
<xacro:flir_blackfly_s frame="downwards_camera_link" base="downwards_camera" name="flir_blackfly"/>
5252

@@ -66,7 +66,7 @@
6666
<joint name="shoulder_joint" type="fixed">
6767
<parent link="base_link"/>
6868
<child link="shoulder"/>
69-
<origin xyz="0.282589 0.07822 0.115803" rpy="0.0 0.0 0.0"/>
69+
<origin xyz="0.282589 0.028 0.115803" rpy="0.0 0.0 0.0"/>
7070
</joint>
7171

7272
<link name="arm"></link>

auv_setup/launch/dp.launch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
from launch_ros.descriptions import ComposableNode
88

99
from auv_setup.launch_arg_common import (
10+
declare_config_type_arg,
1011
declare_drone_and_namespace_args,
12+
resolve_config_type,
1113
resolve_drone_and_namespace,
1214
)
1315

1416

1517
def launch_setup(context, *args, **kwargs):
1618
drone, namespace = resolve_drone_and_namespace(context)
19+
config_type = resolve_config_type(context)
1720

1821
filter_file_path = os.path.join(
1922
get_package_share_directory("reference_filter_dp"),
@@ -31,7 +34,7 @@ def launch_setup(context, *args, **kwargs):
3134
adapt_params = os.path.join(
3235
get_package_share_directory("dp_adapt_backs_controller"),
3336
"config",
34-
f"adapt_params_{drone}.yaml",
37+
f"adapt_params_{drone}_{config_type}.yaml",
3538
)
3639

3740
container = ComposableNodeContainer(
@@ -68,6 +71,7 @@ def generate_launch_description():
6871
return LaunchDescription(
6972
declare_drone_and_namespace_args()
7073
+ [
74+
declare_config_type_arg(),
7175
OpaqueFunction(function=launch_setup),
7276
]
7377
)

auv_setup/launch/dp_quat.launch.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import os
2+
3+
from ament_index_python.packages import get_package_share_directory
4+
from launch import LaunchDescription
5+
from launch.actions import OpaqueFunction
6+
from launch_ros.actions import ComposableNodeContainer
7+
from launch_ros.descriptions import ComposableNode
8+
9+
from auv_setup.launch_arg_common import (
10+
declare_config_type_arg,
11+
declare_drone_and_namespace_args,
12+
resolve_config_type,
13+
resolve_drone_and_namespace,
14+
)
15+
16+
17+
def launch_setup(context, *args, **kwargs):
18+
drone, namespace = resolve_drone_and_namespace(context)
19+
config_type = resolve_config_type(context)
20+
21+
filter_config = os.path.join(
22+
get_package_share_directory("reference_filter_dp_quat"),
23+
"config",
24+
"reference_filter_params.yaml",
25+
)
26+
27+
drone_params = os.path.join(
28+
get_package_share_directory("auv_setup"),
29+
"config",
30+
"robots",
31+
f"{drone}.yaml",
32+
)
33+
34+
adapt_params = os.path.join(
35+
get_package_share_directory("dp_adapt_backs_controller_quat"),
36+
"config",
37+
f"adapt_params_{drone}_{config_type}.yaml",
38+
)
39+
40+
container = ComposableNodeContainer(
41+
name="dp_quat_container",
42+
namespace=namespace,
43+
package="rclcpp_components",
44+
executable="component_container_mt",
45+
composable_node_descriptions=[
46+
ComposableNode(
47+
package="reference_filter_dp_quat",
48+
plugin="ReferenceFilterNode",
49+
name="reference_filter_node",
50+
namespace=namespace,
51+
parameters=[filter_config, drone_params],
52+
extra_arguments=[{"use_intra_process_comms": True}],
53+
),
54+
ComposableNode(
55+
package="dp_adapt_backs_controller_quat",
56+
plugin="DPAdaptBacksControllerNode",
57+
name="dp_adapt_backs_controller_node",
58+
namespace=namespace,
59+
parameters=[adapt_params, drone_params],
60+
extra_arguments=[{"use_intra_process_comms": True}],
61+
),
62+
],
63+
output="screen",
64+
)
65+
66+
return [container]
67+
68+
69+
def generate_launch_description():
70+
return LaunchDescription(
71+
declare_drone_and_namespace_args()
72+
+ [
73+
declare_config_type_arg(),
74+
OpaqueFunction(function=launch_setup),
75+
]
76+
)

0 commit comments

Comments
 (0)