I just wanted to see if my Idea will work.
It is a simple code to make a 4-motor drivetrain turn 90 degrees right with the inertial sensor.
Any help or constructive suggestion will be appreciated.
This won’t do what you expect it to do. The turnFor command will use the internal encoders to turn and the motors will stop. You will then pause until the the inertial sensor reads greater than 90, which may never happen. To do a 90 degree turn with an inertial sensor you need to do the following steps.
- Measure where you are at. What is the current inertial sensor reading?
- Turn in the right direction, turn for an unspecified time.
- wait until the inertial sensor reaches your angle.
- stop the drivetrain.
4 Likes
Adding to this, it would probably be helpful to use a PID (or PD or even just P) controller to dampen the speed of the robot and prevent the overshoot that will 100% happen if you dont dampen it.
4 Likes