Meaning of values from the accelerometer?

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: imaqine, 99jonathan, roger

ruperty
Advanced Member
Posts: 180
Joined: Sun Oct 14, 2007 11:21 am

Meaning of values from the accelerometer?

Postby ruperty » Mon Jun 24, 2013 2:39 pm

I am trying to understand how to use the data from the accelerometer (Hi Technic). The scenario is an inverted pendulum with the sensor (x-axis) pointing upwards. I want to control (via motors on a supporting cart) the pendulum so that it stays vertical.

When the pendulum is moved from the horizontal through 180 degrees the values of the z-axis go from -200 to 200 (0 is vertical).

If I move the pendulum smoothly, and slowly, from the vertical to the right the values go from 0 to 200. However, if I move the pendulum sharply, to the right, the values first go negative (-70), presumably due to acceleration.

So, as negative values can represent different situations, how can I tell the difference between negative values due to acceleration to the right and negative values due to tilting to the left?
Regards,
Rupert
www.perceptualrobots.com

Aswin
leJOS Team Member
Posts: 312
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands
Contact:

Re: Meaning of values from the accelerometer?

Postby Aswin » Tue Jun 25, 2013 6:55 am

Hi Rupert,

As you noticed the accelerometer measures both gravity and acceleration of the sensor. The effect of both are summed in the resulting measurement. There is no way to tell these apart. Therefore one cannot use an accelerometer for balancing robots. A gyro sensor is not affected by gravity and can be used to measure tilt. You therefore can use a gyro.
My NXT blog: http://nxttime.wordpress.com/

skoehler
leJOS Team Member
Posts: 1550
Joined: Thu Oct 30, 2008 4:54 pm

Re: Meaning of values from the accelerometer?

Postby skoehler » Tue Jun 25, 2013 9:22 am

BTW: gravity is acceleration! We're all constantly accelerated towards the ground by the gravity of earth. Just imagine you throw a ball in air. It should become apparent that it is accelerated towards earth.

ruperty
Advanced Member
Posts: 180
Joined: Sun Oct 14, 2007 11:21 am

Re: Meaning of values from the accelerometer?

Postby ruperty » Tue Jun 25, 2013 12:02 pm

Aswin wrote:Hi Rupert,

As you noticed the accelerometer measures both gravity and acceleration of the sensor. The effect of both are summed in the resulting measurement. There is no way to tell these apart. Therefore one cannot use an accelerometer for balancing robots. A gyro sensor is not affected by gravity and can be used to measure tilt. You therefore can use a gyro.


I believe the effects of gravity can be removed, as indicated here. But that leaves me with the same problem of differentiating a value that is negative due to deceleration from a value that is negative due to direction. Do you not have the same issue with the gyroscope?
Regards,
Rupert
www.perceptualrobots.com

Aswin
leJOS Team Member
Posts: 312
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands
Contact:

Re: Meaning of values from the accelerometer?

Postby Aswin » Tue Jun 25, 2013 2:52 pm

Hi Rupert,

The article you refer to gives a statistical approach to calculate the magnetute of gravity or acceleration (minus gravity). It does not provide information on the direction of these forces. And this is what you need to calculate a tilt angle. Remember that you have a change in direction of the gravity vector and an acceleration at th same time. If one of the two were constant you would not have a problem.
You cannot apply the referred method on a single axis. It is only valid for the total acceleration vector.

A gyro sensor does not have this problem. It has it's own problem as it only tells you how fast it is rotating. It can't tell you when it is upright.

Aswin
My NXT blog: http://nxttime.wordpress.com/

Aswin
leJOS Team Member
Posts: 312
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands
Contact:

Re: Meaning of values from the accelerometer?

Postby Aswin » Tue Jun 25, 2013 5:53 pm

Aswin wrote:
The article you refer to gives a statistical approach to calculate the magnetute of gravity or acceleration (minus gravity). It does not provide information on the direction of these forces. And this is what you need to calculate a tilt angle. Remember that you have a change in direction of the gravity vector and an acceleration at th same time. If one of the two were constant you would not have a problem.
You cannot apply the referred method on a single axis. It is only valid for the total acceleration vector.


My previous answer was not very accurate. The methods used in the article assume zero rotation over measurement time or zero acceleration over measurement time. Otherwise they cannot be valid.
My NXT blog: http://nxttime.wordpress.com/


Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest