![]() |
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); |
Re: Reversing controls?
Quote:
pwm01 = 254 - p2y; et cetera... 255 is usually a reserved value for these types of speed controllers. Regards, |
Re: Reversing controls?
Quote:
|
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.
|
Re: Reversing controls?
Wouldn't you be able to just switch the output wires on the speed controller(s),or would that be illegal?
|
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 :D ....it is also a good idea to "min/max" the outputs to stay between 1 and 254 eric |
Re: Reversing controls?
Ok, Thanks
|
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 |
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 |
Re: Reversing controls?
Couldn't you just flip the joysticks around in the controller? :-p
|
Re: Reversing controls?
Quote:
|
| All times are GMT -5. The time now is 04:42. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi