-
Notifications
You must be signed in to change notification settings - Fork 21
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
436 task guidance node for autopilot #502
base: main
Are you sure you want to change the base?
Conversation
…ilot' into 436-task-guidance-node-for-autopilot
* ✨ feat: added the submodule for the perception * ci: update clang-formatter and add python-formatter * ci: explicitly checkout branch for black-format commit * Committing black-format changes * chore(pylint): add .pylintrc configuration file * refactor: fix pylint warning W1510 * refactor: fix pylint warning C0116 * refactor: fix pylint warning C0411 * refactor: fix pylint warning R1731 * refactor: fix pylint warning R1705 * refactor: fix pylint warning W1514 * refactor: fix pylint warning C0200 * refactor: fix pylint warning W0611 * refactor: fix pylint warning W0702 * refactor: fix pylint warning C0121 * refactor: fix pylint warning W0107 * refactor: fix pylint warning R1714 * refactor: fix pylint warning C0201 * refactor: fix pylint warning C0303 and W0613 * refactor: fix pylint warning W0621 * refactor: fix pylint warning R0402 * refactor: fix pylint warning W0212 * chore(pylint): update rule adjustments and formatting * style: format code with black * style: format imports with isort * ci: add isort and pylint to Python pipeline * Committing black-format changes * chore: add pyproject.toml for project configuration * ci: update order of pipeline jobs * ci: update pylint job and pylint rules * ci: update which python versions pylint test * ci: update python pipeline to only run on pull_request * refactor: fix pylint warning C0103 * chore: update linting and project configuration rules in .pylintrc and pyproject.toml * Rename files to snake_case * ci: add pipeline for grammar in comments * refactor: fix spelling mistakes in comments * ci: update job codespell_fix to continue on error * refactor: fix spelling mistakes in comments * ci: update pipeline codespell to only have one job * refactor: fix variable naming issues and adjust imports as per review * Committing codespell fixes * refactor: spelling correction * ci: update CI file and job names for consistency * ci: update CI file for more clarity * chore: add codespell configuration and ignore list * chore: add type hints and return types * ci: add mypy.ini for type checking configuration * ci: add mypy type checking workflow * refactor: format code with black * refactor: format all yaml files using prettier * ci: add pipeline for yaml formatting using prettier * ci: update yaml formatting pipeline to run on pull request * refactor: remove deprecated typing * refactor: fix import sorting * ci: remove faulty ci pipelines and combine python pipelines into single file * fix(security): replace subprocess call with safer alternative to remove shell=true * feat: add pre-commit hooks for black, isort, and codespell * ci: update python pipeline to use latest versions * refactor: apply code formatting fixes via pre-commit hooks * ci: split python ci/cd pipelines into multiple files * ci: add ci pipeline for checking style clang-format * refactor: remove unused config file for clang-format * refactor: remove duplicate file * ci: add ci pipeline that tests that codebase can build * refactor: update ci-build pipeline to only run on pull request * refactor: update clang-format config * refactor: apply clang-format * feat: update pipeline to build and run tests * refactor: disable linting checks when running colcon test * refactor: update .pre-commit-config file (#480) * ci: add semver.yaml pipeline and .releaserc configuration * ci: add semver.yaml pipeline and .releaserc configuration * fix: semver pipeline runs when push to main --------- Co-authored-by: Yauhen <[email protected]> Co-authored-by: Black Robot <[email protected]> Co-authored-by: Codespell Robot <[email protected]> Co-authored-by: Sondre Haugen <[email protected]>
…guidance-node-for-autopilot
…node-for-autopilot
…node-for-autopilot
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.
This is a start. Made some general comments. Will go more in-depth after you make these adjustments.
guidance/guidance_los/guidance_los/los_guidance_action_server.py
Outdated
Show resolved
Hide resolved
guidance/guidance_los/guidance_los/los_guidance_action_server.py
Outdated
Show resolved
Hide resolved
guidance/guidance_los/guidance_los/los_guidance_action_server.py
Outdated
Show resolved
Hide resolved
guidance/guidance_los/guidance_los/los_guidance_action_server.py
Outdated
Show resolved
Hide resolved
guidance/guidance_los/guidance_los/los_guidance_action_server.py
Outdated
Show resolved
Hide resolved
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.
You need to fix the changes flagged by the pre-commit hooks! To solve them you need to open a terminal and run:
pip install pre-commit
and then navigate to the vortex-auv directory:
cd vortex-auv
and then run pre-commit hooks on all the files:
pre-commit run --all-files
It will fix some things automatically, but others you have to configure manually! Send me a message if anything is unclear:)
7efa0ce
to
9467bfc
Compare
…texntnu/vortex-auv into 436-task-guidance-node-for-autopilot
for more information, see https://pre-commit.ci
d2ad008
to
6d23e15
Compare
guidance/guidance_los/README.md
Outdated
```latex | ||
[x_e^p] [ cos(π_v) 0 sin(π_v)] [cos(π_h) -sin(π_h) 0] [x^n] | ||
[y_e^p] = [ 0 1 0 ] [sin(π_h) cos(π_h) 0] [y^n] | ||
[z_e^p] [-sin(π_v) 0 cos(π_v)] [ 0 0 1] [z^n] |
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 you can do here instead is use math instead of latex
which is written like
\begin{bmatrix}
x_e^p \\
y_e^p \\
z_e^p
\end{bmatrix}
= \begin{bmatrix}
\cos( \pi_v) & 0 & \sin(\pi_v) \\
0 & 1 & 0 \\
-\sin(\pi_v) & 0 & \cos(\pi_v)
\end{bmatrix}
\cdots
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.
Maybe look at comments, remove some and add some more
topics: | ||
publishers: | ||
los_commands: '/guidance/los' | ||
debug: | ||
reference: '/guidance/debug/reference' | ||
errors: '/guidance/debug/errors' | ||
logs: '/guidance/debug/logs' | ||
subscribers: | ||
odometry: '/orca/odom' | ||
pose: '/dvl/pose' | ||
twist: '/dvl/twist' |
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.
This is now in orca.yaml, recommend adding from there 😄
from dataclasses import dataclass, field | ||
|
||
import numpy as np |
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.
Maybe not have space here?
@dataclass | ||
class State: | ||
x: float = 0.0 | ||
y: float = 0.0 | ||
z: float = 0.0 | ||
pitch: float = 0.0 | ||
yaw: float = 0.0 | ||
surge_vel: float = 0.0 | ||
|
||
def __add__(self, other: "State") -> "State": | ||
return State( | ||
x=self.x + other.x, | ||
y=self.y + other.y, | ||
z=self.z + other.z, | ||
pitch=self.pitch + other.pitch, | ||
yaw=self.yaw + other.yaw, | ||
) | ||
|
||
def __sub__(self, other: "State") -> "State": | ||
return State( | ||
x=self.x - other.x, | ||
y=self.y - other.y, | ||
z=self.z - other.z, | ||
pitch=self.pitch - other.pitch, | ||
yaw=self.yaw - other.yaw, | ||
) | ||
|
||
def as_los_array(self): | ||
return np.array([self.surge_vel, self.pitch, self.yaw]) | ||
|
||
def as_pos_array(self): | ||
return np.array([self.x, self.y, self.z]) | ||
|
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.
This is already in vortex_utils, cough anders cough, maybe look at that.
If you want to keep this maybe rename surge_vel to u to be more correct with marine standard notations
lookahead_distance_min: float = 2.0 | ||
lookahead_distance_max: float = 8.0 | ||
lookahead_distance_factor: float = 1.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.
why is max so high? maybe use 3 as max or else you will get the guidance algorithm looking too far ahead and causing a swing too fast.
nominal_speed: float = 1.0 | ||
min_speed: float = 0.1 |
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.
Orca has max speed of 0.3 m/s, maybe set this down
self.u = msg.twist.twist.linear.x | ||
self.v = msg.twist.twist.linear.y | ||
self.w = msg.twist.twist.linear.z |
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.
name consistence, u or surge_vel
beta_c = self.guidance_calculator.calculate_beta_c( | ||
self.u, self.v, self.w, self.phi, self.pitch, alpha_c | ||
self.state.twist.linear_x, | ||
self.state.twist.linear_y, | ||
self.state.twist.linear_z, | ||
self.state.pose.roll, | ||
self.state.pose.pitch, | ||
alpha_c, | ||
) |
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.
isnt self.state.twist.linear_x,
and self.u
the same? and alpha_c
is here two times
yaw_error = ssa(psi_d - self.state.pose.yaw) | ||
desired_surge = self.guidance_calculator.compute_desired_speed( | ||
yaw_error, self.norm, crosstrack_y | ||
) | ||
unfiltered_commands = State( | ||
surge_vel=self.desired_vel, pitch=theta_d, yaw=psi_d | ||
) | ||
filtered_commands = self.guidance_calculator.apply_reference_filter( | ||
unfiltered_commands | ||
) | ||
return unfiltered_commands | ||
|
||
unfiltered_commands = State() | ||
unfiltered_commands.twist.linear_x = desired_surge | ||
unfiltered_commands.pose.pitch = theta_d | ||
unfiltered_commands.pose.yaw = psi_d | ||
|
||
filtered_commands = self.guidance_calculator.apply_reference_filter( | ||
unfiltered_commands | ||
) | ||
return filtered_commands |
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.
There is something going on here, but idk what it is. Maybe comment?
btw there are two returns here 😄
msg.surge = commands.surge_vel | ||
msg.pitch = commands.pitch | ||
msg.yaw = commands.yaw | ||
self.guidance_cmd_pub.publish(msg) |
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.
Surge_vel or u, you choose
|
||
try: | ||
executor.spin() | ||
except Exception as e: | ||
action_server.get_logger().error(f'Error: {str(e)}') | ||
finally: | ||
action_server.destroy_node() | ||
if rclpy.ok(): | ||
rclpy.shutdown() | ||
|
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.
you can remove the try, if it dosent runt we start again 🤝
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.
Got ya!
6324465
to
1b8e018
Compare
for more information, see https://pre-commit.ci
…texntnu/vortex-auv into 436-task-guidance-node-for-autopilot
e821c91
to
0500bca
Compare
8c3b34d
to
3bf7576
Compare
7a2e900
to
76795e0
Compare
for more information, see https://pre-commit.ci
No description provided.