Go to Post I began to see myself as an independent person who was not only being inspired, but able to inspire others and strengthen the FIRST program as a whole. - Jaine Perotti [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 14-06-2006, 00:20
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 3,078
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: VEX Start Kit Projects

Quote:
Originally Posted by 1885.Blake
PS: Don't keep us in suspense. What are the magic 3 lines of code? :-) I have Vex ultrasonic sensors and I don't mind getting a peek at how other folks have used ultrasonics in the past.
Don't worry, I like sharing my knowledge! Besides, isn't the whole point of Chief Delphi to share knowledge?

Unfortunately, I don't have the exact code anymore, as it was on a laptop owned by WPI. The algorithim here was my rough draft working one; you would definitely need to tweak the coefficients in there in order to get good results.

Here's the general jist of it: you get the Ultrasonic sensor value, and you use that value to change the speed of each motor. The farther you are away from the optimal path (grey line in diagram below), the faster you want the robot to react. If the robot is way off the line, you want it to turn fast to get back to the line. But if the robot is very close to the line, then all you want to do if go mostly forward, and only turn a little bit.



So here is what we need to do:

1. Get ultrasonic sensor values.
2. Make sure range of ultrasonic values are less than 127.
3. Add ultrasonic values to one motor, subtract from the other, keeping everything proportionate.
4. Set motors to these new variables.

I do have (somewhere) the notes I took when I originally made the algorithim for this, and I will look for it tomorrow to post online if you need it. Or...

Using a printscreen command in the code, manually drive the robot along a wall a set distance away, and drive in a zig-zag pattern as if you were the robot following the wall. Record the values needed for your specific robot to make the turns in an Excel speadsheet. Using this data, try to find an equation to best fit the data, and then you can use that in your algorthim.

(Remember, the part of C programming that makes this all possible is that any conditional statement inside parenthesis will return a 1 if true, and a 0 if not. So using the assignment left_drive = 127-42(ultrasonic_value>40); will return either 127 if the ultrasonic sensor value is less than 40, or it will return an 85 if the ultrasonic value is greater than 40. It is these conditionals inside an assigment that makes the three-lines of code possible.)

Quote:
Originally Posted by 1885.Blake
Agreed - But
2) (Vex) Ultrasonics aren't spec'ed to work when the wall is very close to you
That's not a problem. The Vex Ultrasonic Sensors are spec'ed at 3 inches to 10 feet. So in order to ensure that an object (wall) can never be closer than 3" is to place your sensor at least three inches inside your robot frame. Like this:


Voila, no more 3 inch problem!
__________________
Art Dutra IV
Robotics Engineer, VEX Robotics, Inc., a subsidiary of Innovation First International (IFI)
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon (Alumni) | @arthurdutra

世上无难事,只怕有心人.
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vex start up code run PWM outputs without Rx intellec7 Programming 3 05-05-2006 23:29
vex programming kit Alex Burman FIRST Tech Challenge 1 30-03-2006 18:30
Start a Vex team NOW! skimoose FIRST Tech Challenge 4 25-01-2006 14:43
VEX kit SALE/DISCOUNT !! Stu Bloom FIRST Tech Challenge 10 13-11-2005 23:24
VEX EDUbot hybrid or $50.00 VEX kit? Tazlikesrobots Robot Showcase 15 13-08-2005 22:12


All times are GMT -5. The time now is 09:53.

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