[SOLVED] Log TOC variables/gyro and acc values

Discussions and questions about the Crazyflie Nano Quadcopter
cf11111
Beginner
Posts: 9
Joined: Fri Jun 28, 2019 3:47 pm

[SOLVED] Log TOC variables/gyro and acc values

Post by cf11111 » Fri Jun 28, 2019 3:57 pm

I have the latest CF firmware and am confused by the variables in the Log TOC. I need to log pitch, roll, and yaw ANGLE as well as RATE.

1. Are the stateEstimate.roll, .pitch, and .yaw the rate values (deg/s or millirad/s)?

2. I understand that these stateEstimate values incorporate mocap data into the estimation (I am using estimator 3 fyi) -- is there a way to get position and orientation estimates without using mocap data?

I expected to see variables like stabilizer.x, acc.x, and gyro.x available to be logged, but they do not appear in my TOC.



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

Re: Log TOC variables/gyro and acc values

Post by arnaud » Mon Jul 01, 2019 11:13 am

Hi,

1. stateEstimage.roll/pitch/yaw are in degree. You van get the angular rate in degree/s in gyro.x/y/z

2. If you do not feed mocap data in the Crazyflie, you will get position and orientation only from the inertial sensors. The position will diverge quickly but the orientation should stay quite stable.

What firmware version are you running? With the latest firmware version and latest Crazyflie client and lib I can see all the variables you are looking for.

cf11111
Beginner
Posts: 9
Joined: Fri Jun 28, 2019 3:47 pm

Re: Log TOC variables/gyro and acc values

Post by cf11111 » Mon Jul 01, 2019 12:45 pm

Thank you so much for the reply.

I flashed the firmware about 3 weeks ago so I am assuming that is the latest version. I can see in the firmware code that the gyro.x/y/z and other variables should be adding to the log TOC, but they do not appear in my CF client and I get an error message ("gyro.x not found in TOC!") if I try to add to hover_swarm.launch generic log variables. I need to figure out how to track roll/pitch/yaw rate very quickly for a project and have no explanation for this. Maybe the log block is being added but not started somehow?? It is also possible that I need to update the client separately and didn't realize, so I will look into that.

Do you have any idea what the problem might be?

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

Re: Log TOC variables/gyro and acc values

Post by arnaud » Mon Jul 01, 2019 12:58 pm

The problem might be with the version of your client and lib: A new mechanism has been added a couple of month ago to be able to have more than 255 log variables, you can see if your client is new enough by looking in the console tab. There should be a warning if the new log TOC protocol is not in use. If it is the case, you will be missing some log and param variables.

cf11111
Beginner
Posts: 9
Joined: Fri Jun 28, 2019 3:47 pm

Re: Log TOC variables/gyro and acc values

Post by cf11111 » Mon Jul 01, 2019 1:11 pm

Ok thank you. It must be a firmware issue. Sorry, I am new to ROS and have a further question. So I tried to update the client and it now shows the exact voltage reading which I believe is a newer function, but the console tab now shows that I am using controller 1 and estimator 1 instead of 2 and 3, respectively, so many variables are not shown in my log toc now (I am guessing because only estimator 1 is being used). How do I change this? I still can't see gyro.x/y/z and now can't see stateEstimate values either.

Thank you, I really appreciate your help.

cf11111
Beginner
Posts: 9
Joined: Fri Jun 28, 2019 3:47 pm

Re: Log TOC variables/gyro and acc values

Post by cf11111 » Mon Jul 01, 2019 1:12 pm

When I open the client from the terminal, it gives me "stabilizer.roll not in TOC, this block cannot be used!" errors for many of the variables I need. Maybe I need to rebuild? I am new to all of this and don't exactly know how to do that.

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

Re: Log TOC variables/gyro and acc values

Post by arnaud » Mon Jul 01, 2019 1:19 pm

If you are using ROS you should start with that :-). I have been assuming you where using the Crazyflie python lib and client since this is what we are developing ourselves.

I still think that the problem seems to be on the client side though, not the firmware side: the gyro log variables have always been in the Crazyflie firmware. Though if you are running an old version of the ROS crazyflie driver it will not see all the variables. This is the only reason I can see this happening unless you run a version of the firmware where you have removed these variables.

cf11111
Beginner
Posts: 9
Joined: Fri Jun 28, 2019 3:47 pm

Re: Log TOC variables/gyro and acc values

Post by cf11111 » Mon Jul 01, 2019 1:24 pm

Yes, I am using the crazyflie python lib. Basically someone else set up the system and I am trying to get everything working again so I didn't do the initial building and such. The drone is flying very well and can be controlled from a waypoint script so my only problem is really with the logging.

I looked in the driver and saw where the gyro variables should be added so I can't understand why they aren't so I will try a few more things. Do I have to rebuild for the new client? I don't see a warning in the console except it says "SYS: Build NA:NA (NA) MODIFIED" now that I have moved the new files over. I am also searching previous questions related to this now that you have helped me narrow down the issue but would appreciate any more help.

I guess my question is how do I actually update to the latest client and lib/is a rebuild required? I am looking on the github guide too.

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

Re: Log TOC variables/gyro and acc values

Post by arnaud » Tue Jul 02, 2019 9:56 am

To update to the latest lib and client you can clone both and then:

Code: Select all

python3 -m pip uninstall cflib
python3 -m pip uninstall cfclient

cd crazyflie-lib-python
python3 -m pip install -e .
cd ..

cd crazyflie-clients-python
python3 -m pip install -e .
This will install both the lib and the client in 'edit' mode, which means that it will use the code you have cloned directly so you can make sure you clone the latest version.

cf11111
Beginner
Posts: 9
Joined: Fri Jun 28, 2019 3:47 pm

Re: Log TOC variables/gyro and acc values

Post by cf11111 » Tue Jul 02, 2019 1:09 pm

Thank you very much. I appreciate your help!

Post Reply