I just can make that thing work…
image:
It looks like you are trying to create an object for the “Drive” class…right??
I think you were trying to write:
RobotDrive *bba;
??
Maybe I’m missing something? Please elaborate.
Yes, im trying to creat a new object “Drive” (!!)
I defined a new object at the class “Drive” and i want to make a new
object in my code. Like “PWM” or “Jaguar” but from class that i created!
help
Mind showing us more of that MyRobot.cpp file you’re using? If you could post that, along with your Drive.cpp and Drive.h files, then it’ll be easier to figure out than working from just a screenshot.
You want something like
RobotDrive *bba = new RobotDrive(1, 2);
There is no class Drive in the WPI libraries (I think).
Im trying to creat one…
I succeid to creat a new class but now when im trying to put the code
on the cRio the DS tells me “No Code”.
why is that?
here is my code:
MainClass
#include "WPILib.h"
#include "Functions.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
Joystick stick; // only joystick
public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
stick(1) // as they are declared above.
{
GetWatchdog().SetExpiration(100);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
GetWatchdog().SetEnabled(false);
myRobot.Drive(0.5, 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)
{
GetWatchdog().SetEnabled(true);
Functions r;
while (IsOperatorControl())
{
GetWatchdog().Feed();
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
r.GetSomething();
}
}
};
START_ROBOT_CLASS(RobotDemo);
Functions.h:
#ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
class Functions
{
public:
void GetSomething(void);
};
#endif
Functions.cpp:
#include "Functions.h"
void GetSomething(void)
{
}
#include “Functions.h”
void GetSomething(void)
{}
That should be:
Functions
#include "Functions.h"
void Functions::GetSomething(void)
{
}
Still not working…
Does it compile? It looks like it should work (of course it does nothing).
Try downloading into RAM with the target console window up. Does it print any messages about undefined symbols? When you run it can you see the FRC_RobotTask running (type ‘i’ to see the running tasks).