Showing posts with label Omni Biped. Show all posts
Showing posts with label Omni Biped. Show all posts

Wednesday, 30 May 2018

Omni-Biped with LeJOS

Hello all, please find here our version of Omni-Biped (one creation from Daniele Benedettelli's book 'Creating Cool Mindstorm's NXT Robots'). We have also implemented the exact version of Omni-Biped given in the book, which can be found at the location Omni-Biped. So let me list the changes which we have made in our version of robot: 
  • We have implemented our own additional hardware of the robot, which can be considered a taller upper part of the body
  • We have also implemented the head, which can be moved through 180 degrees, close to human head
  • We have implemented additional software which will move the head through 180 degrees 
Rest of the functions are as per the original version of the robot, which are: We can move the robot forward, backward and make it take a turn. It also moves its head around while turning. All this is done with a small Java program with LeJOS NXJ. Please find the Video clip of the robot's performance and the corresponding Java program below. 




Let me explain the LeJOS program a little. This is a simple program compared to the program inspired by single-Task C program from the book, which I implemented in LeJOS. We have kept this program as simple as possible, just because it is made for children of age 10 to 12. This program does not have the logic for re-align legs in the beginning or after taking a turn. However, we realized that without re-aligning legs, the robot functions almost similar to its original version. That might be because of its solid mechanical assembly. If we set both A and B motors forward, the robot moves forward. If we move the motors backwards, the robot moves backwards. If we move one motor forward and the other backwards, the robot turns. We have used motor C to rotate the head. the head rotates in 90, -180 and 90 degrees sequence. This sequence brings the head back to the original position. This sequence is repeated again and again while turning. Turning and moving the head tasks work parallelly. Please check the below Java program, load it into your NXT kit and see if you get same results. 


Hope you enjoyed the article!

Monday, 7 April 2014

Omni Biped

Below is the Java program for the Omni Biped robot (one creation from Daniele Benedettelli's book 'Creating Cool Mindstorm's NXT Robots'). The main design of the program is inspired by the author's Single Task 'C' program given in the book. The robot walks forward until it encounters an obstacle in front of it. As soon as it encounters an object, it takes a turn until there is no further obstacle on its way. 

Let me explain about the program a bit. The program has two classes, OmniBiped and NXTUtils. The OmniBiped program has the main method which begins with calling the init() method. The init() method resets the tachometer count and realigns the legs. In Lego Mindstorms NXT, units of measurements used are in tachometer counts rather than rotation or degrees. One pulse of tachometer is equal to one degree. To complete one full step, the robot requires 3 complete rotations of the motor. That means it requires 1080 tacho-counts (or 1080 degress). Whereas to complete half a step, the robot requires 540 tacho-counts (or 540 degrees). The realignLegs() method aligns the legs such that the initial position of the legs will be as shown in the following picture. As you should see, the 



After the initial position, the feet take half step which look like below. 



After half a step, the feet take full step which look like below. 




While realigning, the program calculates the right_count and the left_count. These counts represent the number of degrees each leg require to complete a full step, in case the robot stops in an intermediate position of legs. If this count is less than half a step distance, the robot prefers to take the respective leg backwards (because that is much quicker to achieve the realignment). In case if this count is more than half a step distance, the robot prefers to take the respective leg forward. While moving the motors forward or backwards, the tachometer count gets updated. When the right_count as well as the left_count become less than zero, the motor stops that means the re-alignment process stops. 
 
Now let us come back to the main() method. It calls the init() method and realigns the legs. Then the robot begins walking, with both the legs moving forward. That means, the motors moving the respective legs are driving forward. They keep driving forward, until an obstacle occurs at less than 24 cm distance (as defined by the constant NEAR). Once, the obstacle occurs on its way, both the motors stop, the legs are realigned again and the robot moves either left or right randomly based on the direction variable. The direction variable can be either -1 or 0 or +1 (representative of left/right direction). The robot can move in any one of these two directions until there is no obstacle within the range of 50 cm (as defined by the constant FAR). 

The robot measures the distance to the obstacle by the getAvgUltrasonicSensorReading() method in the NXTUtils class. This method averages the distance to the obstacle over 5 samples. I calculated the average in order to smoothen out the spikes in the ultrasonic sensor readings. 

Below is a small clip showing the behavior of the robot. 

  


NOTE: Please look at the commented part of the code carefully and do not consider it. 

If we analyze the movement of robot, it moves straight quite well in the beginning. It also stops when it encounters an object at less than 24 cm. Once the object encounters the robot takes a turn quite well. However the robot appears quite stuck when it approaches the cable and the wall at an angle (not exactly in front of it). When object approaches at an angle, the robot has to take multiple turning movements, which appears quite slow.  

I hope you liked this article!

Reference Sites: