Go to Post You can never be done too early for more testing and practice! - Donut [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-12-2015, 21:12
E Dawg E Dawg is offline
... is not done with FRC yet.
AKA: Ethan
FRC #0159 (Alpine Robotics)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2012
Location: Fort Collins, CO
Posts: 267
E Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud of
Re: the c++ code is having errors

class Robot: public Robot isn't a line of code I see when I create a new C++ project, only class Robot: public SampleRobot. I think that might be your problem. Can you copy and paste all of your code so that we can take a look at it, please?
  #2   Spotlight this post!  
Unread 08-12-2015, 21:15
Bluejackets's Avatar
Bluejackets Bluejackets is offline
Bluejacket Robotics
FRC #5464 (Bluejacket Robotics)
 
Join Date: Dec 2014
Rookie Year: 2015
Location: Cambridge Isanti HS
Posts: 115
Bluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to behold
Re: the c++ code is having errors

#include "WPILib.h"

/**
* This is a demo program showing the use of the RobotDrive class.
* The SampleRobot 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.
*
* WARNING: While it may look like a good choice to use for your code if you're inexperienced,
* don't. Unless you know what you are doing, complex code will be much more difficult under
* this system. Use IterativeRobot or Command-Based instead if you're new.
*/
class Robot: public Robot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joy stick
Joystick stick2;
TalonSRX talon;


public:
Robot() :
myRobot(0, 1), // these must be initialized in the same order
stick(0), // as they are declared above.
stick2(1),
talon(2)
{
myRobot.SetExpiration(0.1);
}

/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous()
{
myRobot.SetSafetyEnabled(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()
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl() && IsEnabled())
{
myRobot.TankDrive(stick, stick2); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
talon.Get();
if(stick.GetRawButton(1)){
talon.Set(1);
}else{
talon.Set(0);
}
}

};



/**
* Runs during test mode
*/
#include "WPILib.h"


/**
* This is a demo program showing the use of the RobotDrive class.
* The SampleRobot 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.
*
* WARNING: While it may look like a good choice to use for your code if you're inexperienced,
* don't. Unless you know what you are doing, complex code will be much more difficult under
* this system. Use IterativeRobot or Command-Based instead if you're new.
*/
class Robot: public SampleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joy stick
Joystick stick2;
TalonSRX talon;


public:
Robot() :
myRobot(0, 1), // these must be initialized in the same order
stick(0), // as they are declared above.
stick2(1),
talon(2)
{
myRobot.SetExpiration(0.1);
}

/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous()
{
myRobot.SetSafetyEnabled(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()
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl() && IsEnabled())
{
myRobot.TankDrive(stick, stick2); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
talon.Get();
if(stick.GetRawButton(1)){
talon.Set(1);
}else{
talon.Set(0);
}
}

}



/**
* Runs during test mode
*/
void Test()
{
}
};

START_ROBOT_CLASS(Robot);

};
  #3   Spotlight this post!  
Unread 08-12-2015, 21:23
E Dawg E Dawg is offline
... is not done with FRC yet.
AKA: Ethan
FRC #0159 (Alpine Robotics)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2012
Location: Fort Collins, CO
Posts: 267
E Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud of
Re: the c++ code is having errors

Ahhh... It looks to me like you have two Robot objects in the same project. The program should only have one Robot object. Try removing all of the code related to class Robot: public SampleRobot. In other words, delete all code above

/**
* Runs during test mode
*/

and see what happens.
  #4   Spotlight this post!  
Unread 08-12-2015, 21:29
Bluejackets's Avatar
Bluejackets Bluejackets is offline
Bluejacket Robotics
FRC #5464 (Bluejacket Robotics)
 
Join Date: Dec 2014
Rookie Year: 2015
Location: Cambridge Isanti HS
Posts: 115
Bluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to beholdBluejackets is a splendid one to behold
Thumbs up Re: the c++ code is having errors

Quote:
Originally Posted by E Dawg View Post
Ahhh... It looks to me like you have two Robot objects in the same project. The program should only have one Robot object. Try removing all of the code related to class Robot: public SampleRobot. In other words, delete all code above

/**
* Runs during test mode
*/

and see what happens.
wow... I think when I first had errors I pasted the first code into the same code instead of selecting it all... I thought it was longer then it should be... thanks E DAWG
  #5   Spotlight this post!  
Unread 08-12-2015, 21:56
E Dawg E Dawg is offline
... is not done with FRC yet.
AKA: Ethan
FRC #0159 (Alpine Robotics)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2012
Location: Fort Collins, CO
Posts: 267
E Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud ofE Dawg has much to be proud of
Re: the c++ code is having errors

Happy to help anytime.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:09.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi