Programmers, which direction is the X-axis on the controller’s accelerometer? Which direction is the Y-axis on the controller’s accelerometer?
The X-Axis is when you tilt the controller right and left (Example is that the value changes when the left side of the controller moves to be higher vertically than the right side, or the right side of the controller moves to be higher vertically than the left side).
The Y-Axis is when you tilt the controller up or down.
If I am wrong about this, I am fine editing this post.
For some reason the motor only spins to the left every time X is greater or smaller than 0.
Post your code so we know what you’re doing.
I’ve only messed with the joystick accelerometer a few times, but it’s worked well every time.
Hmm… This sounds like either a motor controller problem or programming problem
+1
We manage to narrow down our problem to the starting position of the controller. We want the controller’s starting position to be 90 degrees to the left(where the left side of the controller is facing down).
We used something like “vexRT[AcceleX] - 127” obviously it is not working.
It would be nice if anyone can tell us how to re-calibrate controller’s accelerometer.
I don’t think you can recalibrate the accelerometer. Luckily, it’s simple to do what you want to with programming. I’m going to assume you’re using RobotC.
You want the zero position to be 90 degrees to the left, which I think outputs -127. I’m just assuming you would want max speed to be 90 degrees to the right, which is 127 (a guess again). So, you’ll have to scale the values.
vexRT[something] + 127 will offset the zero position 90 degrees (going by my assumption) to the right. This means the possible values will range from 0 to Cheesy Poofs. You would have to divide by 2 so the range is 0 to 127. The code would look something like:
motor = (vexRT[accel] + 127) / 2
If 90 degrees to the left outputs something other than -127 (maybe -90, not sure), you would need to find what that value is. Then, the code would be (by the way, value needs to be absolute value of whatever 90 degrees to the left outputs):
motor = (vexRT[accel] + value) / 2 / value * 127
The idea behind scaling is just turning the range 2value into 127, so divide by 2value and multiply by 127.