tridge on master
prepare for 2.4.4 release (compare)
tridge on master
mavutil: fixed ArduPilot plane … (compare)
peterbarker on master
DFReader: add notes about swipi… mavgen_python: use to_string to… (compare)
I am working on a solution to use multiple Pixhawks with one RTK base. Hardware wise everything is working as it should and a direct connection works perfectly.
I havn't found a propper solution to this yet,I can't use the in the method that is recommended in the Herev2 user manual because I connect every Pixhawk via network (over mavproxy, running on Raspberry Pis). And as far as I see I can't use mavproxy to split the mavlink stream, cause only the first vehicle will receive the RTK data.
Until now I split the serial stream of the RTK into several, connectiong to multiple Mission Planners. This works, but is really inefficiant and is annoying to start up.
So I started working on my own script to just forward the mavlink msgs send to the first vehilce to every other connected.
I was hoping that I could avoid hardcoding number of open connections, opening a port every time a connection would be established.
So I append a list with new mavlink objects.
My problem now:
If I try to send something to any of the vehicles in the lists it will not reach it.
But receiving is no problem.
p_msg = s.recv_msg()
Running this without using the list (just using a variable) is no problem, neither.
I am probably missing something crucial (my Python skills arent the best), but I don't see what/how to fix this. Or is there generally a better sollution for this problem, that I just missed?
Here is my test code
from pymavlink import mavutil import time if __name__ == "__main__": mp = mavutil.mavlink_connection("0.0.0.0:14551") s =  s.append(mavutil.mavlink_connection("COM6")) # For debugging I actually do use a serial connection :) add = lambda a : s.append(mavutil.mavlink_connection("127.0.0.1:1455"+str(a))) # Gonna use this later for automatically opening new ports #add(2) print s while True: mp_msg = mp.recv_msg() if mp_msg: if mp_msg.get_type() == "BAD_DATA": print "MP bad_data" else: for i in s: i.mav.send(mp_msg) p_msg = s.recv_msg() if p_msg: if p_msg.get_type() == "BAD_DATA": print "P bad_data" else: mp.mav.send(p_msg)
Hope someone can help me with this :)
SET_POSITION_TARGET_LOCAL_NED? I'm unsure how I'd handle the connection in that case
self.conn.mav.set_position_target_local_ned_send( 0, # system time in milliseconds self.conn.target_system, # target system self.conn.target_component, # target component mavutil.mavlink.MAV_FRAME_LOCAL_NED, # frame 0b010111111000, # mask 0, 0, 0, # position x,y,z 0, 0, 0, # velocity x,y,z 0, 0, 0, # accel x,y,z 0, 15) # yaw, yaw rate
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