TOC problem[SOLVED]

Discussions about quadcopters/multi-rotors
Post Reply
applep1e
Beginner
Posts: 3
Joined: Wed Aug 05, 2020 6:09 pm

TOC problem[SOLVED]

Post by applep1e »

HI,

I was trying to find how to get the state data of the drones. In various links and tutorials, I learned how to log the variable by cflib.
and i wonder where i can find document about TOC. To be more specific, what the difference between stateEstimate.x and kalman.stateX? where i can find all the variable list more easily?

it's too annoying when i use cflib do something, i need to disconnect the cfclient first, and when i misspell some variable, i need to reconnect and check it, and i am not good at programming (tracing variable in firmware to understand TOC is not easy work for me...), so i wonder if there is a document about all TOC variable.

- Thanks!
Last edited by applep1e on Mon Mar 15, 2021 3:26 pm, edited 1 time in total.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: TOC problem

Post by arnaud »

Hi,

Unfortunately the only document for the log variables so far is the Crazyflie source code. We have been talking about adding comments to the logs and param (including units and enum name for the variables that are enums), but this is still in the (long) todo list...

One thing that may help you is the cache files for the log and param toc. In the client if you go in the menu "settings/open config folder" you can find a cache folder that contains json files. They are named after the hash of the TOCs and they contain the log or param TOCs. To get the one used in your Crazyflie you can delete all the file, connect your Crazyflie, and the 2 created files will be the TOCs for your Crazyflie. You can use that to get the spelling and types of all the variables. It looks like this:

Code: Select all

 "pwm": {
    "m1_pwm": {
      "__class__": "LogTocElement",
      "ident": 6,
      "group": "pwm",
      "name": "m1_pwm",
      "ctype": "uint32_t",
      "pytype": "<L",
      "access": 0
    },
    "m2_pwm": {
      "__class__": "LogTocElement",
      "ident": 7,
      "group": "pwm",
      "name": "m2_pwm",
      "ctype": "uint32_t",
      "pytype": "<L",
      "access": 0
    },
    "m3_pwm": {
      "__class__": "LogTocElement",
      "ident": 8,
      "group": "pwm",
      "name": "m3_pwm",
      "ctype": "uint32_t",
      "pytype": "<L",
      "access": 0
    },
    "m4_pwm": {
      "__class__": "LogTocElement",
      "ident": 9,
      "group": "pwm",
      "name": "m4_pwm",
      "ctype": "uint32_t",
      "pytype": "<L",
      "access": 0
    }
  },
And to answer your question: stateEstimate.x and kalman.stateX are the same things when using the Kalman filter. We have two variables for historical reason and since they are both used in tools and clients and we have no way to depreciate variables, we kept both.
applep1e
Beginner
Posts: 3
Joined: Wed Aug 05, 2020 6:09 pm

Re: TOC problem

Post by applep1e »

Hi,

Thanks for your reply, and i will work hard to understand code. :D
Post Reply