Robot steering help needed!

I am charged with coming up with code to help our robot steer smoothly during competitions. I am new to programming a robot yet I have visited parallax and innovation first websites for information.

Anyone have any examples of code that could help steer a robot? I am particularly interested in code that uses sensors. I am learning rather rapidly and should be able to pick up on most examples offered.

Also, are there any online tutorials that could team the programming language used for the Basic Stamp and FIRST? If so, please let me know!

Thanks much!

What kind of steering? Skid, swerve, ackerman?

Thanks for your response! I am interested in keeping the robot strait so I guess swerving control. I was thinking of code that would readjust itself automatically when sensing the robot varying from a strait vector. Any ideas?

you could use the gyro chip to sense the angular acceleration of the robot… mount the sensor so there will be a readout when the robot turns. Then write the code that checks the stick inputs, and corrects the motor outputs if for some reason hte robot is not doing what the operator intended it to do.

Be careful… Say you are pushing against another robot, you do not want to modify the speed of a motor… this could lead to situations where you can have a “Steering assist On/off” button on the UI…

Unless you are going incredibly fast, the driver should be able to correct for misdirections of the robot.

Good luck


Before we can help too awfully much you have to have an idea of the type of robot you will be controlling (As sanddrag first stated) One of the most difficult will be the swerve steering, the simplest would be skid steering like a tank, the latter is already pretty much completed for you already in the standard code and on the IFI website. As for learning PBasic, the best tool is the emulator that RBayer wrote (White Papers) or an actual controller (The edu bot will also do this too)

Keep posting for more answers to specific questions.

For extremely simple skid (tank-like) steering and two joysticks, you’d use the joystick values for p1_y and p2_y (changes depending on which ports the joysticks are connected to, so there’s also p3_y and p4_y) for input. I think by default they’re already read in, so you don’t need to deal with that. But don’t forget to adjust values because of the different orientation of wheels on opposite sides.

Then look at the very bottom line of the default code for a SEROUT command (convenient example located above it), and substitute p1_y and p2_y for the corresponding PWMs your motors are plugged into.

I’d suggest also putting in a snippet of code (at least temporarily) to kill the motors when the trigger is being held down in case something goes haywire.