Go to Post You know what they call the graduate with the lowest GPA in med school? Doctor. You know what they call the fourth robot in the alliance that wins Einstein? Champion. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 11-02-2014, 12:08
mechanical_robot's Avatar
mechanical_robot mechanical_robot is offline
Registered User
no team
Team Role: Driver
 
Join Date: Jul 2013
Rookie Year: 2013
Location: United States
Posts: 92
mechanical_robot will become famous soon enough
NEED Help With turning on the compressor

In C++ I just can't figure out how to turn on the compressor. So I have used this code(which is below). But whenever I turn on the robot and enable it, it just makes this very high pitched sound that only certain younger people can hear on the team. I am sure I have it wired correctly too also I have tried pretty much every wire combination for the compressor that I can think of. This isn't the only problem either, since this code is for a mecanum wheel drive whenever I enable the robot one of the talons turn one of the 4 wheels very slowly while the others remain stationary, though this code work very good without our the compressor code in it (one of the wheels don't drift).

Any help appreciated, though I have already gone through the wpilib screen steps. Any example code from previous years would also be appreciated.


Here is the code


#include "WPILib.h"


/**
* This illustrates how to use 4 Talons to drive the robot
* Created from SimpleTemplate
*/
class RobotDemo : public SimpleRobot
{
RobotDrive *myRobot; // robot drive system
Compressor *m_compressor;
Joystick stick; // only joystick
Talon talon_lf;
Talon talon_rf;
Talon talon_lr;
Talon talon_rr;

public:
RobotDemo():
//myRobot(1, 2), // these must be initialized in the same order
stick(1), // as they are declared above.
talon_lf(1),
talon_rf(2),
talon_lr(3),
talon_rr(4)



{
myRobot = new RobotDrive(talon_lf, talon_lr, talon_rf, talon_rr);
myRobot->SetExpiration(0.1);
m_compressor = new Compressor(4, 2);
m_compressor->Start();

// invert as needed
//myRobot->SetInvertedMotor(RobotDrive::kRearLeftMotor, true);
myRobot->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);
//myRobot->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
myRobot->SetInvertedMotor(RobotDrive::kRearRightMotor, true);

}

// destructor. Added by brian
~RobotDemo()
{
delete myRobot;
delete m_compressor;

}

/**
* 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(1.0); // for 2 seconds
myRobot->Drive(0.0, 0.0); // stop robot
}

/**
* Runs the motors with arcade steering.
*/
void OperatorControl()
{
printf("4 Talon Test\n");

myRobot->SetSafetyEnabled(true);
while (IsOperatorControl())
{
// arcade drive with one stick
//myRobot->ArcadeDrive(stick); // drive with arcade style

// macadum drive
float gyroAngle = 0.0; // we don't have a gyro connected
myRobot->MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetZ(), gyroAngle);

Wait(0.005); // wait for a motor update time
}
}

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

}
};

START_ROBOT_CLASS(RobotDemo);

This is the end of the code
 


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 22:06.

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