Why not use a shaft encoder or pot to read the rotation of each joint?
Using an accelerometer to read the rotation around an axis will have to be differentiated to give you a the amount of rotation, but won’t give you an absolute position. Also, you have no reference.
You can of course read the gravity acceleration vector, but that would be slightly off with any movement of the arm. Plus, you’d want a 3D accelerometer for each prismatic element.
Actually, many accelerometers detect the force of gravity, so laying on a table, the z axis reading would be different than in the x and y directions (which could both be calibrated to be zero acceleration). As you tilted the sensor, the force of gravity would be “transferred” to the x and y axes as vectors, which you could use to determine the angles.
FYI - I used one of these on my PhantomX Hex with the legs modified like Kåre (Zenta) did and the code detects when the robot is right side up or upside down and changes the leg positions. You can see this in action in the video that Kåre shot, which is up on the thread: forums.trossenrobotics.com/showt … omX-(video
The early part of the video shows where we mounted the sensor and maybe about 2:45 in the video shows this sensor in action.
The first thing is the Servos have a 300 degree rotation (They also support continuous rotation).
The Femur servos can more or less go ±90 degrees.
The Tibias can pretty much go ±150 degrees after the changes that Zenta first did. We also have the tibia pointing straight out at 0, when we assemble it with this mod.
My intent is not so much to measure absolute angles or positiins. I want to find if the robot has “rotated” about a central axis. I know a gyro can give me that kind of information - the yaw.
The 2 D accel seems suited to pitch and roll measurements when mounted “flat” or horizontal - parallel to earth’s surface. What I wonder is what will show up if I mount it vertically along one of the axes - will it show rotation about that axis ?
I will mount it vertically and see what happens but if anyone has already tried this it would be good to know what was rhe result.
Thanks!