-
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
469 task rewrite thruster interface #492
Conversation
…erly. I still have to figure out how to remove default initialization class field from the header file. Apparently the code was relying on default values for default constructor and so on on multiple levels, including constructor default values, class default values, declare_parameter default values creating a total mess. Removed almost all of them, i'm not able to remove the last one: driver class default params. If I do, i get a compilation error saying that my constructor called from outside doesnt match with the constructor specified in the class? idk. But somehow executes my constructor because substitutes the default values, but if i call only mine, doesnt compile. BOH. Mi sa che vado a letto ciao.
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.
Remove the python package and change the name of the new cpp package back to the original name
...uster_interface_auv_cpp/include/thruster_interface_auv_cpp/thruster_interface_auv_driver.hpp
Outdated
Show resolved
Hide resolved
...thruster_interface_auv_cpp/include/thruster_interface_auv_cpp/thruster_interface_auv_ros.hpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
...thruster_interface_auv_cpp/include/thruster_interface_auv_cpp/thruster_interface_auv_ros.hpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_ros.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_ros.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_ros.cpp
Outdated
Show resolved
Hide resolved
Also update the thrust_update_rate: 10.0 # [Hz] in orca.yaml |
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.
First pass of the C++ stuff.
As a general note, you might want to remove most of the inline comments. As a general rule of thumb, you should have a very good reason for adding inline codes (if you can't avoid some bit magic or some specific equation etc), as the code itself should do the explaining: Comments may lie (and/or become outdated), but the code wont!
This can most notably be seen in the suggestions to use std::algorithm, as that makes things a lot more explicit (especially when defining the lambdas outside the algorithm call and giving it a fitting name!
Also note that the suggestions here are free-balled, so make sure everything compiles and works as expected 😅
...uster_interface_auv_cpp/include/thruster_interface_auv_cpp/thruster_interface_auv_driver.hpp
Outdated
Show resolved
Hide resolved
...uster_interface_auv_cpp/include/thruster_interface_auv_cpp/thruster_interface_auv_driver.hpp
Outdated
Show resolved
Hide resolved
...uster_interface_auv_cpp/include/thruster_interface_auv_cpp/thruster_interface_auv_driver.hpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv_cpp/src/thruster_interface_auv_driver.cpp
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.
Almost there now. As mention in one of the comments I think it will be a good idea to remove the timer callback and just send pwm in the thruster_forces subscriber callback instead. The cpp part looks good enough for me, but I will let @chrstrom be the final judge for that.
motion/thruster_interface_auv/include/thruster_interface_auv/thruster_interface_auv_ros.hpp
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv/launch/thruster_interface_auv.launch.py
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv/thruster_interface_auv/__init__.py
Outdated
Show resolved
Hide resolved
motion/thruster_interface_auv/thruster_interface_auv/thruster_interface_auv_node.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.
I unresolved the comment regarding the debug publisher from my previous review. The publisher should only publish when we actually want to debug.
Also I had to include:
#include
#include
in order to compile pwm_to_i2c_data
I got this error squiggle in vscode:
function "ThrusterInterfaceAUVDriver::pwm_to_i2c_data" returns incomplete type "std::array<uint8_t, 2UL>" (aka "std::array<unsigned char, 2UL>")C/C++(409)
Although seems like the automated build process didn't encounter this so not sure if it should be a concern
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.
aim to test the code on Orca on Friday or Sunday and then merge into develop after
No description provided.