|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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! |
|
#2
|
|||||
|
|||||
|
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. Last edited by Alexander McGee : 08-02-2005 at 14:05. |
|
#3
|
||||
|
||||
|
Re: Big Giant Super Humongous Problems
Quote:
And thanks for the help. |
|
#4
|
|||
|
|||
|
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
|
||||
|
||||
|
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. |
|
#6
|
|||||
|
|||||
|
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. |
|
#7
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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 |
|
#10
|
|||
|
|||
|
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.
|
|
#11
|
|||||
|
|||||
|
Re: Big Giant Super Humongous Problems
Quote:
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
|
||||
|
||||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |