Conversation
3f435c4 to
7724577
Compare
7724577 to
5aa8419
Compare
| return result | ||
|
|
||
|
|
||
| def main(args=None): |
There was a problem hiding this comment.
If the Teensy is unplugged or the port is wrong, Teensy() crashes after ROS is already started. This finally never runs, so ROS is never shut down. (which is fine if the whole process dies, but it breaks if a test or another script catches the error and keeps going)
tldr I think it's safer to set teensy_node = None before the try. In finally, only destroy the node if it was created, and always call rclpy.try_shutdown() after that
|
|
||
| # uint8_t to int8_t conversion for negative values. | ||
| mainsail_angle = packet[2] - 256 if packet[2] >= 128 else packet[2] | ||
| mainsail_angle = ( |
There was a problem hiding this comment.
When we send a sail angle, we send it as-is. When we read it back, we flip it (90 - angle) - I don't remember if this is the intended behavior? @nizhnerk
There was a problem hiding this comment.
Yeah I remember this popping up in sailbot sometime before comp because of a servo issue but it's not right.
|
Changed to draft pending @nizhnerk's code quality changes. |
5aa8419 to
191b192
Compare
191b192 to
a17a3fd
Compare
# Conflicts: # src/sailing/sailing/teensy/teensy_node.py # src/sailing/test/test_teensy_node.py
Summary
Add ROS 2 node for communicating with the Teensy through a serial port. Apologies for the large PR. Most changes are boilerplate and tests; the important changes are in
teensy_node.pyandserial_port.py.Changes
teensy_node.pyandteensy.pyin thesailbotrepo.sailboat_mainROS 2 package, thesailingpackage will containreinforcement_learningandteensysubdirectories.PHYSICAL.MAX_RUDDER_ANGLEconstant being set to -25 instead of -45 causing errors in angle conversion math. For an operational clamp, a separate constant should be used.INFOlogs, the sending and receiving packets logDEBUGlogs that are hidden by default. Warnings on send and receive errors are also throttled to a rate ofWARNING_THROTTLE_SECONDS.Testing
Future Work