![]() |
Very basic programming issue
First of all, I know almost nothing of programming. We spent a lot of time on debugging and troubleshooting, and I'm just now getting around to writing the code. I have a tiny issue that I don't know how to fix.
I'm building my code off the sample template, and having almost no C++ knowledge, I'm working completely off example. My currently modified( not by much, just added a third motor) code is as follows: Code:
#include "WPILib.h"Do I need to modify RobotDrive? And if so, where do I modify it? If I modify a file in WPIlib, will the new file get built into my project? |
Re: Very basic programming issue
Here's my take:
Set your PWM cables such that you get the following behaviour: Forward and Backwards are reversed Left and Right are reversed Hopefully when you do this, you'll notice that PWM 1 -> Left and PWM 2 -> Right, just as it should be based on what your code says. Power down the robot, and on ALL your drivetrain speed controllers, switch the red and black wires that lead to the motors. That will reverse their direction. Other here might recommend extensive coding changes to make this change in programming, but seeing as how you'd said your programming expertise is low, I think this is your best fix! Just make sure you document that you flipped these wires so that the next person who hooks up your motors knows to reverse them. |
Re: Very basic programming issue
Thanks, that is exactly what was needed!
|
Re: Very basic programming issue
Actually, to fix it just add a - before the GetAxis on the joyticks and it will run the motors in the opposite directions. The joyticks are very un-intuitive and have forward as a negative value. In case you're wondering, the - simply does a mathematical negative on the value
|
Re: Very basic programming issue
Quote:
myRobot.ArcadeDrive(stick); not myRobot.ArcadeDrive(stick.GetY(), stick.GetX()); so your suggestion won't work (at least at this point) |
| All times are GMT -5. The time now is 13:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi