You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm beginning working with mavlink and pymavlink librairies and I think I'm missing some important details to understand all. For debbuging I'm using the mission planner quadcopter stable SITL.
My first problem is that I can only ask for the HOME_POSITION message one time per connection : here is the terminal results :
Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymavlink import mavutil
>>> from pymavlink import mavwp
>>> connection = mavutil.mavlink_connection('tcp:localhost:5762')
>>> connection.wait_heartbeat()
<pymavlink.dialects.v20.ardupilotmega.MAVLink_heartbeat_message object at 0x0000022A931CBE50>
>>> print("Heartbeat from system (system %u component %u)" % (connection.target_system, connection.target_component))
Heartbeat from system (system 1 component 0)
>>> connection.mav.command_long_send(1,0, mavutil.mavlink.MAV_CMD_REQUEST_MESSAGE, 0, 242, 0, 0, 0, 0, 0,0)
>>>
>>> print(connection.recv_match("HOME_POSITION", blocking=True))
HOME_POSITION {latitude : -[353633515](tel:353633515), longitude : 1491652412, altitude : 585050, x : 0.0, y : 0.0, z : 0.0, q : [1.0, 0.0, 0.0, 0.0], approach_x : 0.0, approach_y : 0.0, approach_z : 0.0, time_usec : [818545784](tel:818545784)}
>>> connection.mav.command_long_send(1,0, mavutil.mavlink.MAV_CMD_REQUEST_MESSAGE, 0, 242, 0, 0, 0, 0, 0,0)
>>>
>>> print(connection.recv_match("HOME_POSITION", blocking=True))
HEARTBEAT {type : 2, autopilot : 3, base_mode : 81, custom_mode : 0, system_status : 3, mavlink_version : 3}
>>>
If I restart python terminal (break the mavlink connection) I can ask again the HOME_POSITION without restarting the SITL.
Few other questions :
Where are the mav.command_long_send() or connection.amv.send() functions defined in pymavlink? To understand what they doing I tried to find the source code, but I didn't find it. (Same for all the enums, messages and commands numbers)
How can I disconnect a mavlink connection properly?
I'm trying to answer most of my question with the rare examples and documentation, but need some additional explanations! Thanks for that.
The text was updated successfully, but these errors were encountered:
Hi,
I'm beginning working with mavlink and pymavlink librairies and I think I'm missing some important details to understand all. For debbuging I'm using the mission planner quadcopter stable SITL.
My first problem is that I can only ask for the HOME_POSITION message one time per connection : here is the terminal results :
If I restart python terminal (break the mavlink connection) I can ask again the HOME_POSITION without restarting the SITL.
Few other questions :
I'm trying to answer most of my question with the rare examples and documentation, but need some additional explanations! Thanks for that.
The text was updated successfully, but these errors were encountered: