CF logging all 0's for state estimate. [Solved]

Post here to get support
Post Reply
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

CF logging all 0's for state estimate. [Solved]

Post by cafeciaojoe »

Hi all,

I am getting a bug in my code where the log configuration is returning 0 for all readings. I do have a pretty hacky way of connecting to two additional CF's in the client. However it was woking for a longt time before this bug showed up. I was just wondering if anyone could decifer whats happening here.

Even the "def wait_for_position_estimator(self, cf):" Which is a function I took from the cf lib is returning 0.0 .0.0 0.0 see line "INFO:cfclient.ui.tabs.HTTYD:Position found with error in, x: 0.0, y: 0.0, z: 0.0
"

Anyone have any ideas? My only guess is that theere are log blocks not being deleted because of this line,
INFO:cflib.crazyflie.mem:7 memories found (but I am not really sure if that is how they work...)
There are 7 variables that I am logging for these CF's (each)

Code: Select all

            received_signals = LogConfig(name='lighthouse', period_in_ms=1000)
            # below 50ms nans are called even though the cf can see the base station
            # probably because it is logging the variable before it is updated.
            received_signals.add_variable('lighthouse.bsReceive','uint16_t')

            log_position = LogConfig(name='Position', period_in_ms=50)
            log_position.add_variable('stateEstimate.x', 'float')
            log_position.add_variable('stateEstimate.y', 'float')
            log_position.add_variable('stateEstimate.z', 'float')
            log_position.add_variable('stateEstimate.roll', 'float')
            log_position.add_variable('stateEstimate.pitch', 'float')
            log_position.add_variable('stateEstimate.yaw', 'float')

Code: Select all

INFO:cflib.crazyflie:Callback->Connected to [radio://0/80/2M/A0A0A0A0A0]
INFO:cflib.crazyflie:Callback->Connected to [radio://0/80/2M/A0A0A0A0A1]
INFO:cflib.crazyflie.log:Have successfully started logging for id=2
INFO:cflib.crazyflie.log:Have successfully started logging for id=3
INFO:cflib.crazyflie.platformservice:Protocol  version: 4
INFO:cflib.crazyflie.platformservice:Protocol  version: 4
INFO:cflib.crazyflie.toc:TOC for port [5] found in cache
INFO:cflib.crazyflie:Log TOC finished updating
INFO:cflib.crazyflie.toc:TOC for port [5] found in cache
INFO:cflib.crazyflie:Log TOC finished updating
INFO:cflib.crazyflie.mem:7 memories found
INFO:cflib.crazyflie.mem:7 memories found
INFO:cflib.crazyflie:Memories finished updating
INFO:cflib.crazyflie.toc:TOC for port [2] found in cache
INFO:cflib.crazyflie:Param TOC finished updating
INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/80/2M/A0A0A0A0A0]
INFO:cfclient.ui.tabs.HTTYD:Starting flight logger thread for cf_pos_L
INFO:cflib.crazyflie:Memories finished updating
INFO:cflib.crazyflie.toc:TOC for port [2] found in cache
INFO:cflib.crazyflie:Param TOC finished updating
INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/80/2M/A0A0A0A0A1]
INFO:cfclient.ui.tabs.HTTYD:Starting flight logger thread for cf_pos_R
INFO:cfclient.ui.tabs.HTTYD:Waiting for estimator to find stable position...
INFO:cflib.crazyflie.log:Have successfully started logging for id=4
INFO:cfclient.ui.tabs.HTTYD:Waiting for estimator to find stable position...
INFO:cflib.crazyflie.log:Have successfully started logging for id=1
INFO:cfclient.ui.tabs.HTTYD:Waiting for estimator to find stable position...
INFO:cflib.crazyflie.log:Have successfully started logging for id=1
INFO:cfclient.ui.tabs.HTTYD:Position found with error in, x: 4.177016671746969e-05, y: 0.00011406908743083477, z: 9.312271140515804e-05
INFO:cflib.crazyflie.log:Have successfully stopped logging for id=4
INFO:cflib.crazyflie.log:Have successfully deleted id=4
_cf callbacks set
INFO:cflib.crazyflie.log:Have successfully started logging for id=5
INFO:cflib.crazyflie.log:Have successfully started logging for id=6
INFO:cfclient.ui.tabs.HTTYD:Position found with error in, x: 0.0, y: 0.0, z: 0.0
INFO:cflib.crazyflie.log:Have successfully stopped logging for id=1
INFO:cflib.crazyflie.log:Have successfully deleted id=1
INFO:cfclient.ui.tabs.HTTYD:Position found with error in, x: 0.0, y: 0.0, z: 0.0
INFO:cflib.crazyflie.log:Have successfully stopped logging for id=1
INFO:cflib.crazyflie.log:Have successfully deleted id=1
_cf_L callbacks set
_cf_R callbacks set
INFO:cflib.crazyflie.log:Have successfully started logging for id=2
INFO:cflib.crazyflie.log:Have successfully started logging for id=3
INFO:cflib.crazyflie.log:Have successfully started logging for id=2
INFO:cflib.crazyflie.log:Have successfully started logging for id=3
INFO:cfclient.ui.tabs.HTTYD:Switching Flight Mode to: FlightModeStates.GROUNDED
INFO:cfclient.ui.tabs.HTTYD:Starting flight controller thread
cf_pos_L 0.0 0.0 0.0
cf_pos_L 0.0 0.0 0.0
cf_pos_L 0.0 0.0 0.0
cf_pos_L 0.0 0.0
Last edited by cafeciaojoe on Sun May 23, 2021 4:22 am, edited 1 time in total.
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

Re: CF logging all 0's for state estimate.

Post by cafeciaojoe »

Hi, Solved this issue.

When you connect to the drone before they stabilize they throw 0's.
But they never stabilised because they were always moving (they were stuck to someones body when turned on)

Cheers!
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: CF logging all 0's for state estimate. [Solved]

Post by kimberly »

Good you figured that out! It is indeed true that the CF2 has to be completely still at the beginning. Hope you will be able to get it to work for your situation!
Post Reply