Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ezward
Copy link
Contributor

@Ezward Ezward commented Aug 23, 2022

- #1036
- mavlink.py includes MavlinkController
  throttle/steering input and MavlinkDriver for
  the drivetrain.
@@ -0,0 +1,206 @@
#!/usr/bin/env python3
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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):
Copy link
Contributor

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))
Copy link
Contributor

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:
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants