-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Mavlink/Pixhawk controller and drivetrain parts #1038
base: main
Are you sure you want to change the base?
Conversation
- #1036 - mavlink.py includes MavlinkController throttle/steering input and MavlinkDriver for the drivetrain.
@@ -0,0 +1,206 @@ | |||
#!/usr/bin/env python3 |
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 shouldn't be run as main, so probably delete the shebang
@@ -0,0 +1,206 @@ | |||
#!/usr/bin/env python3 | |||
from __future__ import print_function |
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.
Pls remove we are in py3.X
|
||
import time | ||
import donkeycar as dk | ||
import config as cfg |
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 line fails, pls see the CI output.
print("PySerial not found. Please install: pip install pyserial") | ||
|
||
try: | ||
from pymavlink import mavutil |
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 test probably doesn't make sense as a pytest, if it can only be run where the corresponding part can be installed as well. Better to make this a main()
method in the mavlink.py
module.
@@ -0,0 +1,266 @@ | |||
#!/usr/bin/env python3 | |||
from __future__ import print_function |
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.
Pls remove, we are on py3.X
If you're getting a permissions error on the USB port: "sudo chmod 666 /dev/ttyACM0" | ||
|
||
requires: | ||
--gcc (sudo apt install gcc) |
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 believe this is installed on all our platforms.
requires: | ||
--gcc (sudo apt install gcc) | ||
--pymavlink (pip install pymavlink) | ||
--docopt (pip install docopt) |
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.
Docent is part of donkey dependencies.
Driver to read MAVLink RC data from a Pixhawk, for manual control | ||
''' | ||
|
||
def __init__(self, cfg, debug=False): |
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.
Logging should be set on a global level and then using the logging
module like in other parts.
return | ||
else: | ||
if msg.get_type() == "ATTITUDE": | ||
print ("pitch", round(msg.pitch,2), "roll", round(msg.roll,2), "yaw", round(msg.yaw,2), "pitchspeed", round(msg.pitchspeed,2), "rollspeed", round(msg.rollspeed,2), "yawspeed", round(msg.yawspeed,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.
... Like here, these should be logger outputs.
while True: | ||
try: | ||
self.read_serial() | ||
except: |
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 to only catch the serial error.
throttle/steering input and MavlinkDriver for
the drivetrain.