Go to Post I have many ideas, every last one of them involves finding something more productive to do with your time. - Andrew Schreiber [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
  #1   Spotlight this post!  
Unread 31-01-2007, 12:58
seanl's Avatar
seanl seanl is offline
"The Everything person"
FRC #0867 (Absolute Value)
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Arcadia, CA
Posts: 267
seanl will become famous soon enoughseanl will become famous soon enough
autonomous mode

hi im the programmer for team 867, i was wondering is there any default code for autonomous. and i have another question, how can we activate autonomous mode for testing.
  #2   Spotlight this post!  
Unread 31-01-2007, 13:01
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: autonomous mode

This thread may help you out
http://www.chiefdelphi.com/forums/sh...threadid=53137
  #3   Spotlight this post!  
Unread 31-01-2007, 13:14
seanl's Avatar
seanl seanl is offline
"The Everything person"
FRC #0867 (Absolute Value)
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Arcadia, CA
Posts: 267
seanl will become famous soon enoughseanl will become famous soon enough
Re: autonomous mode

ok kool i got it. this has nothing to do with this but i want to add a dead zone on the joystick. so like the robot wont move the split second you touch the joystick, how can i do this.
  #4   Spotlight this post!  
Unread 31-01-2007, 13:38
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: autonomous mode

Quote:
I want to add a dead zone on the joystick. so like the robot wont move the split second you touch the joystick
There is already a dead zone built into the Victor speed controllers. But whether you realize that or not, the joysticks must not be giving the response you want.

You could try something simple like this, to basically ignore the values near the centre of travel:

Code:
if ((joy >= 120) && (joy <= 140))  joy = 127;
Or a more sophisticated "exponential" method:

Code:
speed = joy - 127;
newspeed = ((speed * speed) / 127) * sign(speed);
I have attached a Labview 8 application that demonstrates various joystick response curves.

Good luck,

Mike
Attached Files
File Type: vi JoystickResponseCurves.vi (28.9 KB, 43 views)
  #5   Spotlight this post!  
Unread 31-01-2007, 13:56
seanl's Avatar
seanl seanl is offline
"The Everything person"
FRC #0867 (Absolute Value)
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Arcadia, CA
Posts: 267
seanl will become famous soon enoughseanl will become famous soon enough
Re: autonomous mode

i have 2 questions
1. where do i splice in the code you gave me i was looking through the code i cant see where to put it.
2. do i connect the user interface to my computer for running the labview program.
  #6   Spotlight this post!  
Unread 31-01-2007, 14:41
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: autonomous mode

Quote:
Originally Posted by mluckham View Post
You could try something simple like this, to basically ignore the values near the centre of travel:

Code:
if ((joy >= 120) && (joy <= 140))  joy = 127;
This is a good idea, but I would propose the following enhancement to make it a little more flexible
Code:
#define JOYSTICK_DEADZONE   5
...
if((joy >= (127 - JOYSTICK_DEADZONE)) && (joy <= (127 + JOYSTICK_DEADZONE)))
{
  joy = 127;
}
Then, to extend that even further, you could create a macro so that you could apply deadzones whenever you needed to.
Code:
#define JOYSTICK_DEADZONE   5

#define DEADZONE(input, dz) (if(((input) >= (127 - (dz))) && ((input) <= (127 + (dz)))) (input) = 127;)

...

DEADZONE(joy1, JOYSTICK_DEADZONE)
DEADZONE(joy2, JOYSTICK_DEADZONE)
Notice that the lines that "call" the macto don't have semicolons. This is because there is a terminating semicolon at the end of the macro itself.
Quote:
Originally Posted by seanl
1. where do i splice in the code you gave me i was looking through the code i cant see where to put it.
Well, if you think about this logically, your outputs (pwm/relay/analog/digital outs) are based on your inputs, so it makes sense that deadzone code would be placed somewhere after the inputs are read, but before the outputs are written. Depending on how your inputs map to outputs, you may have intermediate calculations. It would then make sense to place your deadzone code before those calculations. When in doubt, take a deep breath and think through the problem. Programming is about thinking logically. Go step by step and you'll figure it out.
Quote:
Originally Posted by seanl
2. do i connect the user interface to my computer for running the labview program.
I don't know anything about the way that labview works. Hopefully someone else can answer that question.
  #7   Spotlight this post!  
Unread 31-01-2007, 15:59
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: autonomous mode

Quote:
i have 2 questions
1. where do i splice in the code you gave me i was looking through the code i cant see where to put it.
2. do i connect the user interface to my computer for running the labview program.
If you are using MPLAB, you will see (in the default code) where the joystick values are read, then the resulting values are assigned to the Victor pwm output variables. So you put the joystick code JUST AFTER the joystick value is read. You will have to make your own decisions for variable names, etc. And the code I provided is only for one joystick axis - you will have two joystick axes, so will need twice the amount of code.

Labview is a graphical development environment that runs on your PC. A copy of Student Labview was included in the KOP this year. I am attaching a screen shot of the Labview program running the Joystick application - you will get the idea that it is only useful to ILLUSTRATE how joystick values might be processed. The simulated joystick input is the horizontal slider at upper left. The three scales below show linear (direct), exponential, and logarithmic conversions.
Attached Thumbnails
Click image for larger version

Name:	JoystickResponseCurves.jpg
Views:	54
Size:	46.8 KB
ID:	4977  

Last edited by mluckham : 31-01-2007 at 16:05.
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
Autonomous Mode EricWilliams Programming 8 10-01-2007 10:58
Autonomous Mode Yellow Eyes Programming 2 18-02-2004 21:16
autonomous mode Stephanie Programming 2 25-01-2003 19:57
Autonomous Mode David Bryan Programming 1 21-01-2003 21:15
autonomous mode? bigwalt Technical Discussion 1 21-01-2003 01:14


All times are GMT -5. The time now is 22:17.

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