View Single Post
  #6   Spotlight this post!  
Unread 23-01-2011, 10:11
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: Encoder as PIDSource

Thanks for the help everyone. I put together the subclass that Alexander described and will post it here in case it helps anyone else. It does compile but hasn't been tested in any way.

PIDEncoder.h

Code:
#include "Encoder.h"
#include "PIDSource.h"

class PIDEncoder : public Encoder, PIDSource
{
public:
	//constructor
	PIDEncoder(UINT32 aSlot, UINT32 aChannel,
			UINT32 bSlot, UINT32 bChannel,
			bool reverseDirection, EncodingType encodingType);
	
	//destructor
	~PIDEncoder();
	
	//virtual from PIDSource
	double PIDGet();
	
private:
	
};

PIDEncoder.cpp

Code:
#include "PIDEncoder.h"

//constructor
PIDEncoder::PIDEncoder(UINT32 aSlot, UINT32 aChannel,
		UINT32 bSlot, UINT32 bChannel,
		bool reverseDirection, EncodingType encodingType) : Encoder(aSlot,aChannel,bSlot,bChannel,reverseDirection,encodingType)
{

}
	
//destructor
PIDEncoder::~PIDEncoder()
{
	
}
	
//virtual from PIDSource
double PIDEncoder::PIDGet()
{
	return this->GetDistance();
}
Reply With Quote