Go to Post For We Will Rock You, we quit counting Saturday morning when it got to 12 times. - Gary Dillard [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-02-2011, 12:31
Peter Cudmore Peter Cudmore is offline
Mentor
FRC #3543 (C4)
Team Role: Teacher
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Arnprior
Posts: 5
Peter Cudmore is an unknown quantity at this point
Pneumatics and C++

I am a mentor for a Rookie team. We are almost built and coded but are having a few issues finding the last bits of code we need.

The main problem is with the pneumatics. I can't seem to find examples of pneumatic code in c++ anywhere for us to start from.

Can anyone recommended a good source for pneumatic c++ code or give an example of the commands we need to use.

We are only using one solenoid for our grabber mechanism. I need to know the code structure to define the solenoid and how to use the function to get it to switch position when i call it.

Also the code for the compressor, spike, and auto shut off would be great too as we have just noticed that even with the compressor off the bot we still need this attached to charge the cylinder.
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2011, 09:27
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Pneumatics and C++

The Compressor class will manage everything to do with the running the compressor and turning it on/off based on the pressure switch. You just have to pass it the slot/channel of the spike relay and the pressure switch and call Start(). You will use the Selenoid class to control your solenoid. It has a Set() function to turn it on/off. Below is a simple example but it will need a little more work before it is functional. First you need to set the proper channel/slot values. I just put zeros in so you must put the correct values here for it to work. Also, I just guessed that to open your grabber you would turn your selenoid off and to close it you would turn your selenoid on. Good Luck!!

Grabber.h
Code:
#include "Compressor.h"
#include "Solenoid.h"

class Grabber
{
public:
	Grabber();
	~Grabber();
	
	void Open();
	void Close();
private:
	Compressor* pCompressor;
	Solenoid* pSolenoid;
	
};
Grabber.cpp
Code:
#include "Grabber.h"

Grabber::Grabber()
{
	this->pCompressor = new Compressor(0,0,0,0);
	this->pSolenoid = new Solenoid(0,0);
	
	this->pCompressor->Start();
	this->pSolenoid->Set(false);
}

Grabber::~Grabber()
{
	
}

void Grabber::Open()
{
	this->pSolenoid->Set(false);
}

void Grabber::Close()
{
	this->pSolenoid->Set(true);
}

Last edited by jwakeman : 15-02-2011 at 09:27. Reason: typo
Reply With Quote
Reply


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 13:26.

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