|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
My robot is completely ignoring the code we try to put on it and just doing arcade mode. We have tried the robot default code, customizing the simple robot code, rewiring to pwm's and the CAN system. We have renumbered the pwm's in various ways and tried writing the code with and without the DriverStation object. we have tried declaring this object as
Code:
myRobot = new RobotDrive(1,2); Code:
myRobot = new RobotDrive(1,2,3,4); |
|
#2
|
||||
|
||||
|
Re: Craziest Bug I'v Ever Seen--C++
Try declaring it as
Code:
RobotDrive *myRobot = new RobotDrive( 1, 2, 3, 4 ); // this creates a pointer to the object's memory location Code:
RobotDrive myRobot( 1, 2, 3, 4 ); Code:
myRobot->TankDrive( /* arguments */ ); Code:
myRobot.TankDrive( /* arguments */ ); Last edited by MetalJacket : 22-01-2013 at 17:17. |
|
#3
|
|||
|
|||
|
Re: Craziest Bug I'v Ever Seen--C++
Can you give us more details, preferably code samples?
|
|
#4
|
|||
|
|||
|
Re: Craziest Bug I'v Ever Seen--C++
Well my team seems to believe it is not necessarily a problem with our code but, with deploying the c++ code itself onto the robot but yes hear is our prototype drive code:
Code:
#include <WPILib.h>
#include <Vision/RGBImage.h>
#include <Vision/BinaryImage.h>
#include <Math.h>
class RobotDemo : public IterativeRobot
{
Joystick* Stick_xy;
Joystick* Stick_z;
Jaguar* motor1;
Jaguar* motor2;
Jaguar* motor3;
Jaguar* motor4;
Jaguar* motor5;
PWM* connect1;
PWM* connect2;
PWM* connect3;
PWM* connect4;
PWM* connect5;
//RobotDrive* myRobot;
Servo* xCam;
Servo* yCam;
DriverStation* Station;
DriverStationLCD* Station_out;
public:
RobotDemo(void) // as they are declared above.
{
Stick_xy = new Joystick(1);
Stick_z = new Joystick(2);
motor1 = new Jaguar(1);
motor2 = new Jaguar(2);
motor3 = new Jaguar(3);
motor4 = new Jaguar(4);
motor5 = new Jaguar(5);
connect1 = new PWM(1,1);
connect2 = new PWM(2,2);
connect3 = new PWM(3,3);
connect4 = new PWM(4,4);
connect5 = new PWM(5,5);
//myRobot = new RobotDrive(1,2,3,4);
Station = DriverStation::GetInstance();
Station_out = DriverStationLCD::GetInstance();
}
~RobotDemo(void)
{
delete Stick_xy;
delete Stick_z;
delete motor1;
delete motor2;
delete motor3;
delete motor4;
delete motor5;
//delete myRobot;
delete Station;
delete Station_out;
delete xCam;
delete yCam;
}
void Autonomous(void)
{
}
void TeleopContinuous(void)
{
if (Stick_xy->GetRawAxis(2)!= 0)//if the stick is moved up or down
{
motor1->SetSpeed(Stick_xy->GetRawAxis(1));
motor3->SetSpeed(Stick_xy->GetRawAxis(1));
}
if(Stick_xy->GetRawAxis(1) != 0)//if the stick moves left or right
{
motor2->SetSpeed(Stick_xy->GetRawAxis(2));
motor4->SetSpeed(Stick_xy->GetRawAxis(2));
}
if(Stick_z->GetRawAxis(2)!= 0)//if the z stick moves left or right
{
motor1->SetSpeed(Stick_z->GetRawAxis(1));
motor3->SetSpeed(-(Stick_z->GetRawAxis(1)));
}
if(Stick_z->GetRawAxis(1) != 0)
{
motor5->SetSpeed(Stick_z->GetRawAxis(1));
}
else
{
Stop();
}
}
void Test() {
}
private:
void Stop()
{
motor1->SetSpeed(0);
motor2->SetSpeed(0);
motor3->SetSpeed(0);
motor4->SetSpeed(0);
}
/*void GetCamPosition()
{
float xPos = 170 * Stick_z->GetRawAxis(1)+85;
float yPos = 170 * Stick_xy->GetRawAxis(2)+85;
if(Stick_z->GetRawAxis(2)!= 0)
{
while(xCam->SetAngle(2) >insert ammount && xCam->SetAngle(2)<insert Right angle)
{
xCam->SetAngle(Stick_z->GetRawAxis(2));
}
}
}*/
void Target()
{
/*
* MIDDLE GOALS have openings that are 54 in. wide and 21 in. tall
* bottom edge of the MIDDLE GOAL is located 88 5/8 in. above the FIELD
*----------------------------------------------------------------------
* HIGH GOAL is 54 in. wide and 12 in. tall
* bottom edge of the opening located 104 1/8 in. above the FIELD
*/
}
};
START_ROBOT_CLASS(RobotDemo);
|
|
#5
|
||||||
|
||||||
|
Re: Craziest Bug I'v Ever Seen--C++
From http://wpilib.screenstepslive.com/s/...software-notes
Quote:
|
|
#6
|
|||||
|
|||||
|
Re: Craziest Bug I'v Ever Seen--C++
It sounds to me like you're not actually downloading code to the robot. This could be because you have something configured wrong or simply because your code has errors and isn't successfully compiling.
First, make sure when you build your code that it's successfully compiled. There will be lots of red and error stuff in the windriver output window if it hasn't compiled. Next, make sure you have the cRIO, your laptop, and windriver configured correctly. Go to the Imaging your cRIO Guide and follow it step-by-step. That will make sure that your cRIO and laptop are setup correctly for C++. Then go to the Building and Downloading a project to the cRIO Guide. I'd recommend doing "Building a robot program" and "Verify that no User Code is running". Then skip ahead to "Loading a program to run on robot startup" and follow along till the end. Running in debug mode is a little more complicated and error prone than just deploying and rebooting. Hopefully after you reboot your robot, whatever code changes you've made will now show up on your robot. |
|
#7
|
||||
|
||||
|
Re: Craziest Bug I'v Ever Seen--C++
Additionally if you think the program is getting loaded onto the cRio properly, you could also run NetConsole. Do a reboot from the drivers station while netconsole is up and watch the boot up. You might spot an error if the code is erroring. then try to enable it and try to drive - see if you get any errors on netconsole at that point.
good luck! |
|
#8
|
|||||
|
|||||
|
Re: Craziest Bug I'v Ever Seen--C++
The .out file path that Deploy is set to use is probably not the one you are compiling.
It's probably an old or default path, so check what it is in FIRST Downloader Preferences. Last edited by Mark McLeod : 23-01-2013 at 10:48. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|