|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Reversing controls?
Ok we shipped the robot, and now our team decided that they want to redefine which side of the robot is the front. I don't have anything to test this.. but would this work:
pwm01 = ((-1 * p2_y) + 255); pwm02 = ((-1 * p1_y) + 255); |
|
#2
|
||||
|
||||
|
Re: Reversing controls?
Quote:
pwm01 = 254 - p2y; et cetera... 255 is usually a reserved value for these types of speed controllers. Regards, |
|
#3
|
|||||
|
|||||
|
Re: Reversing controls?
Quote:
|
|
#4
|
|||
|
|||
|
Re: Reversing controls?
Actually, testing in Excel won't fix this one. MPLAB and the IFI environment makes the pwm and joystick values unsigned chars. I'm not sure if the -1* will change this, but the 254-p1_y is certainly a safer way to go and executes faster than a multiply anyway.
|
|
#5
|
|||||
|
|||||
|
Re: Reversing controls?
Wouldn't you be able to just switch the output wires on the speed controller(s),or would that be illegal?
|
|
#6
|
|||||
|
|||||
|
Re: Reversing controls?
Not only do you want to reverse the output pwm values, you will also want to swap the left and right side
At the "swamp thing" scrimmage a few weeks ago, we decided to swap front and back in between rounds. After simply reversing the output pwms (255-output pwm), we found out much to our driver's amusement that not only were front and back reversed, but so were left and right ....it is also a good idea to "min/max" the outputs to stay between 1 and 254 eric |
|
#7
|
|||
|
|||
|
Re: Reversing controls?
Ok, Thanks
|
|
#8
|
|||
|
|||
|
Re: Reversing controls?
[/quote]
....it is also a good idea to "min/max" the outputs to stay between 1 and 254 eric[/quote] I'm trying to use the min function on digital_in14 to limit the reverse on PWM11. The motor is activated by the p3_sw_trig. Exactly how do I use it? just call it every loop in process_data_from_local_io ==> xchezhd |
|
#9
|
|||||
|
|||||
|
Re: Reversing controls?
Quote:
void Limit_Switch_Min(unsigned char switch_state, unsigned char *input_value); ... in UserRoutines.c so I'd try something like: /* set up a temp char variable */ unsigned char lnTemp ; /* with your input switch wired "normally open", rc_dig_in14 is normally pulled hi...ie 1 or the enum OPEN. So, closing the switch will set it 0, or CLOSED. Then if pwm11 is < 127, Limit_Switch_Min will set it back to 127 */ lnTemp = pwm11 ; Limit_Switch_Min(rc_dig_in14, &lnTemp) ; pwm11 = lnTemp ; We didn't use this function, and, in fact, chose to wire our limit switches, normally closed. That way, they return 0 or false all of the time and 1 or true, when tripped....just a matter of taste, really... so looking at it our way: if (rc_dig_in14) { if ( pwm11 < 127) pwm11 = 127 ; } ...hope that helps, Eric Last edited by EricS-Team180 : 14-03-2005 at 22:07. |
|
#10
|
|||
|
|||
|
Re: Reversing controls?
Couldn't you just flip the joysticks around in the controller? :-p
|
|
#11
|
|||
|
|||
|
Re: Reversing controls?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reversing the joystick axis | JBotAlan | Programming | 3 | 09-02-2005 19:47 |
| Controls for a Crab Drive | Ein | Control System | 22 | 26-01-2005 20:31 |
| 1992 Controls | Venkatesh | Electrical | 6 | 03-10-2004 22:04 |
| [FVG]: Controls Round C1 | Mike Ciance | FIRST-related Organizations | 18 | 29-07-2004 20:44 |
| [FVG]: Controls Round B1 | Mike Ciance | FIRST-related Organizations | 18 | 08-07-2004 09:32 |