Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • May 22 22:15
    saminhasan commented #969
  • May 22 22:15
    saminhasan commented #969
  • May 18 09:28
    itzmejawad commented #142
  • May 09 11:06
    rasus51 commented #1003
  • May 05 03:24
    Jai-GAY commented #1139
  • May 05 03:23
    Jai-GAY commented #1139
  • May 05 03:22
    Jai-GAY commented #1139
  • May 05 03:21
    Jai-GAY commented #1150
  • Apr 29 13:12
    CodingGhost commented #677
  • Apr 28 16:10
    zhushd opened #1152
  • Apr 25 08:34
    thanapong-skru commented #946
  • Apr 16 10:42
    Pascal91 commented #151
  • Apr 16 10:28
    Pascal91 commented #1134
  • Apr 15 09:52
    blisshuang edited #1151
  • Apr 15 09:48
    blisshuang opened #1151
  • Apr 12 18:12
    ForrestFire0 commented #829
  • Apr 10 22:59
    hamishwillee commented #156
  • Apr 10 16:13
    developeralioz edited #156
  • Apr 10 16:12
    developeralioz opened #156
  • Apr 03 02:01
    HefnySco commented #95
MohammadAmin Khazaei
Anyone here at all?
MohammadAmin Khazaei

I run this command in the console

python multivehicle.py --simulation-count 2 --extra-connection udpout:localhost:9432

i received the following output :
Creating simulator (SITL) 0 SITL already Downloaded and Extracted. Ready to boot. Creating simulator (SITL) 1 SITL already Downloaded and Extracted. Ready to boot. 0: Launching SITL (['-I0', '--model', 'quad', '--home=-35.363261,149.165230,584,353']) 0: Connecting to its vehicle 1 Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/lib/python3.8/threading.py", line 870, in run self._target(self._args, **self._kwargs) File "multivehicle.py", line 63, in change_sysid_target vehicle = dronekit.connect(connection_string, wait_ready=True, target_system=1) TypeError: connect() got an unexpected keyword argument 'target_system' 1: Launching SITL (['-I1', '--model', 'quad', '--home=-35.363181000000004,149.165230,584,353']) 1: Connecting to its vehicle 1 Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/lib/python3.8/threading.py", line 870, in run self._target(self._args, **self._kwargs) File "multivehicle.py", line 63, in change_sysid_target vehicle = dronekit.connect(connection_string, wait_ready=True, target_system=1) TypeError: connect() got an unexpected keyword argument 'target_system' Waiting for thread... Waiting for thread... Sleeping a little to let SITLs go away... Launching SITLs Starting mavlink_hub thread Hub thread starting Attempting connect to (udpout:localhost:2345) Creating connection (tcp: Creating connection (tcp: Creating connection (udpout:localhost:9432) Creating connection (udpin:localhost:2345) Opening connection to tcp: Opening connection to tcp: Opening connection to udpout:localhost:9432 Opening connection to udpin:localhost:2345 Traceback (most recent call last): File "multivehicle.py", line 117, in <module> mav = dronekit.mavlink.MAVConnection(connection_string) AttributeError: module 'dronekit' has no attribute 'mavlink' Connection (udpout:localhost:9432) timed out Connection (udpin:localhost:2345) timed out Opening connection to udpout:localhost:9432 Opening connection to udpin:localhost:2345 Connection (udpout:localhost:9432) timed out Connection (udpin:localhost:2345) timed out Opening connection to udpout:localhost:9432 Opening connection to udpin:localhost:2345 Connection (udpout:localhost:9432) timed out Connection (udpin:localhost:2345) timed out Opening connection to udpout:localhost:9432 Opening connection to udpin:localhost:2345 Connection (udpout:localhost:9432) timed out Connection (udpin:localhost:2345) timed out Opening connection to udpout:localhost:9432 Opening connection to udpin:localhost:2345

what's the problem ?


Hello, I have problem on communication raspberry pi to pixhawk cube orange with dronekit. When I use Q_Enable_Mode=1 (VTOL Mode) and SERIAL2_BAUD=921, LOG_BACKEND_TYPE=2 SERIAL_PROTOCOL=921 these error appear on rpi 3 ;

“from dronekit import connect
vehicle connect(”/dev/ttyUSB0", wait_ready=True, baud=921600)

raise APIException(“mode (%s, %s) not available on mavlink definition” % (m.custom_mode, m.base_mode))
APIException: mode (11, 89) not available on mavlink definition
ERROR:dronekit:Exception in message handler for HEARTBEAT
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/dronekit/init.py”, line 1531, in notify_message_listeners
fn(self, name, msg)
File “/usr/local/lib/python2.7/dist-packages/dronekit/init.py”, line 1223, in listener

dronekit = 2.9.2
pymavlink = 2.4.9
How can I overcome this issue can you help ?

Note: It doesnt come up when Q_ENABLE = 0.

1 reply
sieuwe elferink
Hi is it possible to connect a apm2.8 board to dronekit using usb?
hello, i want to ask a question i want to draw 8 on quadcopter how can i do it except "goto" function
Hello. I tried to run drone_delivery.py but it runs infinitely at [DEBUG] Polled mode:Guided can someone help me resolve this please?

Hello, I have been trying to run a simple dronekit code but have been running into quite a few problems. Firstly I was unable to change the flight mode using the mavproxy command line and the dronekit code but by adding a snippet in the mavutil.py file I was able to change the code in the mavproxy.py command line. Running dronekit sitl works and changes the modes but when I try to run the same code on the actual drone it give me the following error in dronekit command windows

WARNING:autopilot:Flight mode change failed

and this error in the mavproxy UI

@SohaibAJ Aren’t you using px4 firmware instead of ardupilot on your actual drone?
As dronekit is not compatible with px4 mode switching by default, that might be the case

@mh2024 I am using Arducopter 3.6.12 on my actual drone. I also tried it with 4.0.7 but that did not solve the issue either.

The reason I downgraded to 3.6.12 is because 2 years ago, this exact code worked then. I even tried downgrading dronekit, mavproxy and its dependencies but that gave other problems such as completely refusing to arm. The vehicle.armed always echoed False.

@SohaibAJ sorry,i don’t have any idea on that.
Nearly the same error happened to me at the beginning when i have started to use dronekit but that was an issue of a typo which i’m sure here is not the problem
Nara atthama
hi guys, i'm using raspberry pi 4 as companion computer for pixhawk1
i'm using this code for GUIDED_NOGPS mode https://github.com/dronekit/dronekit-python/blob/master/examples/set_attitude_target/set_attitude_target.py
after my copter armed, instead of taking off it disarmed again
what should i do?
Johar Palacita
Hi guys, do you have any example python code for vtol?
can someone explain to me the difference between dronekit and pymavlink?
Nyyir Soobrattee
This message was deleted
Hello guys, I am a complete noob in general for drones related. I came across a super cool drone flywoo nano hex. I want to use dronekit with it. Is that possible? bellow is a wiring diagram and ports on the F7 board. It has betaflight flashed on it.
Armen Yenokyan
HI everyone. How can I send the DO_CAMERA_CONTROL (long) command dronekit to vehicle?
Armen Yenokyan

Hi ... When i connect to Pixhawk Cube orange through mavproxy.. I get Mode(0x00000000)> error randomly... Further investigation, i found that there is another pi zero connected to the pixhawk through serial 5.

In mavproxy i can solve the issue by doing

mavproxy.py --master=/dev/ttyUSB0 --baudrate=115200 --target-system=1

(just by specifying Pixhawk's target system ID)

however i don't see any option to mention target system ID in vehicle connect of dronekit..

vehicle = connect("/dev/ttyUSB0", baud=115200, target_system=1(some thing like this))

Pls help

I am having trouble getting MAVLink messages using @vehicle.on_message('POSITION_TARGET_LOCAL_NED'), even when I verify via QGC that the flight controller is sending values. 'LOCAL_POSITION_NED' and several other messages are working fine, so I'm stuck. Here is a snippet of my code https://pastebin.com/epqJdDZJ
Gowrishankar P
Critical: autopilot:prearm : throttle below failsafe...
Which code in dronekit print this??
Gowrishankar P
I mean which line...
Nara atthama
As far as i know, it appear because u don't turn on your transmitter, u can disable the radio failsafe
Hello all, has anyone resolved the issue when using a Cube Orange on the ADSB carrier board where dronekit just throws not stop errors regarding: dronekit.APIException: mode (0, 4) not available on mavlink definition
So using raw PyMavlink and dumping the heartbeat yields: <pymavlink.dialects.v10.ardupilotmega.MAVLink_heartbeat_message object at 0x0344CA70>
Welp, as confirmed, Dronekit is dead for Ardupilot 4.x+. It was good while it lasted - I guess.
Sonu Gadewar
So we know that dronekit can also work with px4. So can we use the same python script for both ardu and px4?
sieuwe elferink
Hey someone who can help me with channel overrides. I am having problems with my drone crashing into the ground and then bounce back up again continuously while it should just stay stationary in the air. I have some info and graphs in this github issue dronekit/dronekit-python#1141. thanks
Jaime Machuca
Don’t use channel overrides use command velocity commands. https://mavlink.io/en/messages/common.html#SET_POSITION_TARGET_LOCAL_NED
sieuwe elferink
For my use case that is not possible. I have made an AI model that is trained on my flying behavoir by saving my pwm inputs and traning these to the model. The trained model now directly predicts correct pwm values using a camera image as input. Because they are controls in pwm format I cant accuratly convert these to velocity commands. And since the goal of my project is to train an AI model based on human flight data I cant use velocity because a human uses pwm as control.
Hello there
Newbie here :)
I'm trying to run the simple hello.py check the communication with my #pixhawk and I'm getting this error
I'm running on a #raspberrypi
I really appreciate all your help.
Hi, So what do I buy and how much?
Dulhan Jayalath
Hi, would anyone know why setting RC overrides doesn't seem to work as expected? For example, setting channel 3 to 1600, makes the motors behave as if it's at 2000. I get the same behaviour overriding with MAVProxy directly.
I am aware RC overrides are not recommended, however I have a specific use case where I cannot use GPS.
I want to check the messages sent by the drone in dronekit-python. Of course, I know the guide states that this is hard, and recommends coding defensively. However, the following message is being checked in the terminal when the dronekit-python code is executed.
CRITICAL:autopilot:Initialising APM...
I want to display this message on the Internet window through web socket communication.
How can I use this message?
Hi, I am building an obstacle-avoiding drone in a GPS environment using dronekit and lidar.

I am currently working on building an autonomous drone in the simulation middleware of Gazebo using ROS and drone programming using dronekit API.

I have an Iris Copter model available in SDF format, which I am programming using the Dronekit API. I have integrated a Hokuyo Lidar sensor on the top of the drone from which I get the distances from all the 360 degrees respectively from the ROS topic the sensor generates. In all the values that I get from 360 degrees of direction, I get around 1024 values. I only had to get the values from 90, 180, 270, and 360(or 0). After getting them I fed those values into the script I made in python and somehow made it possible for the drone to avoid obstacles using the drone kit functions that are available.
Now, the problem I am facing is with the integration of the obstacle avoidance system in the waypoint navigation system that is done using Ardupilot (using the map in Ardupilot Plugin / Mission Planner).

How do I make such a project in which the drone tends to move autonomously using GPS whilst being able to avoid obstacles that come in its path?

I agree that the firmware of Ardupilot comes with a feature of something called the Bendy Ruler Algorithm. U I have no idea how to make use of it in the simulation environment of Gazebo. The details about this feature are also not available much.

Any help on this would be really awesome for me to continue with further development of the task!
Sanil Jain


Hi everyone! Does anyone know of a method to save a tlog to a host machine from a Python script? I'm making a program that parses tlog data, and I haven't had a chance to switch from SITL tests yet to actually flying my Pixhawk . Any and all help is appreciated!

any way??? :(

@sanjainn Hi. I did a project similar to this and my setup worked like this. First someone would plan a path in mission planner and upload it. Now arducopter requires you to put the drone in auto mode and arm the drone to start the mission (you can use arm and takeoff command in dronekit to achieve the same). The drone would take off and start going towards the next waypoint, but when it saw an obstable using the onboard lidar, it would change the mode to Brake, then it would save the mission and the current location, it would then go into guided mode to either go left or right (where ever there was more distance) and once it was free from the obstacle (in my case it was a L shaped wall) it would reupload the mission and continue from there. It was a very roundabout way of doing it but it was 6 years ago and it worked. Hope this helps.
Ronny García Lorenzo
Hello everyone I recently started dronekit python and bought Hilldow Foldable Drone (https://www.amazon.com/dp/B09TZNBB9D?tag=keepersstaffing-20&linkCode=osi&th=1&psc=1&keywords=Programmable%20Drone) So far I have not been able to connect dronekit with the drone. Please HELP!!!
Hello everyone, i am trying to write GeoFence using pymavlink python to px4 directly. but the following code doesn't write. what can be the issue?
from pymavlink import mavutil

master =  mavutil.mavlink_connection(device="tcp:")

poli = [(35.63604046,34.53116655), 

#enable fence
            mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE, 0,
            1, 0, 0, 0, 0, 0, 0)

for i in range(len(poli)):
                mavutil.mavlink.MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION, 0,

print("Waiting for the vehicle to arm")