- Dec 9, 2000
- 16,528
- 4
- 0
We built a... robot-type machine with 2 degrees of freedom to move a marble through a maze for our design project (it can move in the x-direction or y-direction).
I have encoders on both motors and my program is set up so that I can input a step function, with the amplitude being the numbers of degrees I want the motor to turn, which moves the marble, etc. I coded a PID controller to provide feedback so that the mover stops (after some small transient) when it reaches the point that it needs to be.
However, right now, all my actions are based on time. If I move, say, 10 inches to the right, and then I need to move up immediately 2 inches (the mover competes with other movers by how fast it can traverse the maze), I have to input 1 step of 10 inches, then measure that time, then input another step when that one finishes to push it up. My program is basically a bunch of steps offset from each other by times that I've estimated. Not exactly precise. Right, Up, Left, Up, Right, Up, etc...
This is fairly tedious, and not very flexible. If I could find a way to make my own code that tells the mover to advance to the next position only after the previous position has been settled (+/- 5%?) then I could make it faster by simply adjusting the gain of my amplifier.
The code would be incredibly simple in C, but so far no one knows how to get this to work in Simulink using Matlab.
I have encoders on both motors and my program is set up so that I can input a step function, with the amplitude being the numbers of degrees I want the motor to turn, which moves the marble, etc. I coded a PID controller to provide feedback so that the mover stops (after some small transient) when it reaches the point that it needs to be.
However, right now, all my actions are based on time. If I move, say, 10 inches to the right, and then I need to move up immediately 2 inches (the mover competes with other movers by how fast it can traverse the maze), I have to input 1 step of 10 inches, then measure that time, then input another step when that one finishes to push it up. My program is basically a bunch of steps offset from each other by times that I've estimated. Not exactly precise. Right, Up, Left, Up, Right, Up, etc...
This is fairly tedious, and not very flexible. If I could find a way to make my own code that tells the mover to advance to the next position only after the previous position has been settled (+/- 5%?) then I could make it faster by simply adjusting the gain of my amplifier.
The code would be incredibly simple in C, but so far no one knows how to get this to work in Simulink using Matlab.
