Go to Post I always thought a trained bio mechanical monkey wrapped in aluminum foil would be the best robot, but every year my team says "No Pete, go sit down." - BuddyB309 [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 08-02-2005, 13:58
willie837's Avatar
willie837 willie837 is offline
Registered User
#0837 (Webbinators)
Team Role: Programmer
 
Join Date: Jan 2005
Location: Oxford, NC
Posts: 9
willie837 is an unknown quantity at this point
Send a message via AIM to willie837
Exclamation Single Joystick Code Difficulties

OK, our programming team is made of three newbies who have not much idea of what they are doing. We have a few (lot) of main problems.

1. Our robot is super sensitive.
2. Our robot goes left when we push foward and right when we push back (as well as foward and backward, respectively)(we have a single joystick code).
3. Our robot goes right when we hit the trigger.

Thank you for any help that you offer!
__________________
Freshman

Please, I need your help with programming. It is my first year with Robotics and I have been chosen as programmer. If possible can anyone IM or PM me with some codings to help with the prgramming? I need especially a code to change our robot's control to two jostick tank drive from one jostick drive. I also need autonomous help. Thank you so much.



"Don't Die Worrying..." Alicia Molik
  #2   Spotlight this post!  
Unread 08-02-2005, 14:02
Alexander McGee's Avatar
Alexander McGee Alexander McGee is offline
Hoonigan
AKA: Alexander S. McGee
no team (no team)
Team Role: Engineer
 
Join Date: Sep 2002
Rookie Year: 1998
Location: Auburn Hills, Michigan
Posts: 392
Alexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond reputeAlexander McGee has a reputation beyond repute
Send a message via AIM to Alexander McGee Send a message via Yahoo to Alexander McGee
Re: Big Giant Super Humongous Problems

Well, when you say "hit the trigger", does that mean "turn it on"?

If that is the case, you may need to calibrate your joystick(s).

Or do you mean the button on the joystick?

Sensitivity is due to the joystick you are using. The ones in the kit this year and last really suck. Buy and old flightstick on ebay for 10 bucks (we bought 4). They are set up for right and left hands as well!

Try using the dashboard to view the signals coming from your joystick when you move it to certain positions, and match those numbers with the single-joysitck code. It sounds like you just have somehting backwards.

I don't have much experience with single joystick code, but it probablly depends on the joystick you are using. I have always found driving with two joysticks to be the most enjoyable / simple way to do it.
__________________
-Alexander S. McGee
Intellectual Property Attorney, Mechanical Engineer, Gear-head

Last edited by Alexander McGee : 08-02-2005 at 14:05.
  #3   Spotlight this post!  
Unread 08-02-2005, 14:08
willie837's Avatar
willie837 willie837 is offline
Registered User
#0837 (Webbinators)
Team Role: Programmer
 
Join Date: Jan 2005
Location: Oxford, NC
Posts: 9
willie837 is an unknown quantity at this point
Send a message via AIM to willie837
Re: Big Giant Super Humongous Problems

Quote:
Originally Posted by magnasmific
Well, when you say "hit the trigger", does that mean "turn it on"?
I mean push the trigger button down on the back of the joystick.

And thanks for the help.
__________________
Freshman

Please, I need your help with programming. It is my first year with Robotics and I have been chosen as programmer. If possible can anyone IM or PM me with some codings to help with the prgramming? I need especially a code to change our robot's control to two jostick tank drive from one jostick drive. I also need autonomous help. Thank you so much.



"Don't Die Worrying..." Alicia Molik
  #4   Spotlight this post!  
Unread 08-02-2005, 14:20
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: Big Giant Super Humongous Problems

Ok, if your robot turns when it should be moving straight, then the joystick might be somehow transposing the axes so that forward and backwards is read in as p1_x instead of p1_y. I'm not sure if that ever really happens though - the much more likely cause is that because of the way the motors were wired, one of them moves in the opposite direction from whichever way it's supposed to go, so that when the code thinks its moving both forward it's really turning. The solution is to go into the part of the code that maps inputs to outputs (Default_Routine in user_routines.c if you haven't changed it) and check out what's going on there.

"pwm01-04" are probably your motor outputs, "p1_y" and "p1_x" are your joystick axes. Both of them can range from 0 to 255 (ideally 254) with 127 being neutral. You can reverse the value of pwm01 by doing "pwm01 = 254 - pwm01;". Experiment with reversing the values of the outputs until both sides move forward when the joystick does.

Also be careful that you don't run two motors in opposition, if they are attached to one gear.


As for sensitivity, you can add a deadzone to the joystick so that within a certain center range it'll output no motion. Use an if() statement in your code to detect if its close to 127, and if so, set the pwms to 127.

I have no idea what would cause the robot to move when the trigger is pressed, but you can check and see if it's referred to in user_routines.c by the default code. Do a search for "p1_sw_trig".
  #5   Spotlight this post!  
Unread 08-02-2005, 14:38
willie837's Avatar
willie837 willie837 is offline
Registered User
#0837 (Webbinators)
Team Role: Programmer
 
Join Date: Jan 2005
Location: Oxford, NC
Posts: 9
willie837 is an unknown quantity at this point
Send a message via AIM to willie837
Re: Big Giant Super Humongous Problems

our pwms are at 127...we just cant seem to get it. We want it to get REALLY slow...REALLY REALLY FREAKIN SLOW!!!! lol sorry...but if anyone has an idea please tell us.

our robot has two motors, one for the drive and one for the steering.
__________________
Freshman

Please, I need your help with programming. It is my first year with Robotics and I have been chosen as programmer. If possible can anyone IM or PM me with some codings to help with the prgramming? I need especially a code to change our robot's control to two jostick tank drive from one jostick drive. I also need autonomous help. Thank you so much.



"Don't Die Worrying..." Alicia Molik
  #6   Spotlight this post!  
Unread 08-02-2005, 15:34
Billfred's Avatar
Billfred Billfred is offline
...and you can't! teach! that!
FRC #5402 (Iron Kings); no team (AndyMark)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: The Land of the Kokomese, IN
Posts: 8,554
Billfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond reputeBillfred has a reputation beyond repute
Re: Big Giant Super Humongous Problems

IANAP, but I did find this white paper:

http://qin.laya.com/first/joystick.html

The code is in PBASIC, but you should be able to adapt it.

Hope this helps!

--Billfred

PS: Rabid acceleration sometimes just comes with the territory. You should've seen it when I hit the sticks on Ockham.
__________________
William "Billfred" Leverette - Gamecock/Jessica Boucher victim/Marketing & Sales Specialist at AndyMark

2004-2006: FRC 1293 (D5 Robotics) - Student, Mentor, Coach
2007-2009: FRC 1618 (Capital Robotics) - Mentor, Coach
2009-2013: FRC 2815 (Los Pollos Locos) - Mentor, Coach - Palmetto '09, Peachtree '11, Palmetto '11, Palmetto '12
2010: FRC 1398 (Keenan Robo-Raiders) - Mentor - Palmetto '10
2014-2016: FRC 4901 (Garnet Squadron) - Co-Founder and Head Bot Coach - Orlando '14, SCRIW '16
2017-: FRC 5402 (Iron Kings) - Mentor

94 events (more than will fit in a ChiefDelphi signature), 14 seasons, over 61,000 miles, and still on a mission from Bob.

Rule #1: Do not die. Rule #2: Be respectful. Rule #3: Be safe. Rule #4: Follow the handbook.
  #7   Spotlight this post!  
Unread 09-02-2005, 21:05
Elemist315's Avatar
Elemist315 Elemist315 is offline
The Blind Leading The Blind
AKA: Straka the Evernoobish
#0660 (I wish I knew)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Round Rock, TX
Posts: 6
Elemist315 is an unknown quantity at this point
Send a message via AIM to Elemist315 Send a message via MSN to Elemist315 Send a message via Yahoo to Elemist315
Re: Big Giant Super Humongous Problems

I'm in the same boat as Willie (Newbie team and sensitivity issues that is). I did try the dead zone thing but we didn't like it because we then had no fine control. We had the engineers create a formula for us to use to try to get an exponentially increasing acceleration but the compiler then refused to build it (grrr ). I think it has something to do with the answers coming out as decimals but I'm not sure as I don't know C that well (I'm just glad I wasn't on last year, would've had no clue on pbasic). Any insight would be great.

Last edited by Elemist315 : 09-02-2005 at 21:07.
  #8   Spotlight this post!  
Unread 09-02-2005, 23:12
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: Single Joystick Code Difficulties

You'll want to use a combination of both a small deadzone and a sensitivity curve - without the curve it'll just suddenly jump around when you start moving. I like sinusoidal functions for this, but because they use floating point arithmetic it's a tad slower than some other polynomial methods. Most of the time the processor is idle anyway, so it wouldn't make a huge difference.

Can you be a bit more specific about your compile problem? C can be annoying with calculations, but it's normally not too hard to get it to cooperate.


I'm a bit tired and am starting to lose track of what I've said in what thread, so I'm not going to give any lectures tonight.
  #9   Spotlight this post!  
Unread 09-02-2005, 23:21
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Single Joystick Code Difficulties

Here's one way of making your joystick a lot less sensitive, without cutting down your maximum speed:
http://www.chiefdelphi.com/forums/sh...14&postcount=5
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #10   Spotlight this post!  
Unread 11-02-2005, 13:01
Hendrix Hendrix is offline
Registered User
#0538 (Dragon Slayers)
 
Join Date: Nov 2002
Location: Arab, AL
Posts: 44
Hendrix is an unknown quantity at this point
Re: Single Joystick Code Difficulties

ok, the problem with going right when you hit forward is, one of your motors is wired backwards... Simply swap the pos and neg on one of the motors to the speed controller and that will be fixed. (if you swap one and when you hit forward you go backwards, then you need to swap both of them again because you swapped the wrong one) As for the sensitivity, i don't know about that. It could be that your robot is geared to high and you have way more speed than you need anyways.
__________________
2004
Peachtree Regional 1st seed

2003
St. Louis Quater Finalist


**St. Louis Chairman's Award Winner**
  #11   Spotlight this post!  
Unread 11-02-2005, 13:11
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Big Giant Super Humongous Problems

Quote:
Originally Posted by willie837
our robot has two motors, one for the drive and one for the steering.
That's unusual. Most robots have independent drive motors for the left and right sides of the chassis. Relatively few teams implement steerable wheels.

If you give more details about what those motors are connected to, both mechanically and electrically, we'll be better able to help you work out your control issues. What modifications to the default code have you made, if any? The color-tracking part of it is definitely not set up to handle mechanical steering.

(By the way, the joystick trigger is usually considered to be on the front.)
  #12   Spotlight this post!  
Unread 11-02-2005, 14:29
Darkelement's Avatar
Darkelement Darkelement is offline
Team 241 Lead Programmer
AKA: JC Morgan
FRC #0241 (The Astros)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2000
Location: New Hampshire
Posts: 8
Darkelement is an unknown quantity at this point
Re: Single Joystick Code Difficulties

If you have one motor for drive and one for steering, you need to adapt your code so that the pwm inputs correspond to each other. i.e. pwm 1 matches pwm 1, etc.
__________________
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
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28
Help with code single joystick JamesBrown Programming 9 19-01-2005 00:42
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Changing 1 joystick code to 2 (rookie team) Brawler006 Programming 5 20-02-2004 17:00
robot goes haywire with the one joystick default code Miles Programming 7 24-01-2003 14:58


All times are GMT -5. The time now is 19: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