Go to Post In the encyclopedia of FIRST under the term Encyclopedia it says - See Joe Ross. - rees2001 [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 20-01-2008, 13:42
FeuerMadchen FeuerMadchen is offline
Registered User
AKA: Allie
FRC #1768 (RoboChiefs)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Stow, MA
Posts: 2
FeuerMadchen is an unknown quantity at this point
Turning "Safety" Code

Okay, so I'm new to programming for the robot (this is the first year that I've made a significant contribution), and I came up with a weird idea. What if an automatic "slow-down" was implemented into the robot during turns so that if the driver is less than capable (not saying ours is, just in general) of understanding that the robot needs to slow down for a turn, the robot would automatically slow down?

I outlined my thoughts in the following part of the code (which I put under void Teleop(void) ):

Quote:
if(p1_x >= 0 && p1_x <= 56)
{
pwm13 - 20;
pwm15 - 40;
}
else if(p1_x >= 57 && p1_x <= 124)
{
pwm13 - 10;
pwm15 - 20;
}
else if(p1_x >= 125 && p1_y <= 129)
{
}
else if(p1_x >= 130 && p1_x <= 198)
{
pwm13 - 20;
pwm15 - 10;
}
else if(p1_x >= 199 && p1_x <= 255)
{
pwm13 - 40;
pwm15 - 20;
}
I don't know where to go from here. Maybe change it so that it only slows down while accelerating beyond a certain point?

(Feel free to use this if you want, by the way.)
__________________
1 of 2 female members of the team, ftw!
  #2   Spotlight this post!  
Unread 20-01-2008, 14:30
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: Turning "Safety" Code

A few things:

You might not want to use set amounts subtracting from the pwms just because that will decrease the sensitivity, as in if the joystick is anywhere between 0 and 56, the speed will be the same. That assumes you aren't assigning the pwm anywhere else, and it's actually in neutral to begin with. If you are mapping the pwm to joystick elsewhere, you're going to run into problems with values going outside the expected range (negative values). Etiher way, it would probably be better to map the values and then multiply by a fraction to get the end result.

Also, this code doesn't only apply when turning. Keep in mind the subtraction will occur independant of the other side of the robot. Assuming you're using tank steering, the robot's max speed will have a reduction if the joysticks are at full forward. If you're using arcade steering, then you might want to check the y... It seems to be only referenced at the neutral point?

Have you tested this, by the way?
  #3   Spotlight this post!  
Unread 20-01-2008, 14:33
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,031
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: Turning "Safety" Code

Does the robot need to slow down for turns? I've never seen a robot tip itself from it's own G forces unless it had a large weight in the air.
  #4   Spotlight this post!  
Unread 20-01-2008, 14:39
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,011
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: Turning "Safety" Code

Testing is a good idea. You might be surprised how that code you wrote actually works.

Anyway, a different idea might be to divide the PWM values by some number when the driver pulls the joystick trigger (for example), or perhaps reduce the PWM values (subtract for over 127, add for under 127) by the difference between left and right joystick values, again maybe divided by some number.

In a different direction, we have traditionally found that drivers don't like anything between their joysticks and the robot. What would be better (in their opinion) would be more driving practice time. Consider: If they were able to drive for 150 hours, they'd be awfully darn good, eh?

In a still 'nuther direction: Use the gyroscope sensor to help the driver make the turn (and drive straight, too): If the driver pulls the trigger (or whatever) the robot makes a 180 degree left turn. Or maybe a 90 degree left turn, and they can do it twice. And, if the left and right joystick values are about equal, the gyro is used to slow the faster side down a hair to make the robot drive perfectly straight.

Just some things to play with.

If you don't have time to implement this for this season, then play with it outside this season, so you know how to do it for next season. For anything complex, the build season is not the time to be learning how to do it for the first time, the time for that is pre-season.

Don
__________________

I am N2IRZ - What's your callsign?
  #5   Spotlight this post!  
Unread 20-01-2008, 16:15
JohnC's Avatar
JohnC JohnC is offline
my other name is nigel
FRC #0360 (360 Revolution)
Team Role: Programmer
 
Join Date: Mar 2005
Rookie Year: 2005
Location: user_routines.c
Posts: 100
JohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the rough
Send a message via AIM to JohnC
Re: Turning "Safety" Code

Quote:
Originally Posted by Greg Marra View Post
Does the robot need to slow down for turns? I've never seen a robot tip itself from it's own G forces unless it had a large weight in the air.
Like, for instance, a trackball?
__________________
What place are we at? ... TODAI!

Last edited by JohnC : 20-01-2008 at 16:18.
  #6   Spotlight this post!  
Unread 20-01-2008, 16:21
Branden Ghena's Avatar
Branden Ghena Branden Ghena is offline
Previously: tawnos23
FRC #0240 (TEMPEST)
Team Role: College Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Houghton, Michigan (MTU)
Posts: 303
Branden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura about
Re: Turning "Safety" Code

I would be careful with this code, if you have "safety code" in, the driver won't be able to complete that quick turn when he really needs to.
__________________
Branden Ghena - Michigan Tech Student and Team 240 Alumnus
Working Towards: Electrical Engineering and Computer Engineering Double Major

"All we have to decide is what to do with the time that is given to us." - Gandalf
  #7   Spotlight this post!  
Unread 20-01-2008, 17:54
Nightfall831 Nightfall831 is offline
Registered User
AKA: Paul
FRC #0888 (Robotiators)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Maryland
Posts: 29
Nightfall831 will become famous soon enoughNightfall831 will become famous soon enough
Send a message via AIM to Nightfall831
Re: Turning "Safety" Code

Quote:
Originally Posted by Don Rotolo View Post
Testing is a good idea. You might be surprised how that code you wrote actually works.
it's interesting how programmer's work...we write stuff, but never actually know if what we wrote is even close to correct. Usually ends in "Build Failed."...sigh....
__________________


That's a PEBKAC problem. (Problem Exists Between Keyboard And Chair)
^Yea, I never run into those...

  #8   Spotlight this post!  
Unread 20-01-2008, 18:19
ebarker's Avatar
ebarker ebarker is offline
Registered User
AKA: Ed Barker
FRC #1311 (Kell Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Kennesaw GA
Posts: 1,437
ebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond repute
Re: Turning "Safety" Code

More ways to keep you thinking.

Figure out things like where the robots CG is and you could do something like mount an accelerometer on the bot, measure the g-forces while making the turn and limit the controls in real time to prevent an unwanted tip over when in a tight turn.

Yet another way is to put encoders on the wheels and calculate the speed and turn radius and limit the controls as in the above example.

Enforcing stability with your fly by wire system. It's great !!
__________________
Ed Barker
  #9   Spotlight this post!  
Unread 20-01-2008, 18:24
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: Turning "Safety" Code

Just thinking about tipping forwards and backwards as well... You could try mounting a gyroscope vertically on the side of the robot (so that you sense angle to the ground,) and then move backwards or forwards to correct any tipping.

Although, that would also be annoying to the drivers...
  #10   Spotlight this post!  
Unread 21-01-2008, 11:15
FeuerMadchen FeuerMadchen is offline
Registered User
AKA: Allie
FRC #1768 (RoboChiefs)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Stow, MA
Posts: 2
FeuerMadchen is an unknown quantity at this point
Re: Turning "Safety" Code

Quote:
Originally Posted by psy_wombats View Post
Although, that would also be annoying to the drivers...
I understand that our excellent driver might be a little peeved, but considering he's also our head programmer and gave me the thumbs-up to try the idea out, I have some justification.

Part of the reason I'm making this code is because last year our robot was very top-heavy, and fell over 2-3 times. The trackball is going to be a huge weight, so it'd be nice to have a backup if we try driving our robot and the driver needs an extra cushion for turns.

Also, I just thought of this a few days ago, so I couldn't have played around with it during pre-season. I have tested the basic code I posted, and the robot has one side's wheels turning slowly while the joystick is in the neutral position, and the other side's wheels not moving. I'm debugging that as we speak. Type. Post. You understand what I'm getting at.

It seems to work other than that little problem, though. I appreciate all of the ideas, and try a few out today.
__________________
1 of 2 female members of the team, ftw!
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
"Hopping" With tank style turning. QuantumNinja Technical Discussion 22 19-02-2006 15:11
Modified default code gives "code violation" scottmso Programming 8 10-02-2006 23:17
Code error on RC after downloading "bells and whistles" version of Kevins camera code DanDon Programming 6 10-01-2006 18:07
New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" Jessica Boucher Team Organization 0 10-08-2005 10:55
"Thunderbirds" Vs. "Team America" Which one will rule the box office? Elgin Clock Chit-Chat 3 07-09-2004 19:53


All times are GMT -5. The time now is 18:37.

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