Go to Post My point is that there seems to be a trend in FIRST in which people are saying "who cares about the robots, let's inspire the students." What I'm saying is, it's the robots that inspire the students. - Chris Hibner [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 06-04-2006, 15:56
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,188
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: SONAR Sensor Software Driver

Quote:
Originally Posted by gnormhurst
Just a further update on the sonar system. We were successful in using the sonar to control our distance to the corner goal (our doors won't open if we're too close, and the balls won't go in if we're too far away). We used sonar both in autonomous and as a driver control (driver initiates "autonomous" using a button. Control is returned when the balls have been dumped or the driver hits the "abort" button.) We even got a Xerox Creativity Award for the system.


But here's why I'm writing this note...

We had a strange problem. The sonar system would give steady values until we enabled autonomous, and then the values would start to drop: 150, 150, 150, [start auto] 150, 150, 130, 115, 90, 75, ... All this while the robot was on blocks and unable to move!

I figured it was some bizzare resource interrupt limitation timing thing. Until I discovered that it would do this just by me running the motors. It took a mechanical engineer to put his hand on the frame and say, "I bet it's picking up vibration from the motors!" We removed the sonar unit and held it -- the problem went away. We ended up mounting the unit on a block of foam (a block we made by cutting up one of those balls from the game).

Oddly, the autonomous code seemed to work anyway. It only did this for long distances -- at short distances ( < 30" ) we didn't see this problem.

So, everyone --- be careful how you mount the sonar unit -- it can pick up vibrations and give bad readings!


Thanks again for the driver code -- we never would have been able to complete this in time without it!

-Norm
What were you trying to read a distance off when this happened? Sometimes the sensor gets screwy readings when it is pointed at a curved object. Silly sound waves.
  #17   Spotlight this post!  
Unread 27-04-2006, 18:31
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: SONAR Sensor Software Driver

Quote:
Originally Posted by Tom Bottiglieri
What were you trying to read a distance off when this happened? Sometimes the sensor gets screwy readings when it is pointed at a curved object. Silly sound waves.
We were pointing it at a wall in the Drexel gym. Big, flat and perpendicular to the robot's axis. The test we did of removing the sonar unit from the robot and just holding it there, an inch from where it was mounted, seemed to be conclusive proof that it was indeed vibration pickup from the robot. Further, mounting it on foam stopped the problem.

SPEAKING OF MOUNTING IT ON FOAM: be careful how you mount it to the foam. Just putting a block of foam behind the unit and screwing it down through the foam doesn't work: the screws transmit the vibration from the frame directly to the sonar unit. You must mount the unit to the foam, then mount the foam to the robot's frame. This gives isolation.
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
  #18   Spotlight this post!  
Unread 27-04-2006, 21:01
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,019
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: SONAR Sensor Software Driver

Quote:
Originally Posted by Gdeaver
Instead of a new thread I'll post here. There is a new sonar ranging sensor on the market. New sonar The interesting points as I see it are - Nice price, narrower cone of detection, and 3 ways to interface. RS232, analog voltage and the normal pulse timing. Too late for this year but may be a worthy addition to next years sensor selection.
Darn it, I went and started a new thread before I saw this post!
In my defense: Gdeaver's post didn't show up on a search.

Anyway: The code to measure the pulse is very cool, but that new sensor also gives an analog voltage at 10 mV/inch - just a simple analog input and you're done...

Don
__________________

I am N2IRZ - What's your callsign?
  #19   Spotlight this post!  
Unread 14-07-2006, 19:23
cprogrammer's Avatar
cprogrammer cprogrammer is offline
Registered User
FRC #1595 (Gremlins)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Washington
Posts: 42
cprogrammer will become famous soon enoughcprogrammer will become famous soon enough
Re: SONAR Sensor Software Driver

This may just be on one of those days again but how do you hook up the vex sonar sensor to the EDU robot.
  #20   Spotlight this post!  
Unread 14-07-2006, 22:33
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: SONAR Sensor Software Driver

Quote:
Originally Posted by cprogrammer
This may just be on one of those days again but how do you hook up the vex sonar sensor to the EDU robot.
You need to adapt the male connections on the Vex ultrasonic sensor to the male connections on the EDU. Either a female-female cable or replace the Vex ultrasonic cable ends with female connectors. You can also use those Y-cables that come in the FRC KOP each year to do the job.

Other than that you hook it up to the same digital output and interrupt input as used on the Vex.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #21   Spotlight this post!  
Unread 19-07-2006, 02:20
Chermaine Chermaine is offline
Registered User
no team
 
Join Date: Jul 2006
Location: Malaysia
Posts: 2
Chermaine is an unknown quantity at this point
Re: SONAR Sensor Software Driver

I was compiling SONAR_0.3 using MPLAB C18 and it was not successful.

Followings are the errors detected from the codes in sonar.c.

At function initialize_sonar()

1) SONAR_OUTPUT_CONFIG = OUTPUT
-->symbol 'TRISJbits' has not been defined
-->struct or union object designator expected
-->lvalue required

2) SONAR_OUTPUT = 0
-->symbol 'LATJbits' has not been defined
-->struct or union object designator expected
-->lvalue required

At function ping_sonar ()

3) SONAR_OUTPUT = 1
-->symbol 'LATJbits' has not been defined
-->struct or union object designator expected
-->lvalue required

4) SONAR_OUTPUT = 0
-->symbol 'LATJbits' has not been defined
-->struct or union object designator expected
-->lvalue required

I thought maybe the problem lies with the definition in sonar.h for both SONAR_OUTPUT_CONFIG and SONAR_OUTPUT (see following 2 lines)

# define SONAR_OUTPUT rc_dig_out16
# define SONAR_OUTPUT_CONFIG digital_io_16

It seems to me that the define statements is referring to the hardware part or maybe the MPLAB C18 compiler is unable to read it?

Would anyone reading this can share which compiler they use and how to go about solving this problem?


pls help. Thank you.
  #22   Spotlight this post!  
Unread 29-09-2006, 23:18
Chermaine Chermaine is offline
Registered User
no team
 
Join Date: Jul 2006
Location: Malaysia
Posts: 2
Chermaine is an unknown quantity at this point
Re: SONAR Sensor Software Driver

I have managed to solve the previous post questions.

At present,

I have modify the software code for my project application. I am using a PIC18F452 microcontroller for the ping sensor. Everything works fine until programming the USART code. The hyper terminal characters does not change when the distance of the object changes.

Can you help me? I have a very close deadline to meet.

Follow is the code i added prior to Mike's codes:



#include <p18f452.h> // version 1.1
#include <usart.h>
#include "sonar.h"
/* Set configuration bits
* - set HS oscillator
* - disable watchdog timer
* - disable low voltage programming
*/

#pragma romdata CONFIG
_CONFIG_DECL(_CONFIG1H_DEFAULT & _OSC_HS_1H,
_CONFIG2L_DEFAULT,
_CONFIG2H_DEFAULT & _WDT_OFF_2H,
_CONFIG3H_DEFAULT,
_CONFIG4L_DEFAULT & _LVP_OFF_4L,
_CONFIG5L_DEFAULT,
_CONFIG5H_DEFAULT,
_CONFIG6L_DEFAULT,
_CONFIG6H_DEFAULT,
_CONFIG7L_DEFAULT,
_CONFIG7H_DEFAULT);
#pragma romdata

int i;
int distance;

void main(void)
{
int i=0;

Initialize_Sonar();
Ping_Sonar();
Hardware_Interrupt_Sonar();
Timer_Interrupt_Sonar();
Get_Sonar_Distance();

OpenUSART (USART_TX_INT_OFF &
USART_RX_INT_ON &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH, 129); // open USART with baud of 9600

while(i<10)
{
putrsUSART("A");
putrsUSART(distance);
putrsUSART("B");
i++;
}
}
  #23   Spotlight this post!  
Unread 30-09-2006, 00:01
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: SONAR Sensor Software Driver

Im not sure if im right about this but try this...
I put the whole thing in an endless loop..
Code:
#include <p18f452.h> // version 1.1
#include <usart.h>
#include "sonar.h"
/* Set configuration bits
* - set HS oscillator
* - disable watchdog timer
* - disable low voltage programming
*/

#pragma romdata CONFIG
_CONFIG_DECL(_CONFIG1H_DEFAULT & _OSC_HS_1H,
_CONFIG2L_DEFAULT,
_CONFIG2H_DEFAULT & _WDT_OFF_2H,
_CONFIG3H_DEFAULT,
_CONFIG4L_DEFAULT & _LVP_OFF_4L,
_CONFIG5L_DEFAULT,
_CONFIG5H_DEFAULT,
_CONFIG6L_DEFAULT,
_CONFIG6H_DEFAULT,
_CONFIG7L_DEFAULT,
_CONFIG7H_DEFAULT);
#pragma romdata

int distance;

void main(void)
{

   Initialize_Sonar();

   while (1)   // Endless loop
   {

      Ping_Sonar();
      Hardware_Interrupt_Sonar();
      Timer_Interrupt_Sonar();
      distance = Get_Sonar_Distance();   // Get distance and update variable

      OpenUSART (USART_TX_INT_OFF &
      USART_RX_INT_ON &
      USART_ASYNCH_MODE &
      USART_EIGHT_BIT &
      USART_CONT_RX &
      USART_BRGH_HIGH, 129); // open USART with baud of 9600

      putrsUSART("A");
      putrsUSART(distance);
      putrsUSART("B");

   }
}
Try that and see if it works...

Good Luck
  #24   Spotlight this post!  
Unread 30-09-2006, 08:11
MikeDubreuil's Avatar
MikeDubreuil MikeDubreuil is offline
Carpe diem
FRC #0125 (Nu-Trons)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Boston, MA
Posts: 967
MikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond repute
Send a message via AIM to MikeDubreuil
Re: SONAR Sensor Software Driver

I think you may have overlooked this section in the readme:
Quote:
Software Use:
Call Ping_Sonar() to update the distance reading. Call Get_Sonar_Distance() to return the distance between the sonar sensor and an object in inches.
The functions: Hardware_Interrupt_Sonar() and Timer_Interrupt_Sonar() are only meant to be called internally in the sonar software. You only need to call two functions: Ping_Sonar() updates the distance between the sonar sensor and an object and Get_Sonar_Distance which will return the distance in inches.

I'm not familiar with your application but give this a shot. Note that I added comments about adding a time delay. It may take up to 50mS for the sonar to find an object.
]
Code:
#include <p18f452.h>  // version 1.1
#include <usart.h>
#include "sonar.h"
/* Set configuration bits
* - set HS oscillator
* - disable watchdog timer
* - disable low voltage programming
*/

#pragma romdata CONFIG
_CONFIG_DECL(_CONFIG1H_DEFAULT & _OSC_HS_1H,\
 			_CONFIG2L_DEFAULT,\
 			_CONFIG2H_DEFAULT & _WDT_OFF_2H,\
 			_CONFIG3H_DEFAULT,\
 			_CONFIG4L_DEFAULT & _LVP_OFF_4L,\
 			_CONFIG5L_DEFAULT,\
 			_CONFIG5H_DEFAULT,\
 			_CONFIG6L_DEFAULT,\
 			_CONFIG6H_DEFAULT,\
 			_CONFIG7L_DEFAULT,\
 			_CONFIG7H_DEFAULT);
#pragma romdata

int i;
int distance;

void main(void)
{
  int i=0;

  Initialize_Sonar();

  OpenUSART (USART_TX_INT_OFF &
 		   USART_RX_INT_ON &
 		   USART_ASYNCH_MODE &
 		   USART_EIGHT_BIT &
 		   USART_CONT_RX &
 		   USART_BRGH_HIGH, 129);  // open USART with baud of 9600
  Ping_Sonar();
  /* You might want to consider adding a time delay here */
  while(i<10)
  {
	distance = Get_Sonar_Distance();
	Ping_Sonar();
	putrsUSART("A");
	putrsUSART(distance);
	putrsUSART("B");
 	i++;
	/* You might want to consider adding a time delay here */
  }
}
__________________
"FIRST is like bling bling for the brain." - Woodie Flowers
  #25   Spotlight this post!  
Unread 03-02-2007, 22:48
daveydaycart daveydaycart is offline
Registered User
FRC #0294
 
Join Date: Jan 2006
Location: Los Angeles
Posts: 3
daveydaycart is an unknown quantity at this point
Re: SONAR Sensor Software Driver

I've been trying to get this working today on the FRC Robot Controller. I've never programmed interrupts before though, so I'm at a stand-still as to what to do. I think I have the initialization for the pin driven interrupt done correctly, but I'm at a complete loss for how to get the timer working. Any help would be appreciated.
  #26   Spotlight this post!  
Unread 04-02-2007, 08:04
MikeDubreuil's Avatar
MikeDubreuil MikeDubreuil is offline
Carpe diem
FRC #0125 (Nu-Trons)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Boston, MA
Posts: 967
MikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond repute
Send a message via AIM to MikeDubreuil
Re: SONAR Sensor Software Driver

Quote:
Originally Posted by daveydaycart View Post
I think I have the initialization for the pin driven interrupt done correctly, but I'm at a complete loss for how to get the timer working. Any help would be appreciated.
I'm assuming you're using MPlab and not EasyC to program your robot. Where did you get your version of the default code? Also does the particular version you are using have a name? For instance, "2007 Default Code from IFIrobotics.com" or "Camera code version 2.0 from kevin.org". A link so I can download the default code would be helpful as well.
__________________
"FIRST is like bling bling for the brain." - Woodie Flowers
  #27   Spotlight this post!  
Unread 04-02-2007, 17:08
daveydaycart daveydaycart is offline
Registered User
FRC #0294
 
Join Date: Jan 2006
Location: Los Angeles
Posts: 3
daveydaycart is an unknown quantity at this point
Re: SONAR Sensor Software Driver

Yes, I'm using MPlab to program. I got my default code from kevin.org, it is his camera code version 2.1.

Thanks for your help!
  #28   Spotlight this post!  
Unread 05-02-2007, 10:50
MikeDubreuil's Avatar
MikeDubreuil MikeDubreuil is offline
Carpe diem
FRC #0125 (Nu-Trons)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Boston, MA
Posts: 967
MikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond repute
Send a message via AIM to MikeDubreuil
Re: SONAR Sensor Software Driver

Quote:
Originally Posted by daveydaycart View Post
I got my default code from kevin.org, it is his camera code version 2.1.
In the file user_routines_fast.c you have to change the function InterruptHandlerLow(). Add the following code to the IF statement.
Code:
    else if (PIR2bits.TMR3IF && PIE2bits.TMR3IE) // timer 3 interrupt?
    {
        PIR2bits.TMR3IF = 0;
        Timer_Interrupt_Sonar(); // Call SONAR Timer Interrupt Handler
    }      
    else if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) // external interrupt 1?
    { 
        INTCON3bits.INT2IF = 0;
        Hardware_Interrupt_Sonar(); // Call SONAR hardware interrupt handler
    }
__________________
"FIRST is like bling bling for the brain." - Woodie Flowers
  #29   Spotlight this post!  
Unread 05-02-2007, 18:34
daveydaycart daveydaycart is offline
Registered User
FRC #0294
 
Join Date: Jan 2006
Location: Los Angeles
Posts: 3
daveydaycart is an unknown quantity at this point
Re: SONAR Sensor Software Driver

oooh I think it may be that when I added your code to InterruptHandlerLow() I didn't reset the interrupt flag within the two "else if" statements. I'll add that tonight and see if it works. Thanks!
  #30   Spotlight this post!  
Unread 14-02-2007, 21:29
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,188
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: SONAR Sensor Software Driver

Hey guys,

Version 0.3 of this software DOES NOT work with Kevin Watson's PWM driver.

I'm guessing its a dependancy on Timer 3.

So, dont use it, or fix it.

--Tom
Closed Thread


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
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


All times are GMT -5. The time now is 01:11.

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