Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c3e54ca
feat: converted velocity controller lqr to lifecycle node
Q3rkses Sep 20, 2025
0ea41ab
Changed QOS to match killswitch and refactored some functions to be m…
Q3rkses Sep 20, 2025
3241741
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2025
8d16883
precommit hooks and explicit return values
Q3rkses Sep 20, 2025
c7c72d5
refactored to if guard for easy exit and so precommit hook gets off m…
Q3rkses Sep 20, 2025
90d7488
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2025
0fc0b83
added closing punctuation so pre commit hooks doesn't complain
Q3rkses Sep 20, 2025
3f54490
<feat>: changed some ownership stuff in the controller, and actually …
Q3rkses Sep 21, 2025
d447265
split declare and get functions, removed failing lqr params stuff
Q3rkses Sep 21, 2025
f468c42
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2025
bd32498
what did it cost? everything.
Q3rkses Sep 21, 2025
5cedb95
Merge branch 'main' into velocity-controller-to-lifecycle
Andeshog Sep 23, 2025
0859536
Merge branch 'main' into velocity-controller-to-lifecycle
Andeshog Sep 23, 2025
a5b2185
Merge branch 'main' into velocity-controller-to-lifecycle
Q3rkses Oct 1, 2025
efce34f
made node pull topics from centralized auv_setup param file, velocity…
Q3rkses Oct 1, 2025
7e47a5b
Merge branch 'velocity-controller-to-lifecycle' of github.com:vortexn…
Q3rkses Oct 1, 2025
782f78e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 1, 2025
d93fe58
Merge branch 'main' into velocity-controller-to-lifecycle
Andeshog Oct 2, 2025
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
45 changes: 45 additions & 0 deletions control/velocity_controller_lqr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Overview:
---
Contains the LQR controller package for the AUV Orca. The controller utilizes an LQR optimal controller (imported from the python control library), and controls pitch, yaw and surge. The controller is meant to traverse larger distances.

#### Tuning of Parameters:
To tune parameters look at the config/param_velocity_controller_lqr.yaml file:


#### Launching the package:
```bash
1. inside ros2ws/colcon build --packages-select velocity_controller_lqr
```

```bash
2. Inisde ros2ws/: source install/setup.bash
```

```bash
3. ros2 launch velocity_controller_lqr velocity_controller_lqr.launch.py
```

#### Transitioning between states manually:
The ROS2 node is implemented using lifecycle nodes, which are managed externally by a lifecycle manager i.e a finite state machine. If you want to manually test the node do the following:

**From Unconfigured ---> Inactive**
```bash
ros2 lifecycle set /velocity_controller_lqr_node configure
```

**From Configured ---> Active**
```bash
ros2 lifecycle set /velocity_controller_lqr_node activate
```

**From Active ---> Inactive**
```bash
ros2 lifecycle set /velocity_controller_lqr_node deactivate
```

For the full state diagram you can refer to the figure below, sourced from the official ROS2 Documentation:
![image info](./figures/ros2_transition_diagram.png)


### Theory
---
1 change: 0 additions & 1 deletion control/velocity_controller_lqr/README.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/**:
ros__parameters:
dt: 0.1

topics:
odom_topic: /orca/odom
twist_topic: /dvl/twist
pose_topic: /dvl/pose
guidance_topic: /guidance/los
thrust_topic: /thrust/wrench_input
softwareoperation_topic: /softwareOperationMode
killswitch_topic: /softwareKillSwitch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Topics got moved to auv_setup for centralization 🤓 or are you changing that structure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes yes. centralized government


LQR_params:
q_surge: 75
Expand All @@ -17,6 +25,8 @@

i_weight: 0.5

dt: 0.1

inertia_matrix: [30.0, 0.6, 0.0, 0.6, 1.629, 0.0, 0.0, 0.0, 1.729]

#Clamp parameter
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch_ros.actions import LifecycleNode


def generate_launch_description() -> LaunchDescription:
Expand All @@ -22,20 +22,13 @@ def generate_launch_description() -> LaunchDescription:
"param_velocity_controller_lqr.yaml",
)

topic_file = os.path.join(
get_package_share_directory("auv_setup"),
"config",
"robots",
"orca.yaml",
)

velocity_controller_node = Node(
velocity_controller_node = LifecycleNode(
package="velocity_controller_lqr",
executable="velocity_controller_lqr_node.py",
name="velocity_controller_lqr_node",
namespace="orca",
namespace="",
output="screen",
parameters=[parameter_file, topic_file],
parameters=[parameter_file],
)

return LaunchDescription([velocity_controller_node])
Loading