Go to Post You can expect to see the the same old same old again this weekend! Another set of fantastic experiences for thousands of kids across the country. And once again, Mission Accomplished. - Aidan F. Browne [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
  #3   Spotlight this post!  
Unread 15-02-2010, 00:14
z2daj z2daj is offline
Registered User
FRC #2836 (Team Beta)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Bethlehem, CT
Posts: 15
z2daj is an unknown quantity at this point
Send a message via AIM to z2daj
Re: Limit Switch Draws Tears

As far as we can tell everything is as you say, we have the module in slot 4 and are attemting to get the state of the input directly from the module itself not the dashboard. We simply created an object called Dig4 and set it equal to DigitalInput(1), here's the code.
Code:
#include "WPILib.h"
#include "Vision/AxisCamera.h"
#include "Vision/HSLImage.h"
#include "PIDController.h"
#include "Gyro.h"
#include "Target.h"
#include "DashboardDataSender.h"
#include "Jaguar.h"
#include "Compressor.h"
#include "Solenoid.h"
#include "Victor.h"


class DefaultRobot : public SimpleRobot
{
	
	//RobotDrive *myRobot;			// robot drive system
	Joystick *rightstick;			// joystick 2 
	Joystick *leftstick;			// joystick 1 
	Gyro *gyro;						// gyro initialization
	DashboardDataSender *dds;		// Driver station data sender
	DriverStation *ds;				// driver station object
	Victor *jag1;// single jaguar motor control
	Victor *jag2;
	Victor *jag3;
	Victor *jag4;
	Compressor *compressor; 		// new compressor object
	Solenoid *solleft;				// solenoid on left
	Solenoid *solright;				// solenoid on right
	DigitalInput *Dig1;
	
	enum Resolution_t
		{
			kResolution_320x240
		};
	/*enum							// Driver Station jumpers to control program operation
	{ ARCADE_MODE = 1,				// Tank/Arcade jumper is on DS Input 1 (Jumper present is arcade)
	  ENABLE_AUTONOMOUS = 2,		// Autonomous/Teleop jumper is on DS Input 2 (Jumper present is autonomous)
	} jumpers;	*/                            

public:
		DefaultRobot(void)
	{
		GetWatchdog().SetEnabled(false);
		ds = DriverStation::GetInstance();
		//myRobot = new RobotDrive(1, 3, 2, 4);	// create robot drive base
		leftstick = new Joystick(1);
		rightstick = new Joystick(2);			// create the joysticks
		dds = new DashboardDataSender();		// dashboard data sending
		
		compressor = new Compressor(10, 8);  //compressor on ports 10 and 8
		solleft = new Solenoid(1);			 //solenoid on ports 1 and 2(below)
		solright = new Solenoid(2);
		jag1= new Victor(1);
		jag2= new Victor(2);
		jag3= new Victor(3);
		jag4= new Victor(4);
		Dig1 = new DigitalInput(1, 1);
		
		//Update the motors at least every 100ms.
		
		

	}

	/**
	 * Drive left & right motors for 2 seconds, enabled by a jumper (jumper
	 * must be in for autonomous to operate).
	 */
	void Autonomous(void)
	{
		
	}

	
	void OperatorControl(void)
	{
		AxisCamera &camera = AxisCamera::GetInstance();
		camera.WriteResolution(AxisCameraParams::kResolution_320x240);
		camera.WriteBrightness(200);
		while (IsOperatorControl())
					
		{	GetWatchdog().Feed();
	
			if (Dig1->Get() == 0)
			{
				jag1->Set(0.0);
				jag2->Set(0.0);
				jag3->Set(0.0);
				jag4->Set(0.0);
			}
			else if(Dig1->Get() == 1)
			{
				jag1->Set(-leftstick->GetY());
				jag2->Set(rightstick->GetY());
				jag3->Set(-leftstick->GetY());
				jag4->Set(rightstick->GetY());
			}
			else
			{
				jag1->Set(-1.0);
				jag2->Set(1.0);
			}
			compressor->Start();
			if (leftstick->GetRawButton(2))
			{
				//jag->Set(1.0);
				solleft->Set(1);
				solright->Set(0);
			}
			else
			{
				//jag->Set(0.0);
				solleft->Set(0);
				solright->Set(1);
			}
			//myRobot->TankDrive(rightstick, leftstick);
			compressor->GetPressureSwitchValue();
		}
		};
	
};START_ROBOT_CLASS(DefaultRobot);
We have also used our multimeter to check the limit switch and the digital side car works for everything else we have used (motors, compressor, gyro and so on). We also found out earlier that this year it is illegal to connect the limit switch directly to the jaguar in accordance to R<54>.

Soo, we are still stuck.
__________________
There is nothing to fear, but fear itself
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
limit switch solomason519 Programming 9 09-02-2010 08:50
Using a limit switch to limit motion ManicMechanic Programming 16 20-12-2007 00:54
limit switch wedellm Electrical 4 16-02-2007 13:01
Limit Switch Basics JWSnedden Programming 6 30-11-2006 19:48


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

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