Replies: 1 comment
-
|
That's probably an old pipenv with new Python. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I am doing a project to connect drone with microcontroller Betaflight STM32F7x2 with python code. After some trials, I succeed detect the serial port with STM but it failed to connect like normal. My target is simple, to connect the STM, get battery value and simple motor activation.
I have tried with dronekit library, but the error showed as line below
class Parameters(collections.MutableMapping, HasObservers):
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'
-------------ori code----------
from dronekit import connect
vehicle = connect('COM6', wait_ready=True)
print("Mode: %s" % vehicle.mode.name)
Besides, I have tried also with pymavlink, the error is different:
Serial port COM6 opened successfully.
Error establishing MAVLink connection: invalid literal for int() with base 10: 'COM6'
------------ori code-----------
import serial
from pymavlink import mavutil
def mavlink_connection(port, baudrate):
try:
connection = serial.Serial(port, baudrate)
# Create MAVLink connection
print(f"Serial port {port} opened successfully.")
mavlink_connection = mavutil.mavlink_connection('serial:' + port, baud=baudrate)
print("MAVLink connection established.")
return mavlink_connection
except Exception as e:
print(f"Error establishing MAVLink connection: {e}")
return None
if name == "main":
# Serial port settings
port = 'COM6'
baudrate = 115200
# Establish MAVLink connection
mavlink_conn = mavlink_connection(port, baudrate)
if mavlink_conn:
# Request heartbeat
mavlink_conn.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS, mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)
Please comments if you any idea to solve it. Firstly for the connection. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions