So I have a robot project where it needs to drive around and pick up golf balls. The idea my team and I came up with is to use arms to push the balls when a sensor on the arm detects the robot. We are going to use a servo to control both arms by gear system. My question is while its driving forward and detects a ball, is there a way to keep driving forward while the servo arm sweeps the ball into a collector?

Yes it's possible, but note that the Servo library disables PWM output on some pins and some motor shields use those same pins to provide PWM speed control. If you want to use both in the same project, make sure your motor shield doesn't clash with the Servo library.

I only provide help via the forum - please do not contact me for private consultancy.

Yes.I don't see the problem. Start the motors, the robot moves forward and does not need intervention from the Arduino to keep it going.Now do anything you like with the Arduino.

You say that the robot will drive around. How will it know which way to go, when to turn and when to stop going forward because of an obstacle that is not a golf ball ?

Basically the robot is just going in a square path. Id like to have a counter within the program that will turn the robot a certain counts since there is a set number of balls placed. So for example when the counter hits 3 it knows to stop and turn 90 degrees and continue to drive and collect til another number is reached then stop and turn, etc. The golf balls are placed at the same place for every trial run so it wont need to know to turn at different places.

GoForSmoke: Not really sure what your talking about? If you mean using the one servo to control both arms, the purpose for that is to free up ports on the arduino for other needed sensors.

PeterH: Thanks for the information. I have the arduino brand motor board rev 3, do you know if that will interfere? I am new to arduino and tried looking into libraries but from what I can see they are basically programs that act kind of like functions for scripts. Not sure what the servo library even does? If you have any information that would be great

I have no idea if this will work since we havent had the change to hook any motors or sensors up yet, but this is the hopefully beginning of the coding. I looked around to find coding and based whats written off of that so not sure if this will sync up or what but theres the start.

Hard to show but each . is a golf ball. The only lines are a cross horizontal and vertical intersecting through the box in the middle. I didnt put in the vertical line but it is in the middle of the track where the four . are lined up vertical.

The one idea we had was to have two distance sensors on one side of the robot (front and back) that is closest to the outside wall of the track and if they are the same value the wheels spin the same speed. If one is greater than the other then the wheels spin different speeds to correct it then continue at the same speed when the distance is the same again.

Any input or opinion of that idea would be greatly appreciated.

Thanks for everyones help so far. I am very new to the arduino coding. The only background I have is a digital electronics class where we used the board of education. But then again we only had little time with the board doing some very basic programs.

Using the outer walls to provide a distance measurement and keeping the robot parallel to them sounds like it could work.

Is the objective to collect as many/all of the golf balls in the shortest possible time or something else ? Using the vertical and horizontal lines would allow you to collect 8 of the balls using a line follower and the distance of the outer balls on the lines indicates the distance to maintain away from the wall to get the other 4.

What you need to do is to work out the shortest path for the robot to travel to collect all the balls using the lines and the walls as reference points. What sort of size is the pattern and how big will your robot be ?

Please do not send me PMs asking for help. Post in the forum then everyone will benefit from seeing the questions and answers.

Using the outer walls to provide a distance measurement and keeping the robot parallel to them sounds like it could work.

Is the objective to collect as many/all of the golf balls in the shortest possible time or something else ? Using the vertical and horizontal lines would allow you to collect 8 of the balls using a line follower and the distance of the outer balls on the lines indicates the distance to maintain away from the wall to get the other 4.

What you need to do is to work out the shortest path for the robot to travel to collect all the balls using the lines and the walls as reference points. What sort of size is the pattern and how big will your robot be ?

The design that my team has come up with involves driving down the middle of the balls and collecting the balls on each side of the bot at the same time. Basically you have 8 balls on a large outside square and 4 on the inside, smalled square. Our idea is to have the robot do a path in the middle of these two squares and when it senses a ball on the outside arm (on the "large square") it will swing both arms on each side to collect any balls there.

The track is 8'x8' with the outside perimeter of the 8 golf balls 16" from the outside wall. The balls on the out most "square" are spaced 36" apart and the balls that line up on the lines are 16" apart. We have already designed how to collect the balls on one trip around the track. Our robot is 7.5" wide before the arms swing out. Once they swing out, it will have a "wing span" of about 18". Provided the wall sensor(s) mounted on the chassis of the robot, it would have to read the wall from about 20" away.

Our task is to collect all 12 balls and deposit them in the middle box under a minute. Our goal is to do this in under 30 seconds. We think it can be done a lot quicker but that is the goal we have set for now. Its the reason that we are trying to collect all of the balls on one trip around so its quicker and less travel the robot would need to do.

*edit: the robot's dimensions are 11.5" long x 7.5" wide which is set by the design we have and then the height can be up to 10" but with our design to get the balls into the center box we will have a chassis plate about 4" high and then another, smaller, plate at about 7" high that will hold the micro controller and circuits.