-
Couldn't load subscription status.
- Fork 24
feat: converted velocity controller lqr to lifecycle node #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #585 +/- ##
==========================================
- Coverage 18.77% 18.63% -0.14%
==========================================
Files 38 38
Lines 2376 2372 -4
Branches 426 426
==========================================
- Hits 446 442 -4
Misses 1815 1815
Partials 115 115
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending operation mode as a string is cursed. Should define a vortex msg using enum types.
Is a custom LOS guidance message needed. Custom ros2 messages should only be created when needed. A simple vector3 could accomplish this task. When following the principle of separating business logic from application logic the correct transformation between the ros2 and internal type should be clear enough to follow.
Refactor to cpp pls...
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/config/param_velocity_controller_lqr.yaml
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/velocity_controller_lqr/velocity_controller_lqr_lib.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
…ore clear and concise
for more information, see https://pre-commit.ci
229526a to
c7c72d5
Compare
|
You should take a look at ownership for this project. Does both the controller and node need to own the LQR parameters? Also why has the controller gotten ownership of 'dt' and not the ros node? |
bfd251e to
d447265
Compare
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments 🤓
| 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes yes. centralized government
control/velocity_controller_lqr/launch/velocity_controller_lqr.launch.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
control/velocity_controller_lqr/scripts/velocity_controller_lqr_node.py
Outdated
Show resolved
Hide resolved
|
Make a simulator test (could be just to start up the node in the ros environment and make sure the transitions work, for instance) and add it in this list |
… controller builds but does not run. Need to investigate
…tnu/vortex-auv into velocity-controller-to-lifecycle
for more information, see https://pre-commit.ci
| self.declare_params() | ||
| self.get_logger().info("1") | ||
| self.get_params() | ||
| self.get_logger().info("2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to declare the parameters in the constructor (since it only has to happen once) and use the configure callback to get them?
| self.declare_parameter("LQR_params.q_surge", 0.0) | ||
| self.declare_parameter("LQR_params.q_pitch", 0.0) | ||
| self.declare_parameter("LQR_params.q_yaw", 0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be the same type as what they are in the config file. Currently they are Int. Suggest you stick to float, as all the others are also float.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same goes for propulsion.thrusters.max
| self.declare_parameter("inertia_matrix") | ||
| self.inertia_matrix = self.get_parameter("inertia_matrix").value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs default (or does it? 👀). Turns out you can declare parameters with a type instead of a type instead of passing a default value (makes sense since it uses the default value to deduce the type of the parameter), like this
from rcl_interfaces.msg import ParameterType, ParameterDescriptor
...
self.declare_parameter("inertia_matrix", descriptor=ParameterDescriptor(type=ParameterType.PARAMETER_DOUBLE_ARRAY))The same applies to the rest of the parameter declarations too, like
self.declare_parameter("topics.your_topic", descriptor=ParameterDescriptor(type=ParameterType.PARAMETER_STRING))Personally this clings better than zeros and "_" as defaults 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about defining descriptor=ParameterDescriptor(type=ParameterType.PARAMETER_STRING) as just PARAMETER_STRING maybe in a dataclass or someplace else? Then simply using PARAMETER_STRING so it doesnt take up 90 spaces in one line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better yet, using Parameter from rclpy.parameter just solves this "problem".
from rclpy.parameter import Parameterself.declare_parameter("LQR_params.q_surge", Parameter.Type.INTEGER)
...
q_surge = self.get_parameter("LQR_params.q_surge").valueIf self.get_parameter fails, and you want to handle it, you could use ParameterUninitializedException from rclpy.node to handle it.
Added standalone node testing, which is more fitting for this case, so write a simple script where the node is launched and transitioned to activated, and test that it is able to correctly publish wrench_input (for example). Add the script path to this list: https://github.com/vortexntnu/vortex-auv/blob/main/.github/workflows/ros-node-tests.yml#L17-L19. Suggest that when LOS is consistently performing as expected (tuned or just improved in other ways), the LOS - velocity controller integration test can be reopened. |
made velocity controller into a lifecycle node instead of a normal node for ease of use and to save memory/resources when using the controller in idle mode.