![]() |
Robot Runs in full Reverse
I am using the camera code from kevin's website and have modified it alot, i have been using the Arcade 1-Joystick drive that is commented out in the defult
code. My problem started when i tried to switch two a Two Joystick drive system. My problem is the robot runs in full reverse. So i made my Program print the values from p1_y, p2_y, pwm03, and pwm04(the drive pwms). But what confuses me is the p1_y and p2_y print as 127 when the joystick is centered but pwm01 and pwm02 = 0. if i move the joystick the pwm values do not change. My code is below: pwm03 = Limit_Max(p1_y); pwm04 = Limit_Max(p2_y); my 1 joystick code is below: pwm03 = Limit_Max(p1_x + p1_y - 127); pwm04 = Limit_Max(p1_x - p1_y + 127); Can anybody help? |
Re: Robot Runs in full Reverse
Easiest solution - don't use Limit_Max.
Your joystick will never give values outside the acceptable range. Whatever Limit_Max is supposed to do, it isn't. |
Re: Robot Runs in full Reverse
I would like to understand why Limit_Max would not work the way it is suppose to. And why it would be in the default code when it isn't needed?
|
Re: Robot Runs in full Reverse
Are you sure you don't mean Limit_Mix? The default code doesn't have a Limit_Max that I can see.
Limit_Mix requires that you add 2000 to the value you pass to it. It's a silly trick to try to avoid an even sillier behavior by the compiler, but it works. |
Re: Robot Runs in full Reverse
Limit_Max and Limit_Min are function to control limit switches. They control motor outputs that should be limited by a limit switch. Alan is right; Limit mix is the actual function that you want to use. That should give you the reaction that you expect. ;)
Edit-------------------------------------------------------------------- This is for 1 joystick drive. For two, as Alan says below, just assign them directly. |
Re: Robot Runs in full Reverse
Actually, for two-joystick control, LimitMix isn't appropriate either. Its only purpose is to mix the x and y axes of a joystick for single-joystick control. It subtracts 2000 from its input as part of doing its job.
Abwehr is right -- just copy the joystick values to the pwms. Code:
pwm03 = p1_y; |
Re: Robot Runs in full Reverse
Thanks everyone this has all helped alot!
|
| All times are GMT -5. The time now is 01:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi