![]() |
ASAP HELP FOR AUTONOMOUS PROGRAMMING
So hey, kinda in a rush so lets get right to it
We have our first regional this week, and we want to be able to in some way have the robot move forward x meters in autonomous we dont have any sensors, and yeah is there any possible methods of controlling how far your robot goes ps. the only one i know is timing it, but can some one show me the syntax that goes along with executing this process. thanks for the help. |
Re: ASAP HELP FOR AUTONOMOUS PROGRAMMING
There are two sensors that come to mind to easily control the position of a robot: Encoders and Ultrasonic sensors.
Encoders typically attach to the gearboxes or wheels and measure shaft rotation. You can use them to measure the distance your robot travels as it moves forwards. More details can be found here: http://wpilib.screenstepslive.com/s/...using-encoders An ultrasonic sensor measures the distance from the sensor to a surface in front of it. You could use an ultrasonic sensor to measure your distance from the wall, although it would be susceptible to other objects (such as a goalie bot) sitting in between the sensor and the wall. Details can again be found in the docs: http://wpilib.screenstepslive.com/s/...asonic-sensors If you would like to see an example of how to use dead reckoning in autonomous, feel free to check out my team's code from last year (shameless self plug): https://github.com/LuNaTeCs-316/SureShotSAM-Java. In particular, this autonomous mode used dead reckoning for driving. |
Re: ASAP HELP FOR AUTONOMOUS PROGRAMMING
I assume you're trying to score the 5 points for driving forward. We helped one of our alliance partners at week zero do this. Now it may vary a bit if your using simplerobot or iterative robot, but the approach is the same regardless. When your autonomous starts, store the current time. Then on each loop of autonomous check to see if the time is > 5 seconds. If it is stop the drive, otherwise drive forward slow.
Code:
private long startTime = 0; |
Re: ASAP HELP FOR AUTONOMOUS PROGRAMMING
Quote:
Why not do something like this: in autonomous function: Code:
drive.tankDrive(0.5,0.5); //set drive motors to 50% |
| All times are GMT -5. The time now is 11:30. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi