[SOLVED] Callbacks added in cfheadless.py not getting called
Posted: Fri Nov 21, 2014 5:30 am
Hi all,
I've been banging my head against the wall for the greater part of yesterday and this evening trying to understand this.
In cfheadless.py (line 92) there's a parameter update callback being added but I don't see that the callback function itself ever gets called.
I added a print statement in the add_update_callback() function (line 157) of cflib/crazyflie/param.py and I can verify that function gets called during startup of cfheadless. So the callback is added.
I added another print statement to the setAltHoldAvailable() function (line 148) in cfclient/utils/input.py and have confirmed that this function (the callback routine) never gets called during a cfheadless run... It never executes.
What I haven't figured out yet is why it's not getting called. With these same print statements in, the python GUI client executes the callback just fine. The cfheadless.py implementation does not. I thought it might just be a timing issue (TOC hasn't filled out yet) but judicious use of time.sleep() has proven that theory incorrect. 
Are there any CF junkies out there that have a deeper understanding of the cfheadless and python client architecture that can point me in the right direction to figure out what's going on here?
I've been banging my head against the wall for the greater part of yesterday and this evening trying to understand this.
In cfheadless.py (line 92) there's a parameter update callback being added but I don't see that the callback function itself ever gets called.
Code: Select all
def connect_crazyflie(self, link_uri):
"""Connect to a Crazyflie on the given link uri"""
self._cf.connection_failed.add_callback(self._connection_failed)
self._cf.param.add_update_callback(group="imu_sensors", name="HMC5883L",
cb=(lambda name, found:
self._jr.setAltHoldAvailable(eval(found))))
Code: Select all
def add_update_callback(self, group, name=None, cb=None):
"""
Add a callback for a specific parameter name. This callback will be
executed when a new value is read from the Crazyflie.
"""
print "*** add_update_callback() name: {}".format(name)
Code: Select all
def setAltHoldAvailable(self, available):
print "*** setAltHoldAvailable() available: {}".format(available)
self._has_pressure_sensor = available

Are there any CF junkies out there that have a deeper understanding of the cfheadless and python client architecture that can point me in the right direction to figure out what's going on here?