MSU Logo MyRIO Robot Project

Home Components LabVIEW Tutorial Videos LabVIEW Programming Acknowledgment

Cart Photo
user interface

Introduction

    The objective of this lab is to apply PI (proportional-integral) control to a two-wheel cart which is driven by two motors via NI myRIO. Given the desired velocity and orientation, the cart should be able to steer properly while keeping the velocity unchanged. To make such control design feasible, two encoders are implemented to measure the rotational speed and orientation of the motors respectively. In addition, pulse-width modulation (PWM) is used to regulate the driving voltage which is the input of each motor.

    The control process will work in the following way:

    The user gives the command (desired linear velocity and angular rate) to NI myRIO. The command can be further transformed into desired speed for both left and right wheel by kinematics, in RPM (revolutions per minute). The encoders measure the motor speed in counts, which is also converted into RPM. The resulting linear velocity and angular rate are compared with the user-defined ones, where the differences are calculated. These differences are called error, which are the inputs of the controller. The controller is a discrete PI controller. The output of the controller is the desired voltage that is going to drive the motors. Thus, a closed loop control system is constructed.

 

1. Vehicle Motion Principle

    The autonomous vehicle is modeled as a rigid body that satisfies some constraints, which means the motion of the system is not completely free. They are in which the instantaneous velocities of system components are restricted, thereby limiting the local motion of the system. This means that the mobile vehicle cannot move sideways based on the principle of a rolling wheel. 

2. Model Kinematics

   Kinematics is the study of the mathematics of motion without considering the forces that affect motion. It deals with the geometric relationships that govern the system and develops a relationship between control parameters and the behavior of a system in space. According to the vehicle model, the linear speeds of the right and left wheels, Vr and Vl are related to the angular speeds as follows:

Eq1

    where,   and   are the angular velocities of the right and left wheels, respectively. The total linear and angular speed of the vehicle can be calculated as Eqs. (3) and (4). In order to specify the position of the vehicle on the plane, a relationship between the global reference frame of the plane and the local reference frame of the vehicle are established. The vehicle in a state of motion must always rotate about a point that lies somewhere on the common axis of its two wheels. This point is often called the Instantaneous Centre of Curvature (ICC).

    The vehicle’s coordinates (x,y) and its orientation (ψ) changed with respect to time can be calculated using the following equations.

Eq2

    From the Equations (4)-(6), the kinematic model of the mobile vehicle with two independently driving wheels can be represented in Cartesian model as Equation (7).

Eq3

where, X and Y are position variables, ψ is a heading direction angle (yaw angle), Vc and ωc are the forward velocity and the rotational velocity (angular velocity) of the vehicle, respectively.

    Rearranging the above equations, the position and the orientation of the autonomous vehicle can be determined by a set of differential equations as below:

Eq4

   These principles guide you through the process of writing the program.


.