Go to Post Overall I really like the idea, and don't be surprised if I borrow some of these ideas for a future robot. - Greg Needel [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-02-2014, 22:19
2185Bilal's Avatar
2185Bilal 2185Bilal is offline
Driver, Ld. Programmer, Electrical
AKA: Bilal Majeed
FRC #2185 (Ramazoidz)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2011
Location: Toronto, Canada
Posts: 110
2185Bilal will become famous soon enough
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.
__________________
RAMAZOIDZ

2009 Toronto West Regional - Regional Winners
2009 Waterloo Regional - Regional Winners
Reply With Quote
  #2   Spotlight this post!  
Unread 25-02-2014, 22:37
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
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.
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

Reply With Quote
  #3   Spotlight this post!  
Unread 25-02-2014, 22:44
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
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;

//the first time autonomous executes (i.e. autonomous init)
startTime = System.currentTimeMills();

//on each loop/iteration
if(System.currentTimeMills() - startTime < 5000){
      //drive forward slow (.1 or .2 for a start)
}else{
      //stop the drive
}
__________________
"Never let your schooling interfere with your education" -Mark Twain
Reply With Quote
  #4   Spotlight this post!  
Unread 02-03-2014, 20:26
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: ASAP HELP FOR AUTONOMOUS PROGRAMMING

Quote:
Originally Posted by lineskier View Post
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;

//the first time autonomous executes (i.e. autonomous init)
startTime = System.currentTimeMills();

//on each loop/iteration
if(System.currentTimeMills() - startTime < 5000){
      //drive forward slow (.1 or .2 for a start)
}else{
      //stop the drive
}

Why not do something like this:

in autonomous function:
Code:
drive.tankDrive(0.5,0.5); //set drive motors to 50%
Timer.delay(time); //time to wait in seconds
drive.tankDrive(0.0,0.0); //stop drive motors
Because public void autonomous() {} only runs once there's no need for a loop it will simply execute in order.
__________________
2015-2016 CSA
Software Engineering Student @ Johnson & Wales University
Team 228, Gus Robotics Inc.
Facebook
FLL Mentor for 1107, Edison Eagles!
2015- CT State Champions
2012- WPI Finalist(Thanks 1884 and 549), Spirt, Best Website
2011- WPI Chairman's award winners!
2010- WPI Champions! (thanks 230 & 20), WPI Engineering Inspiration, CT Best Website, CT VEX Champions (VRC228, VRC228b) (21-1-0)
2009- QCC VEX Champions (VRC228) (11-0-0), Innovate Award (VRC228)

Last edited by ProgrammerMatt : 02-03-2014 at 20:29.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi