I configured my RPi2 as an Access Point.
Instead to connect to the GroundStation via a certain IP,
I want to broadcast the output via UDP to all connected devices.
Is it possible to send the output of the firmware to localhost via the -C argument.
Then I easily could setup a python script.
My intention was that I just capture what ArduCopter-quad is sending with a udp socket
and send it via wifi to the GCS. The IP adress of the groundstation is unfortunately unknown
and it would be easier to connect to the known IP address of my copter.
Initially, I thought it would be done with such a script.
udp_port = 14550
udp_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def echo_thr(): # trnm_thr() sends commands to Arduino
udp_msg = None
if_name = "wlan0"
# get local interface address
apif_wlan0 = get_if_address(if_name)
apif_wlan0 = get_ip4_adr(apif_wlan0)
# receive a message running on local host
udp_msg, udp_client = udp_server.recvfrom(512) # Wait for UDP packet from ground station
# forward the msg and broadcast it in the complete network :D
for ofs in xrange(1, 254):
adr = apif_wlan0 + str(ofs)
print(adr, ": ", udp_msg)
udp_server.sendto(udp_msg, (adr, udp_port) )
I am able to get a heartbeat and the vehicle state on the GCS software (APMPlanner).
Unfortunately all the parameters seem to require a request from the GCS
and I don’t get any data through the same socket from the GCS on the RPi end.
I don’t understand were the problem is. Is the GCS maybe sending on another port?
Your suggestion to use MAVProxy seems to allow forwarding on a device or on another udp-socket.
However, Mavproxy just seems to bind a udp socket on 0.0.0.0, but the APMPlanner listens for sendto()
That means, I still cannot get a link or I simply didn’t understood MAVProxy.
Or is there a possibility on APMPlanner or any other GCS that it acts as a client instead as a server?
With SOCAT I just get one message repeated forever “PreArm: RC not calibrated” (okay because I have no RC connected at the moment) but it never gets past that message to the point of loading the parameter list, which it does when I add a specific communication target.
APM start command in “/etc/rc.local”:
sudo ArduCopter-quad -A udp:127.0.0.1:14550 > /home/pi/APM\ Start.log &
SOCAT command (entered directly on command line to test):
I’m running APM Planner v2.0.17 and the UDP link settings are default. I guess two things are happening:
ArduCopter is re-transmitting the last message endlessly so any new devices can detect it.
APM Planner 2 should send some kind of message (acknowledgement?) to start a normal communication protocol, i.e. continue to request the parameter list and maybe ArduCopter stops repeating the last message then.
Yep, I also changed it yesterday to LISTEN. RECV is not working well together with broadcasting, but okay for a single IP.
Changes regarding my init scripts are welcome. I also prepared some monit scripts. If something fails monit will try to solve it However they are very simple.
I also configured the RPi2 as an Access Point and the above definitely does not work. Is socat the only solution for a point-to-point telemetry communication between the RPi2 and Mission Planner running in a laptop?
Hey I have a question!
Are you running this script through a command window or typing all these commands on Mavproxy window?
I’m in desperate need of help. My whole team is failing and I really need a solution.
We don’t know how to detect a WiFi network through mavproxy.
We want this WiFi network set up so our quadrotor can hover stably.