headless connection failure

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

headless connection failure

Post by Mitteau » Sat Jul 15, 2017 3:12 pm

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.

arnaud
Bitcraze
Posts: 1248
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud » Mon Jul 17, 2017 8:53 am

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: 190
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau » Tue Jul 18, 2017 7:53 am

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: 1248
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud » Tue Jul 18, 2017 8:28 am

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: 190
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau » Thu Jul 20, 2017 6:32 am

Hello,
No, I have not set the parameter debug logfile active. I will do next time.
Jean-Claude

Mitteau
Expert
Posts: 190
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau » Thu Aug 10, 2017 9:28 am

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: 1248
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud » Mon Aug 14, 2017 9:41 am

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: 190
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau » Tue Aug 15, 2017 8:57 am

Hello Arnaud
Thanks a lot, I will look at...

Mitteau
Expert
Posts: 190
Joined: Fri Jan 29, 2016 6:00 am

Re: headless connection failure

Post by Mitteau » Tue Aug 15, 2017 12:05 pm

Hi
Udev seems a good track, but actually nohup does not solve the problem...

arnaud
Bitcraze
Posts: 1248
Joined: Tue Feb 06, 2007 12:36 pm

Re: headless connection failure

Post by arnaud » Wed Aug 16, 2017 9:45 am

Is there any clue in the log file?

Post Reply