About running python script in mavproxy

I want to send a serial data to the arducopter telem2 port through mavproxy which is connected to copter through usb. I configured the telem2 port by mavproxy commands module load serial, serial set port telem2 and serial send "my string", everything goes fine  and i am able to see data in the telem2 port also.

But i want to send the data to the copter from a python script instead of sending from the mavproxy console.I written a python script for udp communication with same port in which mavproxy out port specified. Can someone assist me?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hello Stephen,

    I am trying to achieve something similar but without Mavproxy.

    I am trying to send MAV commands to Pixhawk through a python script via the serial port. Currently, I do not have the hardware. I am wondering if this can be tested in simulation. I am using jmavsim with PX4 .

    I would be really grateful if you could provide any sort of guidance regarding this.



    Stephen Dade said:

    Mission Planner (like all GCS's) sends heartbeat messages to the UAV. Not sure if there's a way to disable it.

    Why do you require Mission Planner between the UAV and MAVProxy? MAVProxy can talk directly to the UAV.

    I had a quick look at your script - MAVProxy takes mavlink commands through the --out destinations, not console commands.

  • Mission Planner (like all GCS's) sends heartbeat messages to the UAV. Not sure if there's a way to disable it.

    Why do you require Mission Planner between the UAV and MAVProxy? MAVProxy can talk directly to the UAV.

    I had a quick look at your script - MAVProxy takes mavlink commands through the --out destinations, not console commands.

  • Does the mission planner sending any heartbeat message to the copter through mavproxy? If sending, is it possible to stop heartbeat msg sending from mission planner and communicate with copter through mavproxy without checking for heartbeat from mission planner?

  • Has you told i used events in python to run a specific function, its working fine. And i am able to see the data transmitted from udp in the configured serial port of copter which is transmitted through mavproxy. But the problem is, the Mission planner communication is shutting down when i am transmitting the udp data continuously from the udp script.The udp script file named UDP_rec.py is attached down. I am running the mavproxy with the following command mavproxy.py --master="com14",57600 --out=udp:192.168.2.16:14550 --out=udp:192.168.2.16:14540. I opened two udp-out ports. Port14550 is for communicating with mission planner and the port 14540 is to communicate with UDP_rec.py script.

    UDP_rec.py

  • You can use events in Python to run a specific function when data is received over serial or UDP, instead of checking continuously. It's more complex to build this way though.

    You can get MAVProxy to automatically load your module on startup by using the --load-module startup option: http://ardupilot.github.io/MAVProxy/html/getting_started/starting.h...

    Startup Options — MAVProxy 1.6.4 documentation
  • Even if i create new mavproxy module also i need to enter those commands in the mavproxy console. But i want like whenever data sent through serial/udp from other pc has to be received in mavproxy and that data has to be send to the copter.

  • Has you told, i edited in mavproxy_serial.py file. I opened new com port(com3) in init function and its opened successfully. Now i will send some data in serial software from pc with the same com port(com3) which is opened and i want that data to be transmitted to the copter. For this to happen the python module which is loaded has to check continuously for the data in port (com3). Is this is the correct way to do? Is it possible to run a mavproxy module to check continuously for the data in port (com3)? Please help me i dont have any idea about this.

  • Thanks. I will check by creating a new MAVProxy module.

  • That is definitely possible. You will need to write a MAVProxy module to do so. I recommend starting with a copy of the serial module (linked in my previous reply) and editing it from there.

    There's some documentation on developing MAVProxy modules at http://ardupilot.github.io/MAVProxy/html/development/index.html

    Development — MAVProxy 1.6.4 documentation
  • Thanks for your reply. I want to send data to copter from my own python script which receives data from another pc through tcp or udp and that received data i want to transmit to the copter through mavproxy . Is it possible or not? If possible how can i do?

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
yesterday
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Thursday
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Wednesday
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Wednesday
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Wednesday
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge https://t.co/nZQTff5…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: Another incident: https://t.co/G1pTxQug6B
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: What a great way to connect why @diyrobocars community is so valuable and important! Have to start somewhere @IndyAChallenge…
Oct 23
More…