|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Control Problems
IN RESPONSE TO:
"When I encounter problems like this where I'm not sure if my logic or formulas are working I create some test cases on paper with real numbers and see what happens. When I do the math on the original code it appears to me that the steering is reversed - based on the comments! But I don't have a working robot in front of me to verify." Hi my name is Holly, I am a mentor for team 1228, (the team with this problem) and I have taken your advice and plugged these numbers into the formula, and it seems like the formula creates the backward turning that we are experiencing... If I put in a value for full power to the right (x axis=255) and neutral on fwd/rev (y axis=127). THe values that the program returns are (right motors=full power=255) BUT...that would make the robot go into a LEFT spin (correct)? Because the right wheels are in full forward motion? |
|
#2
|
||||
|
||||
|
Re: Control Problems
Quote:
If the wiring is done such that the motors spin the opposite way from what we want with the Joystick centered left to right, we change the motor wiring. Keeping 254 meaning forward on both sides just makes more sense when debugging. In looking through this thread it appears to me that in inverted's posts there are signs wrong on the p1_x term. One of the choices presented by Keith Watson in his second post should be the correct solution. It matches what we've done for years. |
|
#3
|
|||
|
|||
|
Re: Control Problems
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: Control Problems
It sounds like your y-axis is correct (forward is forward, back is back), but your x-axis, which controls the turn, needs to be reversed.
Prior to the mixing equation you can use p1_x = 254 - p1_x to reverse the direction of your turn. e.g., Code:
p1_x = 254 - p1_x; pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127); pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127); Last edited by Mark McLeod : 15-02-2006 at 15:40. |
|
#5
|
|||
|
|||
|
Re: Control Problems
Quote:
To figure out why though, go through the debug process of checking front to back how things are used. Check the joystick direction as Mark indicated. When we calibrated our joysticks x was not backward. Check if the pwm outputs used in the code for left are really wired to the left motors. Etc. |
|
#6
|
|||
|
|||
|
Re: Control Problems
This shoudl fix your problem:
pwm13 = pwm14 = Limit_Mix(2000 - p1_y - p1_x + 381); pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127); I had the same problem, and figured out the answer by simply setting up a table with actual and desired values using the dashboard viewer. I have tried this on our robot and it works. Le t me know if it doesn't work out for you. |
|
#7
|
||||
|
||||
|
Re: Control Problems
I'd also have to recommend moving to different PWMs if there is anyway possible, those are flaky, since they're generated in software rather than hardware, any code lag disrupts them, quite unreliable.
|
|
#8
|
|||
|
|||
|
Re: Control Problems
Quote:
One more quick question. We have a motor on the bot that we don't need on all the time, just to save battery power. I wired a toggle switch so that when it's turned on, it shows up as the trigger button of a joystick being held on. Is there any way I can set a PWM to be equal to the y-axis of a joystick, ONLY when the switch is on, and then neutral when it's off? Here's the idea I had: Code:
int my_y;
pwm02 = my_y;
if (p3_sw_trig==1){
my_y = p2_y;
}
else {
my_y == 127;
}
|
|
#9
|
|||
|
|||
|
Re: Control Problems
Quote:
|
|
#10
|
||||
|
||||
|
Re: Control Problems
I'd also move the pwm assignment to after the if statement. Otherwise, there will be an additional cycle delay in your response, since the pwm will reflect the old value from the if statement.
The my_y value could be defined as an unsigned character (8 bits) instead of int. It's not essential, but it is good practice to match variable types. Code:
unsigned char my_y;
if (p3_sw_trig==1) {
my_y = p2_y;
}
else {
my_y = 127;
}
pwm02 = my_y;
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Concept of PID explained | ConKbot of Doom | Technical Discussion | 11 | 27-01-2008 00:11 |
| Electronic Speed Control Problems | DustinB_3 | Electrical | 9 | 09-11-2005 23:42 |
| Pre-manufactured control box for FIRST | Ben.V.293 | Technical Discussion | 19 | 22-08-2005 12:53 |
| 2005 RadioShack Innovation In Control Award--What Won? | Billfred | Control System | 8 | 12-06-2005 01:51 |
| Robot Rodeo - fixing control problems | Gary Dillard | Off-Season Events | 7 | 26-10-2004 00:46 |