## Re: Labyrinth maze solver

Expand Messages
• Dan, I made some improvement with the PID algorithm. Earlier in the video, the motor kept spinning even after the ball has reached the other side whereas now
Message 1 of 19 , Jul 6 8:29 PM
• 1 Attachment
• 647 KB
Dan,

I made some improvement with the PID algorithm. Earlier in the video, the motor kept spinning even after the ball has reached the other side whereas now the motor changes direction as soon the ball reaches other side ( I cannot stop laugh seeing the improvement so far :-) )

Now, I am not sure about the way I have implemented the PID algorithm. The input to the stepper is time and number of steps. But I am just using the position data in my PID algorithm i.e I am just altering the number of steps and my maze goes +/-100 alternatively. I have also limited the number of steps with a ceiling of not more than the +/- 100 steps. As of now, if the ball is to the left and trying to approach the center, it would just roll away to the other end and keep swinging back and forth. I am using the position vector and calculating the velocity and acceleration vectors.

Is this the right method? I am not convinced whether it would make sense to make use in the difference between two frames and use something like a Kalman filter using timestamp information and calculate the ball velocity.

How should I convert the convert the PID algorithm into time and steps data? When I tilt the maze even the smallest distance, my maze's ball is on a roll! I can certainly eliminate issues due to image processing. I am totally clueless about a solution for this problem. Should I keep tilting the maze in opposite direction with a separate command.

In order to get the coordinates of the trajectory, I used blob analysis technique and rendered my trajectory information on the original image and extracted the trajectory information completely as shown in the attached image. I have some information on the waypoints the ball has to follow. I will have to make it follow a simple straight line using the data.

Sai

• It also sounds suspiciously like a serial buffer overflow. Have you tried turning on either hardware flow control (RTS/CTS) or software flow control (XON/XOFF)
Message 2 of 19 , Jul 6 11:19 PM
• 0 Attachment
It also sounds suspiciously like a serial buffer overflow. Have you tried turning on either hardware flow control (RTS/CTS) or software flow control (XON/XOFF) to see if that fixes it? Does the data sheet say that it requires one or the other? Can you put fixed delays in between each command to get it to work again (even if not at the update rate you want)?

-Dan

On Wed, Jul 6, 2011 at 7:50 PM, yamanoor sairam wrote:

Thanks,

Sai

--- In SeattleRobotics@yahoogroups.com, "David Buckley" <david@...> wrote:
>
> It sounds suspiciously like it is a software problem on the board and not fixable.
> Try using a different make of board.
> David
>
>
> ----- Original Message -----
> From: yamanoor sairam
> To: SeattleRobotics@yahoogroups.com
> Sent: Thursday, July 07, 2011 2:28 AM
> Subject: [SeattleRobotics] Re: Labyrinth maze solver
>
>
>
> The weird stepping problem occurs when the board is sent signals continuously i.e if you keep changing the speed by varying the time duration of rotation and the number of steps continuously. However, this weird action could be stopped by disabling the motors with a command at any time.
>
> Sai
>
> --- In SeattleRobotics@yahoogroups.com, "David Buckley" <david@> wrote:
> >
> > Well since you are using Linux that eliminated one possible cause but whther Linux does similar stupid things I can't say.
> > It sounds from what the designer of the board says that there is something wrong with it's design unless it only happens when the motor is being held in a fractional step position. Can you turn off microstepping? If you do and it still happens when the motor is stopped then the board is bad.
> >
> > ----- Original Message -----
> > From: yamanoor sairam
> > To: SeattleRobotics@yahoogroups.com
> > Sent: Saturday, July 02, 2011 6:23 AM
> > Subject: [SeattleRobotics] Re: Labyrinth maze solver
> >
> >
> >
> > >>> How does the controller get its cmnds? Is the computer sending >>>garbage from another program? Windoz does that sort of thing, or >>>are the inputs picking up noise?
> >
> > The controller gets commands via USB serial port. I am using a Linux operating system. The motor doesn't spin but it vibrates my system slightly. I wrote to the guy who designed the board and he says that just the humming noise is common. I am not sure whether this is fine..
> >
> > Sai
> >
> > --- In SeattleRobotics@yahoogroups.com, "David Buckley" <david@> wrote:
> > >
> > > >I am currently trying to solve a problem where the stepper motor controller while waiting >for commands from my computer, just starts spinning in random! I have to disable my >motor and enable it to stop this from happening
> > >
> > > How does the controller get its cmnds? Is the computer sending garbage from another program? Windoz does that sort of thing, or are the inputs picking up noise?
> > >
> > >
> > > ----- Original Message -----
> > > From: yamanoor sairam
> > > To: SeattleRobotics@yahoogroups.com
> > > Sent: Thursday, June 30, 2011 2:22 AM
> > > Subject: [SeattleRobotics] Re: Labyrinth maze solver
> > >
> > >
> > >
> > > Hello Dan,
> > >
> > > Thanks for the reply. That was a great idea again!
> > >
> > > So I was discussing your suggestion with some one and it occurred to me that I didn't consider the use of an accelerometer to measure the angle of tilt and keep the maze level in order to retain a ball at the same point. But would that really be necessary?
> > >
> > > If I rotate my stepper x steps to tilt the maze in one direction and move the ball, ideally x/2 steps should make my maze 'levelled'. This is something that I am trying now and I will have to eliminate the need of another sensor here. ( I really don't like to disturb my beautiful setup as it would involve removing wood screws from that board!)
> > >
> > > I am currently trying to solve a problem where the stepper motor controller while waiting for commands from my computer, just starts spinning in random! I have to disable my motor and enable it to stop this from happening.
> > >
> > > Sai
> > >
> > > --- In SeattleRobotics@yahoogroups.com, Dan Tebbs <dantebbs@> wrote:
> > > >
> > > > Hey Sai,
> > > >
> > > > Sounds like you're making great progress.
> > > >
> > > > I wonder if the confusion which is dogging you is the difference between a
> > > > classic "static balancing" PID, and this "dynamic" PID. I suggest that you
> > > > start with the static solution first, and then perhaps it will become clear
> > > > how to move from a static solution into a dynamic one, as a separate step.
> > > >
> > > > So your first goal is to start the marble at the "288" position, and then
> > > > get your PID to balance it somewhere in the middle of that first straight
> > > > segment, say around 215. This will relate very well to the classic PID intro
> > > > challenge where you are balancing an inverted pendulum. When that is
> > > > working, it will move the ball to the target point (at 215). If you then
> > > > perturb the ball, the PID will again return it to position 215.
> > > >
> > > > Next, simply get it to work on the other axis too. At that point you could
> > > > turn on both PIDs and balance the ball around a specific point on a plane.
> > > >
> > > > At that point, I think you can see that at each time frame, you can move the
> > > > PID's "balance point target" slightly along the path, and the PID will
> > > > automatically react appropriately.
> > > >
> > > > -Dan
> > > >
> > > >
> > > > On Tue, Jun 28, 2011 at 5:33 PM, yamanoor sairam <yamanoorsai@>wrote:
> > > >
> > > > > **
> > > > >
> > > > > [Attachment(s) <#130d8d1e5a9341a6_TopText> from yamanoor sairam included
> > > > > below]
> > > > >
> > > > > Hello Dan,
> > > > >
> > > > > I have attached a screen shot of my progress so far. I found your
> > > > > suggestion to be valuable. I am trying a single dimension now.
> > > > >
> > > > > So far, I have taken the black line's contour as shown in the attached
> > > > > image. This is helpful to me in the path planning. I have also matched the
> > > > > template of the ball. I am able to print the coordinates of the ball and the
> > > > > coordinates of the black line in my maze.
> > > > >
> > > > > My computer says that the ball is at 466,288 and lets say I would like to
> > > > > move to 466,152 ( the end of the straight line on the image).
> > > > >
> > > > > I am confused about implementing the PID algorithm here. The format based
> > > > > on which my stepper motor controller accepts the commands is that
> > > > >
> > > > > Time,Number of Steps,Axis 1 motor, Axis 2 motor.
> > > > >
> > > > > I thinking about the feedback that I should use for the PID algorithm. The
> > > > > template matching algorithm is not able to find the ball while it is
> > > > > spinning and my stepper would just push the ball to other side into a hole
> > > > > :(
> > > > >
> > > > > I am planning to use several waypoints in the maze to solve the problem.
> > > > > Should I do it like 288,268,248... 158 and try correcting the error?
> > > > >
> > > > > Sai
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Dan Tebbs
> > > > Auric Consulting LLC
> > > > Ph: 425-341-3261
> > > > Email: AuricConsultingLLC@
> > > >
> > >
> >
>

--
Dan Tebbs
Auric Consulting LLC
Ph: 425-341-3261
Email: DanTebbs@...
http://www.AuricConsultingLLC.com

• Hey Sai, I think at this point we need to spend some time at a whiteboard looking at the design. Please contact me off list, and let s get together to go over
Message 3 of 19 , Jul 6 11:25 PM
• 0 Attachment
Hey Sai,

I think at this point we need to spend some time at a whiteboard looking at the design. Please contact me off list, and let's get together to go over it.

-Dan

On Wed, Jul 6, 2011 at 8:29 PM, yamanoor sairam wrote:

[Attachment(s) from yamanoor sairam included below]

Dan,

I made some improvement with the PID algorithm. Earlier in the video, the motor kept spinning even after the ball has reached the other side whereas now the motor changes direction as soon the ball reaches other side ( I cannot stop laugh seeing the improvement so far :-) )

Now, I am not sure about the way I have implemented the PID algorithm. The input to the stepper is time and number of steps. But I am just using the position data in my PID algorithm i.e I am just altering the number of steps and my maze goes +/-100 alternatively. I have also limited the number of steps with a ceiling of not more than the +/- 100 steps. As of now, if the ball is to the left and trying to approach the center, it would just roll away to the other end and keep swinging back and forth. I am using the position vector and calculating the velocity and acceleration vectors.

Is this the right method? I am not convinced whether it would make sense to make use in the difference between two frames and use something like a Kalman filter using timestamp information and calculate the ball velocity.

How should I convert the convert the PID algorithm into time and steps data? When I tilt the maze even the smallest distance, my maze's ball is on a roll! I can certainly eliminate issues due to image processing. I am totally clueless about a solution for this problem. Should I keep tilting the maze in opposite direction with a separate command.

In order to get the coordinates of the trajectory, I used blob analysis technique and rendered my trajectory information on the original image and extracted the trajectory information completely as shown in the attached image. I have some information on the waypoints the ball has to follow. I will have to make it follow a simple straight line using the data.

Sai

--
Dan Tebbs
Auric Consulting LLC
Ph: 425-341-3261
Email: DanTebbs@...