|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Using the ADXL345
I want to be able to click a button on my joystick and have my mechanism rotate to a high point, then also be able to click a second button to set the rotation to a low point. I could do this with time, problem is, the mechanism is quite heavy on the far ends, so the drop time is largely influenced by gravity, but the lift time is much more reliable.
|
|
#2
|
|||
|
|||
|
Re: Using the ADXL345
I would suggest trying the accelerometer and see how well it works out, but without any integrating etc. To calculate the angle just use atan2( y, x ) where the two accelerometer axes are in the plane of rotation. Turns out that gravity is a very well-defined "down" vector that will move along the axes. Of course this will only work accurately when the arm is relatively stationary (not experiencing other accelerations relative to g) so you might need to move the arm more slowly when taking measurements. I'll be curious to hear if it works.
|
|
#3
|
|||
|
|||
|
Re: Using the ADXL345
For what it's worth, gyros are much more accurate in the pitch rotation, which you're attempting to do, at least if you have a smart gyro.
|
|
#4
|
|||
|
|||
|
Re: Using the ADXL345
The best option is to use an encoder. You would attach an encoder to the shaft that rotates, and would not only be able to tell when it is at the endpoints, but exactly where it is, to a far higher degree of accuracy than would be possible with a gyro or accelerometer. You could even pair this with a PID loop to get it to hold position, we implemented something similar here: https://github.com/FRC1458/turtleshe...wigIntake.java.
If you would like additional information about the ADXL345, the original data sheets can be found here: http://www.analog.com/en/products/me...oduct-overview. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|