Quote:
Originally Posted by cjlane1138
How are you initializing NetworkTable in C++? Is it a static declaration? Could you post the entire class?
|
Here is the complete robot code:
Code:
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
Joystick stick;
Jaguar jaguar;
NetworkTable* roborealmNetTable;
public:
RobotDemo(void):
stick(1),
jaguar(2),
roborealmNetTable(NULL)
{
NetworkTable::SetTeam(1943);
NetworkTable::SetIPAddress("10.19.43.5");
NetworkTable::Initialize();
roborealmNetTable = NetworkTable::GetTable("RoboRealm");
}
void Autonomous(void)
{
}
void OperatorControl(void)
{
while (IsOperatorControl())
{
if (stick.GetRawButton(1))
{
jaguar.Set(stick.GetY());
}
else
{
double d = roborealmNetTable->GetNumber("InputValue");
jaguar.Set(d);
}
if (stick.GetRawButton(2))
{
roborealmNetTable->PutNumber("InputValue", 0);
}
Wait(0.005); // wait for a motor update time
}
}
/**
* Runs during test mode
*/
void Test() {
}
};