Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
47 changes: 47 additions & 0 deletions control/velocity_controller_lqr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## 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 file](https://github.com/vortexntnu/vortex-auv/blob/velocity-controller-to-lifecycle/control/velocity_controller_lqr/config/param_velocity_controller_lqr.yaml) file:


#### Launching the package:
1. Navigate to your ros2ws directory then (change your own path after cd or skip first line entirely),
```bash
cd ~/ros2ws/ &&
colcon build --packages-select velocity_controller_lqr &&
source install/setup.bash
```

2. Then simply run the node via the launch file
```bash
ros2 launch velocity_controller_lqr velocity_controller_lqr.launch.py
```

3. You will notice that not much is currently happening, however that is because this is a lifecycle node and you can now transition between the node states through the terminal.

#### 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

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

i_weight: 0.5

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

#Clamp parameter
max_force: 99.5
inertia_matrix: [30.0, 0.6, 0.0, 0.6, 1.629, 0.0, 0.0, 0.0, 1.729]
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 @@ -29,7 +29,7 @@ def generate_launch_description() -> LaunchDescription:
"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",
Expand Down
2 changes: 1 addition & 1 deletion control/velocity_controller_lqr/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>velocity_controller_lqr</name>
<version>1.0.0</version>
<version>0.6.9</version>
<description>Velocity controller package for the AUV Orca</description>
<maintainer email="cyprian.github@gmail.com">cyprian</maintainer>
<license>MIT</license>
Expand Down
Loading