A user manually supplies a destination in polar coordinates (r, θ), and an algorithm was developed to move the vehicle along a circular arc to the destination. Theta inputs to this algorithm are restricted to the interval [-90°, 90°], but any desired destination can be reached with a series of (r, θ) inputs, potentially including a combination of forward and reverse arcs. Sketches of the vehicle’s destination input and wheel motion are included below. Note also that the new reference frame of the vehicle has rotated 2θ with respect to the original reference frame.
The velocity of the unloaded motor was measured using a Python script entitled MotorEncoderTest. In this experiment, the motor and encoder wheels were coupled so that the encoder accurately read the velocity of the motor. This test confirms that the ESC is able to accelerate the wheels to a desired velocity and maintain a relatively constant velocity.
The MoveToX Python program was written as a rudimentary method of moving the vehicle forward to a desired position based on encoder feedback. The program ran a main feedback control loop, calling Encoder.sample() on each encoder every 20 ms, and making control decisions based on that data. However, when tested on the vehicle, MoveToX revealed that the motors did not have sufficient stall torque to start the vehicle. The vehicle made a few small forward and reverse movements, similar to the response seen in MotorEncoderTest. Unlike the unloaded response tested in MotorEncoderTest, however, the rotors were never able to rotate fast enough to follow the rotating magnetic field created by the motor coils, and only twitched in place.
A Simulink model of the vehicle was developed as a tool to evaluate this method of control. See the image of the top-level diagram, and an image of one sub-system designed to simulate a motor/encoder combination.
The position error is fed through a PID controller to acquire desired velocity, which is compared to actual velocity to acquire a simple estimate of desired acceleration.
The simulation was executed using the parameters for turning as mentioned previously: (r, θ) = (1.404, 45°). The results for the vehicle, in the figure below using a gear ratio of 100.