Quote:
Originally Posted by basicxman
Rosemount: Could you please post your source code? We have found WindRiver and vxWorks can do some odd things, sometimes an obscure runtime error will make the illusion of it uploading but older code is ran.
|
In an attempt to fix our problems we have created a new project and widdled our code down to the essentials.
RJoystick is just a subclass of Joystick.
Our ZomBDashboard was working before we ran into these issues.
Code:
#include "WPILib.h"
#include "ZomBDashboard.h"
#include "RJoystick.h"
/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
RJoystick leftstick; // only joystick
RJoystick rightstick;
ZomBDashboard zomb;
Jaguar winch_motor;
Compressor compressor;
public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
leftstick(1), // as they are declared above.
rightstick(2),
zomb(ZomBDashboard::GetInstance(TCP)),
winch_motor(3),
compressor(5,4)
{
myRobot.SetExpiration(0.1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
myRobot.Drive(0.1, 0.0); // drive forwards half speed
Wait(2.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot
}
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
compressor.Start();
leftstick.UpdateButtonStates();
rightstick.UpdateButtonStates();
myRobot.TankDrive(leftstick, rightstick);
if(zomb.CanSend())
{
zomb.Add("leftStickAxis", leftstick.GetY());
zomb.Add("rightStickAxis", rightstick.GetY());
zomb.Add("testtext", "RWRRSARSR");
zomb.Send();
}
Wait(0.02);//Min time to wait is 0.005
}
}
};
START_ROBOT_CLASS(RobotDemo);