What types to use for Accelerometer

6 replies [Last post]
Flacon
Title: NooBot
Joined: 06/13/2012
Posts:
BotPoints: 12
User offline. Last seen 9 years 14 weeks ago.

I was just playing around with the CBC's built-in accelerometer. I know I need to access the values with accel_x(), accel_y(), accel_z(). I assumed that the values returned are floats, but then
printf("%f, %f", accel_x(),accel_y());
prints out something like:

-3.000000-2.000000, -4.000000-2.000000

These numbers don't look like normal floats... also, this is when the CBC is not moving, so it should be 0,0. I tried using different CBC's and tried with int's, the values still aren't 0, which seems strange to me.

Any ideas?

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 8 years 2 weeks ago.

Hi Flacon, welcome to the Botball Community!

According to https://github.com/kipr/cbc/blob/master/userlib/libcbc/src/cbc.h the accelerometer functions return an int. Also, when the CBC is stationary, it would be expected for the magnitude of the measured acceleration to be 9.8 meters per second per second, not 0, because gravity is measured by the accelerometers. You'll notice that when you rotate the CBC in place, you can change the direction of that measured acceleration (it will always be facing the ground). This is useful because you can use the accelerometers as a tilt sensor (several teams did this to orient themselves when the Botball game board contained hills).

Hope this helps; let us know if you have any more questions. :-)

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

Flacon
Title: NooBot
Joined: 06/13/2012
Posts:
BotPoints: 12
User offline. Last seen 9 years 14 weeks ago.

Alright I'm using an int now, but when I shake the cbc the values for each axis max out at -128,127 (8 bits) vs the 12 bit accuracy the header file you linked claims.
SO: does the -128 still = -1.5 g and 127 = 1.5 g?

Thanks for the previous reply

EDIT: I just realized the vertical nonmoving acceleration is around 64 = 1G, so it can measure +-2 G at maximum values? Also is the measured value in linear correspondance to actual G's? So if 64 = 1G then does 32 = 0.5G and 127 = 2G?

ArcherWang
Title: NooBot
Joined: 10/27/2018
Posts:
BotPoints: 2
User offline. Last seen 4 years 31 weeks ago.

Technical programming is inducted for the skill enhancement of the youngsters. The urge of the program and britishessaywriters.co.uk reviews is mild for the approval of the host of the facilities for the technicians in different segments of the society.

romucar
Title: NooBot
Joined: 11/02/2018
Posts:
BotPoints: 2
User offline. Last seen 4 years 31 weeks ago.

Selection of right one type is very important for all users of accelerator with user can get rid from various kinds of problems. For handling of boomessays reviews relevant working tasks we can get lots of benefits with read of this share.

Voluptas nobis eos voluptatem Aperiam aliquip sint beatae ea illum

arianapham
Title: NooBot
Joined: 07/22/2018
Posts:
BotPoints: 30
User offline. Last seen 3 years 51 weeks ago.

Thank you for sharing such an informative post with us, it will beneficial for everyone, It is one of the best sites that I have visited. I am looking forward to read more blogs post from here. FNAF Games

brahmbhatt
Title: NooBot
Joined: 01/10/2019
Posts:
BotPoints: 2
User offline. Last seen 4 years 20 weeks ago.

V-Bucks have become a must have for many gamers as everyone is trying to achieve a look that is unique and superior to other players. However, buying them in-game has become a tricky subject as some players can't afford while some think it’s not worth it in case their interest wears down. free v bucks no verification