[SOLVED] headless connection failure

Post here to get support
Mitteau
Expert
Posts: 248
Joined: Fri Jan 29, 2016 6:00 am

[SOLVED] headless connection failure

Post by Mitteau »

Hello everybody
I use raspberry/raspbian command unit to pilot a crazyflie 2, as in the wiki. I use headless client with some modifications.
With or without modification, radio connection is interrupted in case of shock. This happens rather often and I have to disconnect and reconnect the radio dongle every time. This is boring...
I would like to have a button on the joystick to reconnect the cf2.
Thanks
Jean-Claude
This does not happen with cfclient.
Last edited by Mitteau on Tue May 29, 2018 2:06 pm, edited 1 time in total.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud »

Hi Jean-claude,

If you know a bit of python, you could implement this functionality in the headless client itself. A maybe easier way could be to make another script that kills and restarts the headless client when a button is pressed on the gamepad (I just tested and, on Linux, it is possible to read a joystick simultaneously from two programs).

It is interesting that you observe different behaviour from the headless and GUI client, are you running the same version on both sides? It should be possible to have both client behaving the same way.

/Arnaud
Mitteau
Expert
Posts: 248
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau »

Hello Arnaud
Yes, I am, both versions are the latest at date 1st of july included. I implemented a button which connects and disconnects radio link. Nevertheless, when radio link fails, this button has no action.
Is there a security which stops radio link in case of high acceleration? I doubt it is an electrical failure, for this does not happen with gui client and happens form the beginning of my installation of headless software, with a completely new cf2.
Jean-Claude
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud »

Hi,
No there is no such security with acceleration (at least not on purpose). There is a radio watchdog that will cut the link if threr is too many packet lost, I assume this is what is kicking-in. Do you have a log of why the connection is stopping?

FYI, this radio watchdog is there: https://github.com/bitcraze/crazyflie-l ... er.py#L498. You could try setting TRIES_BEFORE_DISCON to a higher number to see if that helps.
Mitteau
Expert
Posts: 248
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau »

Hello,
No, I have not set the parameter debug logfile active. I will do next time.
Jean-Claude
Mitteau
Expert
Posts: 248
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau »

Hello everybody
I installed headless on a raspberry pi2 machine, according (roughly) with Wiki's explanations. The automatic run occurs when I connect the radio dongle.
But
the situation is rather simple:
1/ when I run cfheadless by typing bin/cfheadless in a terminal window, everything goes right,
2/ when I use automatic running when connection crazyradio USB, the system stops after exactly 35 seconds...

What can I do to obtain continuous automatic running?
I installed a reconnection through a button of my joypad, but it does not work as the system is completely stopped.

The cfclient is derived from your commit 75319fd, the lib commit is 669aef0. The firmware works perfectly with cfclient's FlightTab.

Raspberry system is last one, namely Linux raspberry 4.9.35-v7+ #1014, issued 2017-06-30.

The udev/rules are:
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE="0664", GROUP="plugdev", RUN+="/root/bin/cfheadless"
and
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"

The /root/bin/cfheadless is
#!/bin/sh
if test "$ACTION" = "add"
then
/home/pi/crazyflie-clients-python/bin/cfheadless > /tmp/cfheadless.log 2&1 &
echo $! > /tmp/cfheadless.pid
else
killall -9 cfheadless
if test -f /tmp/cfheadless.pid
then
PID=cat /tmp/cfheadless.pid
kill -9 $PID
fi
fi

The sudo command looks unnecessary one.
Jean-Claude
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud »

Hi,
Is there anything in the log file, /tmp/cfheadless.log, that indicates why the headless client stopped? It might be that the new version of udev have a cap in the amount of time a script can run. If so we need to detach completely the client from this script (there was a program called "nohup" that was doing that I think).
Mitteau
Expert
Posts: 248
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau »

Hello Arnaud
Thanks a lot, I will look at...
Mitteau
Expert
Posts: 248
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau »

Hi
Udev seems a good track, but actually nohup does not solve the problem...
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud »

Is there any clue in the log file?
Post Reply