View unanswered posts | View active topics It is currently Thu Aug 13, 2020 7:29 pm

Reply to topic  [ 3 posts ] 
Class Project 
Author Message

Joined: Fri Jun 28, 2013 1:20 pm
Posts: 1
Post Class Project
I am taking an 'Intro to Mobile Robotics' this summer and decided to sign up for the Summer of Robotics learning after I found out the online class I am in has no lectures other than a link to the RobotC tutorials.

I have viewed all the RobotC tutorials and some programming experience through college but I am very insecure about my programming abilities.

My first two class projects consisted of line following which I had no problem with, then wall following the inside and outside of a maze (half maze really) in three configurations with the same program. Two mazes were box shaped, the third was a circle. I used the ultra-sonic sensor to find my way out of the maze to a goal box, did a u-turn and followed the wall back to the finish box. The square boxes worked ok but the circular maze did not work so well with the ultrasonic sensor as I approached the wall at an angle, it continued to crash into the wall. I ran the program over and over tweaking various values, nearly getting it to complete the circular maze based on factors of changing swing arc, changing sensor distance and even just moving the robot's starting point to the right or left. In the end I stayed up until 3am and could not get the circular maze completed satisfactorily.

I am now on my third project which consists of 3 maze configurations again, two boxes and one circle. 5 balls are in the center of the maze. The robot starts in the center of the maze, seeks a ball, grabs the ball, follows the wall to the outside goal, does a u turn, follows the wall (opposite direction), enters maze to grab another ball (repeat four times), after four balls dropped in goal box, return to center of maze finish box.

My first problem was actually building a bot that I thought could accomplish this maze. All I had was the education base set and I quickly found out this was not enough. I raided my kids closets for as many pieces as I could find and the Lego Education expansion set is on its way, but I think I will have to finish this maze before it gets here. So far I have built a Castor Bot with a claw and an ultrasonic sensor to detect the ball at the base. There is a V shaped attachment on the front modeled after the Ball Hunter from NXT programs but I had to modify a bit because I am using table tennis balls, much smaller than the NXT red ball. I made a bumper for the back using the logic that I could turn around and follow the wall in reverse because I didn't want the bumper to interfere with the ultrasonic sensor and ball up front.

Right now, I am still working on pseudocode for this maze. I typically set it up in my garage with wood blocks and emulate the motions and running the maze to write down what I think I need to do.

I wrote functions for my last maze which kept my code simple and clean and for me, easier to understand. I will put that code at the end of the post.

The pseudocode for this maze is as follows:

move forward until ball detect
if ultrasonic sensor detects ball - lower claw(motorA)

180 degree turn
reverse forward until touch sensor hits wall

while goal box not detected
forward half second
reverse right until touch sensor hits wall

if goal box detected with color sensor
raise claw(motorA)

reverse left
forward half second
reverse left until touch sensor hits wall

if finish box detected

Here is the actual code from my first program which wall followed the exact mazes I need for the ball maze, just without seeking and delivering balls to a goal:

#pragma config(Sensor, S1,     lineSensor,     sensorLightActive)
#pragma config(Sensor, S4,     sonarSensor,    sensorSONAR)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

|*                                                                                                        *|
|*                                   - Obstacle Detection with Sonar -                                    *|
|*                                            ROBOTC on NXT                                               *|
|*                                                                                                        *|
|*  This program runs your robot forward until it detects and obstacle, at which point it stops.          *|
|*                                                                                                        *|
|*                                        ROBOT CONFIGURATION                                             *|
|*    NOTES:                                                                                              *|
|*    1)  The Sonar Sensor should be somewhere on the FRONT of the robot, facing FORWARD.                 *|
|*                                                                                                        *|
|*    MOTORS & SENSORS:                                                                                   *|
|*    [I/O Port]              [Name]              [Type]              [Description]                       *|
|*    Port B                  motorB              NXT                 Right motor                         *|
|*    Port C                  motorC              NXT                 Left motor                          *|
|*    Port 4                  sonarSensor         Sonar Sensor        Front mounted, front facing         *|

void DriveForward()
 motor[motorC] = 25; //move forward both motors
 motor[motorB] = 25;

void BackwardRight()
 motor[motorC] = -15; //reverse C
 motor[motorB] =  10; //slight forward B

void BackwardLeft()
   motor[motorB] = -15;
   motor[motorC] = 10;

void ForwardRight()
  motor[motorC] = 28;//forward right C
  motor[motorB] = 19;//slight forward right B

void ForwardLeft()
motor[motorB] = 28;
motor[motorC] = 19;

void Stop()
   motor[motorC] = 0;
   motor[motorB] = 0;

task main()
  int distance_in_cm = 27;   // Create variable 'distance_in_cm' and initialize it to 20(cm).


while(SensorValue[lineSensor] > 43) //loops while floor detected is lighter than goal box
 if (SensorValue[sonarSensor] < distance_in_cm)//if wall is detected
}//end if
 }//end else
}//end while


while(SensorValue[lineSensor] < 61)//loops while floor detected is darker than white finish box
    if (SensorValue[sonarSensor] < distance_in_cm)//if wall is detected
}//end if
 }//end else


}//end program

I am sorry for such a long post, but I am a little overwhelmed working on this project alone and the forums for my class are not helpful. My main questions to help me proceed at this point are:

Will the touch sensor design work to follow the wall effectively for an inside and outside of maze? Is it going to be difficult since I mounted the bumper on the back of the brick?

I had issues before with the ultrasonic making the turns around the opening of the maze and got to the point of drawing a circle around the opening and trying to figure out a mathematical value for the arc to determine the best swing arc, is there a better way to do this?

I am having a hard time wrapping my head around seeking out the additional balls when I am back in the maze. In the beginning of my pseudocode, I simply go forward to find the ball because it is in front of me. After I follow the maze wall to the goal and back to the inside again, the balls are in random places and if I go forward I may never find a ball (just run into a wall). There is a simulator video that shows the robot entering the maze and after sensing the wall a second time on the inside, it turns around and seeks the ball. I am not sure how it knows it is back inside the maze..

Again, so sorry for the long post and I don't want code given to me, but any ideas about how to think about this, even if I need to redesign the bot and my pseudocode I am very open. Thank you so much. ...

Fri Jun 28, 2013 2:03 pm

Joined: Thu May 02, 2013 7:35 am
Posts: 2
Post Re: Class Project
There are hundreds of robotics projects available on Internet. Just need proper searching to find the type of projects are you looking for.

My Son had to prepare a projects related to robots. I helped him to find projects. Fortunately, i got a website full of robotics projects i.e I downloaded few sample projects and with the help of it prepared a good robot project.

Sat Jul 13, 2013 2:10 am
User avatar

Joined: Fri Nov 02, 2012 12:07 am
Posts: 163
Location: California, USA
Post Re: Class Project
On youtube "Schuyler Horky" has some good ones. Good luck programing! :bigthumb: :D

string Robored = "Awesome"
~~Neil Balch~~

Fri Aug 02, 2013 9:01 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.