Thursday 17 October 2019

EV3 Stair Climber (Climbs Stairs of Size 15 cm)

I have assembled the Stair Climber robot as per the instruction manual given here. In this post, I am explaining the details about the robot which I understood. The front part of the robot is a complete "car". This car is attached with two Lego pins, to the rotating belt. A motor is driving the rotating belt to elevate the back wheels and middle wheels of the car. If the belt rotates anti-clockwise, middle wheels come up. If it rotates clockwise, the back wheels come up. The back wheels of the robot, are for keeping the robot stable when all 4 wheels of the car are up in the air. Front wheels are moving with high speed and they are climbing up due to thrust. There is a "gyro sensor" attached to the robot which made me know how much the robot is oriented in "space". It gives me the angle with which the robot has elevated from flat surface. When this angle goes above a certain threshold, I elevate the middle wheels. That's how the entire car goes up. Once the car reaches in a horizontal position on a stair, I bring up the last pair of wheels. To make things clear, there are two phenomena happening in this assembly: Driving and Lifting of the wheels. The following points are worth noting about the robot movements. 
  • The medium motor and one large motor are responsible for driving the back and front wheels respectively to move the robot forward
  • Another large motor is responsible for lifting the middle and back wheels 
  • The middle wheels are not driven, they are only lifted. They are present for proper balance of the car.
The A small video clip showing the performance of the robot is given below. Also, I am sharing the program for the robot movements. Let me explain the program in detail: The program begins with initializing all the three motors. The motor which drives the back wheels is the medium motor connected to port A. It is initialized with speed of 450 degrees per second. The motor which lifts the middle wheels and back wheels is a large regulated motor connected at port D. It is initialized with speed of 180 degrees per second. And lastly, the motor which drives the front wheels is the large regulated motor connected at port B. It is initialized with speed of 630 degrees per second. The front motor is intentionally set at a high speed to achieve a large thrust from the stair. The large thrust, help the front wheels move up on the stairs. The speed of the rest of the two motors is initialized based on observations about how fast/slow the motors should move. 

The touch sensor is connected at port S2 and initialized in Touch mode. This initialization helps in identifying whether the front button on the touch sensor is pressed. However, I am not making use of the touch sensor in this program. Ideally it could be used to stop the robot when it climbs all the stairs. I am programmatically stopping the robot after 2 stairs. The gyro sensor is connected at port S3. It is reset and then initialized in Angle mode. The angle mode returns the rotation angle in degrees since last reset. 

The main program begins with moving the front and the back motors forward with the function moveTheRobotForwardWithFrontAndBackWheels(). (NOTE: if you dig deep into the function, you will realize that if I rotate the motors backwards, the robot moves forward. It looks like there is some issue with my connections or the robot wheel alignment. However, apart from this issue, there is no cause of concern with the functioning of the robot further.) In the process of moving forward, the robot also starts collecting the Gyro sensor and the Touch sensor samples. If the Gyro sensor sample is less than -15 degrees (please remember, our robot is rotating counter-clockwise while climbing up the stairs, which will result into negative Gyro sensor angle.), two things happen: First, the speed of the lifting mechanism and the speed of the back wheels changes to 630 and -121 degrees per second respectively. (NOTE: the present name of the method is changeTheSpeedOfBackAndMiddleWheels(). Instead the name should be changeTheSpeedOfLiftingAndDrivingOfWheels(). The present name is causing a lot of confusion. However, if we rename the method and use it, the confusion will be gone!) I have kept the speed of the back wheels in negative, which will drive the back wheels backwards. This method results in front wheels moving forward, back wheels moving backwards and middle wheels getting lifted. This movement does not allow the robot to topple. The following little figure will make these movements clear. 



Please also note that the forward speed of the front wheels (630) is much more than the reverse speed  of the back wheels (-121). So in essence, the robot will move forward. However, because of the negative/backward speed, it will be protected from toppling from the stairs. Second, the middle wheels get pulled up until the gyro sample is negative. 

Once the gyro sample turns positive, the pull up of the middle wheels will stop and the flag singleStepDone will be set to true. There are certain steps to be performed once single step is done. They are: 
  • Make the robot move forward on the stair until the front and the middle wheels set properly on the stair
  • Back wheels which were on a negative speed and moving backwards as shown in the above figure, are now set to move forward with a positive speed of 540
  • The back wheels are lifted by moving the large motor clockwise. Please take a look at the two methods for pulling up the back wheels (method: startPullUpTheBackWheels()) and for pulling up the middle wheels (method: pullUpTheMiddleWheels()). You will find that they rotate the motors in opposite direction as explained in the first paragraph of the article. 
  When all the steps are done, the robot will stop by stopping all the three motors. 



No comments:

Post a Comment