[SOLVED] Absolute orientation from client

Firmware/software/electronics/mechanics
Post Reply
jcacace
Beginner
Posts: 5
Joined: Sat Dec 27, 2014 3:55 pm

[SOLVED] Absolute orientation from client

Post by jcacace »

Hi guys!

I am quite new of Crazyflie firmware. I'm using a crazyflie 1.0, 10 DOF, and I'm trying to get the absolute orientation of the quadorotor from the crazyflie official client, sadly for what i can see the orientation in quaternion form is not streamed, i can access only to angular acceleration and linear velocity, it's right? If this is the case, do you know if there is a way to access to orientation data?

All the best
Last edited by jcacace on Sun Jan 04, 2015 9:54 pm, edited 1 time in total.
dbrgn
Member
Posts: 51
Joined: Tue Dec 16, 2014 9:42 pm

Re: Absolute orientation from client

Post by dbrgn »

You mean the absolute yaw value (like a compass)? In the UI you can see the yaw value in the "actual" column.

Image

The range is [-180,180].

You should also be able to get this value out of the flie using the logging system. You can see all available values by enabling the "Log TOC" tab. Probably the value is "stabilizer.yaw".
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Absolute orientation from client

Post by marcus »

Hi,

Like dbrgn said the data should be available in the client. If there's some other data you are missing have a look at this video tutorial showing how to add variables to the logging data. The orientation in quaternion is not logged, only the roll/pitch/yaw is. Have a look at this file where the calculations are done. If you are interested in any particular data then add it to the logging framework by using the following code:

Code: Select all

LOG_GROUP_START(mygroup)
LOG_ADD(LOG_FLOAT, myvar, &actualvar)
LOG_GROUP_STOP(mygroup)
Where mygroup and myvar can be choosen by you and actualvar and LOG_FLOAT should match the code.
jcacace
Beginner
Posts: 5
Joined: Sat Dec 27, 2014 3:55 pm

Re: Absolute orientation from client

Post by jcacace »

Dear all,

Thank you so much for the replies, they are really perfect and now my mind is more clear about the communication with the pc.
I can use directly the stabilizer data, so i don't need to add other variables for the quaternion calculater in the sensorfusion.

Sadly I am addressing a problem trying to read data from a python code using the cfilb. I am able to download correctly the Imu or battery data, but the stabilizier class of data seems to be not present in the TOC, but if i connect with the client to the crazyflie and open the TOC tab, i can see the raw of the stabilizer data... i will attach the code that i use to create a callback to read the stabilizer data:

Code: Select all

 self._lg_stab = LogConfig(name="stabilizier", period_in_ms=10)
        self._lg_stab.add_variable("stabilizier.roll", "float")
        self._cf.log.add_config(self._lg_stab)
        if self._lg_stab.valid:
            self._lg_stab.data_received_cb.add_callback(self._log_data_stab)
            self._lg_stab.error_cb.add_callback(self._log_error)
            self._lg_stab.start()
        else:
            rospy.logfatal("Could not add logconfig stab since some variables are not in TOC")
If i run this code, the errore message is printed... so my configuration seems to be not valid, any suggestion?
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: Absolute orientation from client

Post by chad »

Might it just be a matter of spelling...?

I see stabilizer in my TOC (vs. stabilizier in your code) - see attached picture.
stabilizer.png
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
jcacace
Beginner
Posts: 5
Joined: Sat Dec 27, 2014 3:55 pm

Re: Absolute orientation from client

Post by jcacace »

Oh my God... what a shame!
Thank you chad... i solved the problem now!
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: Absolute orientation from client

Post by chad »

jcacace wrote:Oh my God... what a shame!
Thank you chad... i solved the problem now!
No shame in it at all!! Happy that it's solved. ;-)
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
Post Reply