Can R2D2 use 2 or 3 wheels?

How many legs does R2D2 have, 2 or 3 ? What is best ? Try it for your self by building a robot that can run on 2 or 3 wheels.
I have made an app called Blue Tooth R2D2 that uses the accelerometer of an Android device to control a R2D2 like NXT LEGO robot with two or three wheels.
To use the two wheels function the NXT robot needs to have a gyro sensor and to be running the leJOS program SORM. The SORM is a self balancing program based on the Segoway code included in the lejos.robotics.navigation package.
Start by building a robot
The instruction to build a LEGO robot with an Hi Technic Gyro sensor can downloaded using the link on the right panel.
The self balancing robot can also have the Anyway design. More information can be found at
http://robotsquare.com/
Install and run the Blue Tooth R2D2 app
The app can be found at Google Play following this link.
When starting the BTR2D2 app you are presented with three options Drive, Balance and Advanced. The drive option works for any kind of NXT based robot with motors connected to the B and C port. The only requirement is that the NXT is on. The robot is controlled by tilting the android device.
The other options require the robot to run the SORM program.
Upload and run the software to the robot
- Start by installing the leJOS nxj operating system on your NXT brick, follow this link to find the instructions.
- Install Eclipse and the leJOS plugin, follow this link to find the instructions.
- Download leJOS code for SORM using the link on the right panel.
- Start Eclipse and press File->Import, select "Existing Project into Workspace".
- Select archive files and browse to where the SegOlaWayMod.zip file is saved. Press finish.
- Connect the robot to the computer and turn it on.
- In the Project Explorer panel of Eclipse, right click SegOlaWayMod and select Run As->LeJOS NXT Program. The program should start and display "Waiting..."
- Start the BTR2D2 app on the android device and select Balance, wait until the robot starts to beep and put it in balancing position.
- The robot can now be controlled by tilting the android device.
For advanced users
There is also an advanced option where the constants that control the balancing can be modified while running. Press the advanced button and go to the Balancing tab
The text field "Knr:" is for selecting constant.
1 -> kgya, constant for gyro angle
2 -> kgys, constand for angular velocity
3 -> kp, constant for position
4 -> ks, constant for speed
The text field Kval: is for modifying the value of the chosen constant.
1.1 -> increment by 10%
0.5 -> reduction by 50%
The balancing is done by considering an error function
error = (kgys * gyroSpeed + kgys * gyroAngle +
kp * motorPosition + ks * motorSpeed);
What else can you do?
Build an arm and connect it to the A port. Instructions can be found here
Comments and questions
This project is based on the work found at
http://lejos.sourceforge.net/nxt/nxj/api/lejos/robotics/navigation/Segoway.html
https://github.com/Shawn-in-Tokyo/leJOS-Droid
http://lejos.sourceforge.net/nxt/nxj/tutorial/Android/Android.htm
|