Log in

View Full Version : Autonomous Issues!


dmoody92
05-02-2009, 22:26
Hello. We'll the build season is winding down and I am flipping out a little bit because I am running out of time with some major things to do. It was pretty tough to go from not even knowing what lab view was a few months to make an entire robot, oh yea..also our entire programming team consists of me and another kid who has no idea what he's doing, lol! Ok, enough self pity, here's whats going on.

Today was the first day I tested out our autonomous program that I made (we are having a very simple autonomous program as we are rookies). When I run it, I get an error code saying that the PWMs are already allocated even though I only have two motors being run during this time so there should be no conflicts. Soon after I realized that in autonomous I could also trigger teleop code! Then I realized that I had PWM 1 and 3 being used in both autonomous and teleop. When I switched the teleop PWMs it worked shortly until reverting back to the same error even though I was communicating to four different PWM slots.

So the issue is the fact I seem to get a degree of crossover between teleop and autonomous which doesn't make sense to me. I can't get my code up right now but I will soon, but I wanted to post this as soon as I could because of time. Any help would be REALLY appreciated!!

nathanww
06-02-2009, 00:21
I'm not exactly sure what your problem is--are you trying to declare new victors or jaguars in both your auto mode and your teleop mode? If so, it might make more sense just to do it in the constructor so that both modes can acsess the motors without conflicts.

byteit101
06-02-2009, 06:32
yes, try this
#include "WPILib.h"
class RobotDemo:public SimpleRobot
{
RobotDrive myRobot;
Joystick stick;
public:
RobotDemo():
myRobot(1,3), stick(1){}
void Autonomous()
{
myRobot.Drive(1,0);
Wait(1);
myRobot.Drive(0);
}
void OperatorControl()
{
while (IsOperatorControl(){
myRobot.ArcadeDrive(stick);
}
}
};

this creates them as accessable inside all the functions in the class

Big Kid
06-02-2009, 09:24
if you are using labview you have to create global referances to run the motors in auto if you are opening them in the robot main.

dmoody92
07-02-2009, 11:02
Thanks fro the responses.

I am not reinitializing new victors, I am getting error code -44037 saying that the PWMs are already allocated. I am using the global variable to share between the two modes as shown in the default code. I really need some help here if anyone might know the answer

domoarigato
07-02-2009, 13:34
What are you trying to control with PWMs 1 and 3? If they're just drive motors, you should be able to control them by using a global variable and then wiring the global to the drive train.... But if you're using them for something else... I'm not too sure. Probably would have to use global variables for that too. If you are making your own globals, make sure you are changing them from write to read mode when in autonomous. (right click it and change to read mode before wiring a new global to your autonomous stuffs)

jnorris
07-02-2009, 17:58
We had seen this error code and it seems to be caused when you deploy from the autonomous vi window. Apparently this only downloads the autonomous VI or some how messes up the globals. After editing the autonomous vi always deploy from the MAIN PROJECT window.