Open QuangKhoi-RTR opened 3 years ago
Hi, i'm currently working on a project who has a similar error with Dronekit (besides, i'm using Intel Realsense T265). How do you fix those problem? I'm very glad to hear it
Hi @nandard , it turns out that the Dronekit can't handle the heartbeat message from the gimbal and confused. I solved the issue by using pymavlink directly and pick the heartbeat from the drone.
Hi @nandard , it turns out that the Dronekit can't handle the heartbeat message from the gimbal and confused. I solved the issue by using pymavlink directly and pick the heartbeat from the drone.
Could you specify about "using pymavlink directly and pick the hearbeat from the drone" ? I'm really need your help, please. Thanks
That means I'm not using Dronekit anymore, but instead using pymavlink lib to connect to the drone and get the messages I need.:
from pymavlink import mavutil
# Init connection
connection_string = 'tcp:192.168.0.210:20002'
master = None
while master is None:
try:
print("mavlink connecting")
master = mavutil.mavlink_connection(connection_string)
time.sleep(0.1)
except KeyboardInterrupt:
print("exit")
sys.exit(0)
except:
pass
print("Heartbeat from system (system %u component %u)" % (master.target_system, master.target_system)) # <<<< I used system and component IDs to seperate messages from the drone and gimbal.
# Get the messages
msg = None
while not msg:
master.mav.request_data_stream_send(0, 0, mavutil.mavlink.MAV_DATA_STREAM_ALL, # request data stream replace position = all for all msg
10), 1) # rate = 10, turn on = 1
msg = master.recv_match()
time.sleep(0.01)
print(msg)
That means I'm not using Dronekit anymore, but instead using pymavlink lib to connect to the drone and get the messages I need.:
from pymavlink import mavutil # Init connection connection_string = 'tcp:192.168.0.210:20002' master = None while master is None: try: print("mavlink connecting") master = mavutil.mavlink_connection(connection_string) time.sleep(0.1) except KeyboardInterrupt: print("exit") sys.exit(0) except: pass print("Heartbeat from system (system %u component %u)" % (master.target_system, master.target_system)) # <<<< I used system and component IDs to seperate messages from the drone and gimbal. # Get the messages msg = None while not msg: master.mav.request_data_stream_send(0, 0, mavutil.mavlink.MAV_DATA_STREAM_ALL, # request data stream replace position = all for all msg 10), 1) # rate = 10, turn on = 1 msg = master.recv_match() time.sleep(0.01) print(msg)
Thanks a lot man. So basically there's no error message and everything works well by using pymavlink connection, is it? What's the different between using pymavlink and dronekit in drone's programming?
Hi, I tried to connect to my quadcopter which is connected to a mavlink controlled gimbal and receive this error:
ERROR:dronekit:Exception in message handler for HEARTBEAT
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\dronekit-2.9.2-py3.9.egg\dronekit__init.py", line 1559, in notify_message_listeners
fn(self, name, msg)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\dronekit-2.9.2-py3.9.egg\dronekit\init__.py", line 1251, in listener
raise APIException("mode (%s, %s) not available on mavlink definition" % (m.custom_mode, m.base_mode)) dronekit.APIException: mode (0, 64) not available on mavlink definition
My program:
When disconnect the gimbal camera, everything works fine.