i am trying to send a custom mavlink message from my companion raspberry pi to my pixhawk. In order to set this up on the pixhawk I followed the guide on the website (https://dev.px4.io/en/middleware/mavlink.html).
This is the custom mavlink message I want to send to the pixhawk from the pi: https://pastebin.com/6k5ySmyJ
After following the guide the code compiles. If I understand the guide correctly I can now send the custom message from my pi to the pixhawk and it will receive it and publish it to the new uORB topic.
So I only have to send the message over mavlink. Here is the problem i think since I don’t really know how to send custom messages with pymavlink. Right now I am using this code:
# open connection to pixhawk mavs = mavutil.mavlink_connection("/dev/ttyS0", baud=921600) # wait for the heartbeat message to find the system id mavs.wait_heartbeat() # send auv data while(True): mavs.mav.command_long_send(mavs.target_system, mavs.target_component, command=213, confirmation=0, param1=1, param2=1, param3=1, param4=1, param5=1, param6=1, param7=1)
The codes executes fine so the message is being send I think but it does not seem to reach the pixhawk. I wrote a simple app to publish the uORB topic on the pixhawk and nothing seems to arrive there.
Can someone help me with this? Is the problem that the mav.command_long_send() function can not be used for this? Do i need to extend the pymavlink library by my own function and if so how do I do this?
Thanks for your help