|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Is there an open source robot project out there based of of WPI's SimpleTemplate
I'm new to c++ and I'm trying to code our bot in it, and I really need a reference point (none of the upperclassman coders are helping me). Are there any open source projects for robots out there I could just look at from time to time to learn what I should be doing?
|
|
#2
|
|||
|
|||
|
Re: Is there an open source robot project out there based of of WPI's SimpleTemplate
Team 2704's code from 2013 season is posted at:
http://www.firstplusplus.com/samplerobot-code.html If you have any questions, or to set up a skype session contact us at: http://www.firstplusplus.com/contact-us.html |
|
#3
|
||||
|
||||
|
Re: Is there an open source robot project out there based of of WPI's SimpleTemplate
Quote:
|
|
#4
|
||||
|
||||
|
Re: Is there an open source robot project out there based of of WPI's SimpleTemplate
Team 1967's code is open source at github.
https://github.com/bobwolff68/FRCTeam1967 There are several test jig programs that keep it simple as well as competition sources too. Feel free to ask questions. bob |
|
#5
|
||||
|
||||
|
Re: Is there an open source robot project out there based of of WPI's SimpleTemplate
I was looking for sample robot code and stumbled upon this thread. Its great but I am looking for specific pieces of code and it seems like I need to download each code seperately. Can someone post the element of each code so that this won't be necessary?
Thank y'all!! |
|
#6
|
||||
|
||||
|
Re: Is there an open source robot project out there based of of WPI's SimpleTemplate
Something like this?
Code:
#include <WPILib.h>
//Import necessary libraries here
class DefaultRobot : public SimpleRobot{
//allocate all required components
public:
DefaultRobot(void){
//Initialize components
}
void Autonomous(void){
//Run once at the beginning of autonomous
while(IsAutonomous()){
//Code that runs throughout autonomous
}
}
void OperatorControl(void){
//Run once at the beginning of teleop
while (IsOperatorControl()){
//Code that runs throughout teleop
}
}
};
START_ROBOT_CLASS(DefaultRobot);
Code:
#include <WPILib.h>
class DefaultRobot : public SimpleRobot{
Joystick *leftStick;
Joystick *rightStick;
RobotDrive *myRobot;
public:
DefaultRobot(void){
leftStick = new Joystick(1); //USB port 1
rightStick = new Joystick(2); //USB port 2
myRobot = new RobotDrive(1,2); //motor controllers plugged into PWM 1 and 2
}
void Autonomous(void){
while(IsAutonomous()){
}
}
void OperatorControl(void){
while (IsOperatorControl()){
float leftStickYAxis = leftStick->GetY();
float rightStickYAxis = rightStick->GetY();
myRobot->TankDrive(-leftStickYAxis, rightStickYAxis); //negate axes depending on the robot's behaviour
}
}
};
START_ROBOT_CLASS(DefaultRobot);
Last edited by ekapalka : 27-11-2013 at 12:16. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|