Skip to content

[Feature Request] Custom Mavlink messages on Python #739

Open

Description

@kripper

I'm writing a Dronekit wrapper to make it easier to migrate Dronekit apps and use MAVSDK.

  1. There are many Mavlink msgs that are not supported.
    For example, how can we send a MAV_FRAME_LOCAL_NED msg with MAVDK?
msg = self.vehicle.message_factory.set_position_target_local_ned_encode(
	0,

	0,          # SysId
	0,          # CompId

	mavutil.mavlink.MAV_FRAME_LOCAL_NED,          # frame
	0b111,          # mask (ignore x,y,z)

	0,	        # x
	0,	        # y
	0,          # z

	vx, 		# vx
	vy,		    # vy
	vz,         # vz

	0,          # afx
	0,          # afy
	0,          # afz

	0,          # yaw
	yawRate,          # yaw rate
)
self.vehicle.send_mavlink(msg)
self.vehicle.flush()
  1. Is there any way to send a custom message built with message_factory through the MAVSDK connection?
    This would be very handy (feature request).

Activity

  1. julianoes commented on Dec 9, 2024

    @julianoes
    Collaborator

    MAVSDK in C++ allows for any message to be sent using the MavlinkPassthrough plugin. However, since that pulls in the MAVLink C headers, that's not currently supported in the language wrappers such as Python.

    My plan is to add support for any messages in v4 (v3 is about to come out). It will allow to set and send custom messages at runtime, rather than compile time, along the lines of:

    message = mavlink_passthrough.create_message("MESSAGE_NAME")
    message.set_field_float("altitude", 1.0)
    mavlink_passthrough.send_message(message)
    ...
    
    Now for your request, have you looked into the offboard plugin? I think it has an API that is pretty close to it:
    https://github.com/mavlink/MAVSDK/blob/bc0da1ea516bb0a015052aca1bf224cb2bd93326/src/mavsdk/plugins/offboard/offboard_impl.cpp#L381-L423
    
  2. kripper commented on Dec 9, 2024

    @kripper
    Author

    Yes, I'm using offboard and I think I can live with some missing Mavlink messages for now.

  3. changed the title [-]Moving from Dronekit to MAVSDK[/-] [+][Feature Request] Custom Mavlink messages on Python[/+] on Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions