Thread: Arm movement
View Single Post
  #4   Spotlight this post!  
Unread 28-01-2008, 11:49
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arm movement

I struggled with mplab and robot programming many years ago, so I know what you're going thru. But you do have to have some more info for us to work with. Also knowing what level of programming smarts you have helps, so we don't talk over your head. Reading the material from the FAQs here helps too. We can't do all your homework!

Programming is the link between driver (or autonomous mode) and robot parts. And it doesn't matter if it is mplab or easy-c or Robo-COBOL (which does sound like a cool name to program robots): you have to know what you want -- in detail -- before you can program it.

How is the arm moving? What motors or pneumatics? Do you have limit switches so the arm itself or the motor doesn't go beyond it's range? (These are questions I give to the manufacturing crew to answer.) You will eventually need input/output plug numbers, but to start just what is driving the arm is needed.

How is the driver to move the arm? Joystick or one of it's buttons, or a separate control attached to the controller? Or is it automatic -- when the ball sits on the robot a limit switch is pressed and the arm is raised. (Just as an example.) It's somewhat easy to change which control later, but you need something to start with.

Most controls are written in an if statement. In pseudo-code:
Code:
if <joystick button 1 pressed>, then <drive motor b>, else <stop motor b>
Obviously, once you figure out which button and motor, fill in the blanks.

Adding a limit switch to stop automatically only adds another if inside this if:

Code:
if <joystick button 1 pressed>, then 
    if <limit switch 2 not pressed>, then 
        <drive motor b>
    else
        <stop motor b>
else
   <stop motor b>
Just go thru the different possibilities to make sure every possible combination is covered. (The above code is incomplete, but it'll give you a starting point.)

To have something continue after the button is released requires a variable set to say "if equal to 1 the button was already pressed - continue until limit switch pressed and then set variable to zero." (That last part is important!)

Write back when you get more info.