Page 1 of 1
[SOLVED] Absolute orientation from client
Posted: Thu Jan 01, 2015 5:58 pm
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
Re: Absolute orientation from client
Posted: Fri Jan 02, 2015 10:30 am
by dbrgn
You mean the absolute yaw value (like a compass)? In the UI you can see the yaw value in the "actual" column.
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".
Re: Absolute orientation from client
Posted: Fri Jan 02, 2015 6:10 pm
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.
Re: Absolute orientation from client
Posted: Sun Jan 04, 2015 11:51 am
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?
Re: Absolute orientation from client
Posted: Sun Jan 04, 2015 8:33 pm
by chad
Might it just be a matter of spelling...?
I see stabilizer in my TOC (vs. stabiliz
ier in your code) - see attached picture.
Re: Absolute orientation from client
Posted: Sun Jan 04, 2015 9:54 pm
by jcacace
Oh my God... what a shame!
Thank you chad... i solved the problem now!
Re: Absolute orientation from client
Posted: Sun Jan 04, 2015 10:58 pm
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.
