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 @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
yesterday
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Friday
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Friday
DIY Robocars via Twitter
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Friday
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Friday
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23
DIY Robocars via Twitter
Oct 23
DIY Robocars via Twitter
Oct 19
DIY Robocars via Twitter
Oct 18
DIY Robocars via Twitter
RT @NeaveEng: Calling all UK based folks interested in @diyrobocars, @f1tenth, @donkey_car, and similar robot racing competitions! @hacky_r…
Oct 13
DIY Robocars via Twitter
RT @araffin2: 🏎️ After hours of video editing, I'm happy to share a best of my Twitch videos on learning to race with RL. 🏎️ Each part is…
Oct 13
More…