Packets not on TOC Channel, communication error

Post here to get support
Post Reply
aharmsen
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:28 pm

Packets not on TOC Channel, communication error

Post by aharmsen »

I'm quite new to the crazyflie operation so I've just been trying to understand the python libraries and currently using the code found here to try to get some thrust:
http://wiki.bitcraze.se/projects:crazyf ... de_example

When I run it, as soon as it connects to the radio it gives me the following error messages:
Error:cflib.crazyflie.toc:Got packet that was not on TOC channel, TOC fetch will probably not succeed
Warnng:cflib.crazyflie.toccache:Could not save cache, no writeable directory
Warning:cflib.crazyflie:ExpectAnswer: Error! Older timer whas running while scheduling new one on [2]

After these errors nothing else happens: no thrust, no further error messages.

I realize that this is similar to discussion:
http://forum.bitcraze.se/viewtopic.php? ... nnel#p2604
And the issue that has been raised:
https://bitbucket.org/bitcraze/crazyfli ... ctionality

But I cannot continue with my development until I overcome this issue and I have not been able to find a solution right now.

When I connect using the pcclient there is no problem connecting and sending thrust commands to the crazyflie.

Any help would be greatly appreciated, thanks!
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Packets not on TOC Channel, communication error

Post by marcus »

Hi,

The example that was on the wiki wasn't good since it hijacked the thread that calls the connectSetupFinished callback and this is not allowed. I've updated the example and it should work now. Place the script in the crazyflie-pc-client folder.

/Marcus
aharmsen
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:28 pm

Re: Packets not on TOC Channel, communication error

Post by aharmsen »

Thanks for the update Marcus.
I've been trying it for the last little while but still cannot get it to work. Even with the new starter code I'm having the following error come up:

No handlers could be found for logger "cflib.crazyflie"
WARNING:root:[5]: Was expecting 0 but got 9
WARNING:root:[5]: Was expecting 0 but got 9
WARNING:root:[5]: Was expecting 0 but got 9
WARNING:cflib.crazyflie.toccache:Could not save cache, no writable directory
WARNING:cflib.crazyflie.toccache:Could not save cache, no writable directory
WARNING:cflib.crazyflie:Got link error callback [Too many packets lost] in state [2]

The problem starts occurring right after the function call:
self.crazyflie.connectSetupFinished.add_callback(self.connectSetupFinished)
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Packets not on TOC Channel, communication error

Post by marcus »

aharmsen wrote:Thanks for the update Marcus.
I've been trying it for the last little while but still cannot get it to work. Even with the new starter code I'm having the following error come up:

No handlers could be found for logger "cflib.crazyflie"
WARNING:root:[5]: Was expecting 0 but got 9
WARNING:root:[5]: Was expecting 0 but got 9
WARNING:root:[5]: Was expecting 0 but got 9
WARNING:cflib.crazyflie.toccache:Could not save cache, no writable directory
WARNING:cflib.crazyflie.toccache:Could not save cache, no writable directory
WARNING:cflib.crazyflie:Got link error callback [Too many packets lost] in state [2]

The problem starts occurring right after the function call:
self.crazyflie.connectSetupFinished.add_callback(self.connectSetupFinished)
Does the Crazyflie crash (I.e do the LEDs stop blinking)? Did you build your own firmware?
aharmsen
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:28 pm

Re: Packets not on TOC Channel, communication error

Post by aharmsen »

The Crazyflie is physically responding as I would expect:
- Red light blinking at 2Hz
- Radio receiver lights are blinking through communication
- Flight data is being sent properly (attitude, thrust, etc.)
- Latest default firmware has been loaded
- Under "Console" on the PC-Client all the checks are completed properly
- Motors are turning and responding normally when operating thrust straight from PC-Client
aharmsen
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:28 pm

Re: Packets not on TOC Channel, communication error

Post by aharmsen »

Any more thoughts? I still cannot do anything with my quadcopter except increase and decrease thrust in the pc client...
I am really disappointed that I have spent so much money and cannot do anything with this little device.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Packets not on TOC Channel, communication error

Post by marcus »

If you can only use the thrust in the client then it sounds like there's a problem with your controller mapping. Check the lower left corner of the window, it will say what device and what mapping you are using. Either change to the correct mapping in the menu Input device->Mappings or if you can't find any that work, create your own. Have a look at the input device page on the wiki for tips on configuration.

The other problem you are having with the example script, could you attach it? What OS are you running?
aharmsen
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:28 pm

Re: Packets not on TOC Channel, communication error

Post by aharmsen »

Nothing wrong with the controller mapping (I just don't have a controller attached because I want to operate the quadcopter solely via code).

Operating system - Ubuntu.
I am using the latest Virtual machine setup that is provided by Bitcraze.

I tried uploading the .py code file but this forum does not support uploading .py, .txt, .doc, .pdf extensions, files with no extensions or any image files from which it cannot detect the pixel dimensions.
The code is exactly what it given in the example code here (no changes were made):
http://wiki.bitcraze.se/projects:crazyf ... de_example
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Packets not on TOC Channel, communication error

Post by marcus »

I tested the example by copying and pasting the code below into the file named log_example.py. The firmware and cflib are the latest versions (the released versions named 2013.11-beta1).

Code: Select all

import time, sys
from threading import Thread
 
sys.path.append("lib")
import cflib
from cflib.crazyflie import Crazyflie
 
class Main:
    def __init__(self):
        self.crazyflie = Crazyflie()
        cflib.crtp.init_drivers()
 
        # You may need to update this value if your Crazyradio uses a different frequency.
        self.crazyflie.open_link("radio://0/10/250K")
        # Set up the callback when connected
        self.crazyflie.connectSetupFinished.add_callback(self.connectSetupFinished)
 
    def connectSetupFinished(self, linkURI):
        # Start a separate thread to do the motor test.
        # Do not hijack the calling thread!
        Thread(target=self.pulse_command).start()
 
    def pulse_command(self):
        thrust_mult = 1
        thrust_step = 500
	thrust = 20000
        pitch = 0
        roll = 0
        yawrate = 0
        while thrust >= 20000:
	    self.crazyflie.commander.send_setpoint(roll, pitch, yawrate, thrust)
            time.sleep(0.1)
            if (thrust >= 25000):
                thrust_mult = -1
            thrust = thrust + (thrust_step * thrust_mult)
        self.crazyflie.commander.send_setpoint(0,0,0,0)
        # Make sure that the last packet leaves before the link is closed
        # since the message queue is not flushed before closing
	time.sleep(0.1)
        self.crazyflie.close_link()
 
Main()
The response is that the script connects to the Crazyflie, spins up the motors and disconnects. Here's the printout:

Code: Select all

macke@desk:~/dev/bitcraze/repos/crazyflie-pc-client_default$ python log_example.py 
No handlers could be found for logger "cflib.crazyflie"
WARNING:root:[5]: Was expecting 0 but got 33
WARNING:root:[5]: Was expecting 0 but got 33
WARNING:root:[5]: Was expecting 0 but got 33
WARNING:cflib.crazyflie.toccache:Could not save cache, no writable directory
WARNING:cflib.crazyflie.toccache:Could not save cache, no writable directory
The address radio://0/10/250K is hardcoded in the example so if you changed the address you have to edit it otherwise you will get the error message "Too many packets lost".
Post Reply