Autonomous bot using Augmented Reality
Hello Guys , hope you are enjoying the lockdown :-P . In this post I will describe how my app Augmented Aurdino can help you make your own autnomous bot that goes to anywhere you to tap on the screen without using sensors, using augmented reality.
You can make your simple car powered by bluetooth from here https://www.instructables.com/id/Arduino-Bluetooth-Controlled-Robot-Car-1/ , do make sure to change the aurdino code to the one which I will be attaching in this post . Once you have made it you can simply download the app from the link attached at the end of the post. The app connects to the bluetooth module and provide specific pwm signal values to the left and the right motors depending upon the angle to the goal.Once it is at a distance of 0.3m from the goal it stops.
App Link:
https://drive.google.com/open?id=1EOpJkwd3-Ewcb9i1P2qDebL6Djz2CuoN
Note app may not be supported on older android devices running before android nougat.
Thank you , do share with others and if any bug or doubt please send mail at agarwalaryan484@gmail.com
How to implement?
Since augmented reality works on computer vision, therefore you need to scan the surrounding for the app to detect the floor in your house, this may take a while according to the design of your floor tiles, if it has more distinctive feature it can be fast.Once detected you can place the android bot to the location where you want your car to go. After doing this , connect the app to hc05 bluetooth module, it should be paired previously in order to be visible in the app. Once connected you can place the phone in the center of the robot car and start the navigation.The app decides the distance and the angle to the goal and compute the left and the right pwm signal value according to goal. Suppose you want to turn left then signal values will be right 130, left 0. If you want to go straight signal values will be right 130,left 130. The angle offset to the goal is 10 degrees in order to avoid overshoot , be free to play with signal values by incrementing or decrementing the same in the aurdino , make sure the deafult value from the app is 130 .If the robot is overshooting try to decrease the signal values.How does it work?
Our phone and destination are having some world coordinates decided by google ar core technology . The first strategy is doing the cordinate transformation and making our phone the origin , once done the coordinates of both will be changed . You can compute the vector between between phone and goal and compute its angle with the default world x axes of the camera . Then you can calculate the angle between the line of vision of camera and the origin. Once done you can simply take the difference between the two and implement the controller (p in my case :-p) to minimize the error and reach the destination.Aurdino Code:
int pwm_left=0;
int pwm_right=0;
void setup() {
pinMode(9,OUTPUT); //left motors forward
pinMode(12,OUTPUT); //left motors reverse
pinMode(11,OUTPUT); //right motors forward
pinMode(8,OUTPUT); //right motors reverse
Serial.begin(9600);
}
void loop() {
int voltage=0;
if(Serial.available()){
int available = Serial.available();
for(int i=0; i< available; i++){
char a = Serial.read();
int c =(int)a - 48;
if(i != 3){
voltage *= 10;
voltage += c;
}
if(i==2){
pwm_right = voltage;
voltage = 0;
}
if(i==6){
pwm_left = voltage;
}
}
}
analogWrite(9,pwm_left);
digitalWrite(12,LOW);
analogWrite(11,pwm_right);
digitalWrite(8,LOW);
delay(100);
}
https://drive.google.com/open?id=1EOpJkwd3-Ewcb9i1P2qDebL6Djz2CuoN
Note app may not be supported on older android devices running before android nougat.
Thank you , do share with others and if any bug or doubt please send mail at agarwalaryan484@gmail.com
Comments
Post a Comment