Traceback (most recent call last):
File "src/connect_drone.py", line 94, in <module>
File "src/connect_drone.py", line 70, in set_servo
0, 0, 0, 0, 0)
File "/Users/berkeyvx/Desktop/Developer/Python/dronekit/venv/lib/python2.7/site-packages/pymavlink/dialects/v10/ardupilotmega.py", line 15559, in command_long_send
return self.send(self.command_long_encode(target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7), force_mavlink1=force_mavlink1)
File "/Users/berkeyvx/Desktop/Developer/Python/dronekit/venv/lib/python2.7/site-packages/dronekit/mavlink.py", line 146, in newsendfn
return sendfn(mavmsg, args, *kwargs)
File "/Users/berkeyvx/Desktop/Developer/Python/dronekit/venv/lib/python2.7/site-packages/pymavlink/dialects/v10/ardupilotmega.py", line 11857, in send
buf = mavmsg.pack(self, force_mavlink1=force_mavlink1)
File "/Users/berkeyvx/Desktop/Developer/Python/dronekit/venv/lib/python2.7/site-packages/pymavlink/dialects/v10/ardupilotmega.py", line 8585, in pack
return MAVLink_message.pack(self, mav, 152, struct.pack('<fffffffHBBB', self.param1, self.param2, self.param3, self.param4, self.param5, self.param6, self.param7, self.command, self.target_system, self.target_component, self.confirmation), force_mavlink1=force_mavlink1)
struct.error: required argument is not a float
getting this error
cause of this lines
msg = vehicle.message_factory.command_long_send(
0, 0, 0, 0, 0)
What is wrong
def set_servo(port, PWM, duration):
port -> port where the servo is attached
PWM -> servo ms value, from 1000 - 2000
msg = vehicle.message_factory.command_long_encode(
0, 0, 0, 0, 0)
while this code had no error, still no changes on channel[port]. Function doesnt work. What is wrong
Hi there everyone. I have tried to create simple python script to arm and disarm SITL rover with pymavlink. I can successfully arm, but not able to disarm. I have put it into a Gist available here (https://gist.github.com/benboughton1/b5b12130f0448ecef928d8a30c84c4e8) and also posted to the Ardupilot forums (https://discuss.ardupilot.org/t/pymavlink-arm-disarm-script-help/51667).
I've looked at both MavProxy code and Ardupilot autotest and I cannot see anything too different. When I connect to this SITL instance with MavProxy it is able to Arm and Disarm no problems.
Hi, I'm working in a UTM (https://github.com/portableutm/dronfiesuss) and I need integrate it with mavlink.
In particular I want to define a new messages, for do that use mavgen as described in https://mavlink.io/en/getting_started/generate_libraries.html
The problem is that I don't know how use the generated py file with pymavlink. Is there a tutorial that shows how to use it?
Hi, I am noob to programming. I am trying to send custom messages from ardupilot to GCS. I read the documentation from here https://ardupilot.org/dev/docs/code-overview-adding-a-new-mavlink-message.html.
i added this to ardupilotmega.xml in ardupilot/modules/mavlink/pymavlink/dialects/v20/ardupilotmega.py
<message id="3001" name="CUSTOM_DATA"> <description>Drone Data</description> <field type="char" name="text">Status text message, without null termination character</field> <extensions/> <field type="uint16_t" name="id">Unique (opaque) identifier for this statustext message. May be used to reassemble a logical long-statustext message from a sequence of chunks. A value of zero indicates this is the only chunk in the sequence and the message can be emitted immediately.</field> <field type="uint8_t" name="chunk_seq">This chunk's sequence number; indexing is from zero. Any null character in the text field is taken to mean this was the last chunk.</field> </message>
and i reinstalled the updated pymavlink version from ardupilot.
But when I run this code this code I receive this error
AttributeError: 'MAVLink' object has no attribute 'custom_data'.
This is the snippet.
from pymavlink import mavutil import time from pymavlink.dialects.v20 import ardupilotmega as mavlink2 the_connection = mavutil.mavlink_connection('udpout:localhost:14550') while True: txt = "yaaaaaaa" the_connection.mav.custom_data_send(txt) time.sleep(2)
Any help would be appreciative.