|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: SONAR Sensor Software Driver
Hey I just got assigned to a 2008 FRC team. I am going to try using Mike 0.3 code then Qbranch's Code. Anyone, please let me know of you get some ok readings for the Sonar on and FRC robot, and I will be sure to do the same.
|
|
#2
|
|||||
|
|||||
|
Re: SONAR Sensor Software Driver
We got the Vex sonar working last night using Mike's driver. I'm really impressed by the whole thing -- it can see a 3' x 4' board at about 15 feet!
Note: the documentation that came with the Sonar sensor I got (from Radio Shack, back when they sold Vex stuff) had the "input" and "output" functions backwards. See my earlier post in this thread. The wire marked "input" is an input to the sonar, and it needs to come from a rc_digital_io_NN pin configured as an output. You need to set a couple of macros in sonar.h to tell it which pin you are using for the sonar input. The output needs to go to a digital_io pin that acts as an interrupt. We used rc_digital_io_01. I think that is the default in Mike's code. |
|
#3
|
||||
|
||||
|
Re: SONAR Sensor Software Driver
Quote:
For example, if you were, say, following along a wall and servoing off of the distance from the wall (no idea why you'd want to do that ) you're robot will swerve further and further until it crashes, because, each time the robot veers left or right it alters the distance the ping sensor percieves, even though the distance has barely changed. This escalates until, like I said, you crash.Instead (and we've used this in the past) use encoders to drive your robot straigh, and use ultrasonics for obstacle detection/avoidance. Getting a reliable distance to anything at any angle is our current goal at 1024. -q |
|
#4
|
||||
|
||||
|
Re: SONAR Sensor Software Driver
I have a quick question Mike Dubreuil. YOu ping the sonar with Ping_Sonar and turn the timer on. Then once it interrupts it goed into Hardware_Interrupt_Sonar an into the switch statement for SONAR_WAIT status and you turn the timer on again. Then it goes into the switch statement for SONAR_TIMING for the next interrupt and get phase width as a measurement. Is the phase_width the time it takes for the actuall sound wave to go through the sonar, not the echo from the wall? If it is the echo value, then why start the timer in SONAR_WAIT?
Thanks Stephen |
|
#5
|
||||
|
||||
|
Re: SONAR Sensor Software Driver
I have the code setup as gnornhurst posted in the "SONAR Sensor Software Driver" and i'm using rc_dig_out16 for input and digital IO port 1 for "output", but I'm getting a "Cannot find Sonar" error.
I was wondering if there were any additional code changes you needed to make to get this to work with this year's Kevin Watson code? Thanks. Last edited by seg9585 : 02-02-2008 at 17:56. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Toshiba Cardbus Problem? | jpsaul7usa | Chit-Chat | 12 | 01-01-2006 02:37 |
| Introducing the Driver Strategy Database's Online Database | impulse3D | Rules/Strategy | 17 | 17-03-2005 03:04 |
| Updated: Serial Port Driver Code | Kevin Watson | Programming | 4 | 05-02-2005 18:39 |
| New Serial Port Driver | Kevin Watson | Programming | 16 | 09-01-2005 01:56 |
| Middle School Drivers | ram | General Forum | 40 | 26-02-2003 17:01 |