1 package com.neuronrobotics.sdk.namespace.bcs.pid;
3 import java.util.ArrayList;
5 import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
6 import com.neuronrobotics.sdk.common.BowlerDatagram;
7 import com.neuronrobotics.sdk.common.Log;
8 import com.neuronrobotics.sdk.pid.IPIDEventListener;
9 import com.neuronrobotics.sdk.pid.PIDChannel;
10 import com.neuronrobotics.sdk.pid.PIDCommandException;
11 import com.neuronrobotics.sdk.pid.PIDEvent;
12 import com.neuronrobotics.sdk.pid.PIDLimitEvent;
21 private ArrayList<IPIDEventListener>
PIDEventListeners =
new ArrayList<IPIDEventListener>();
24 protected ArrayList<PIDChannel>
channels =
null;
43 public void onPIDReset(
int group,
float currentValue) {}
83 Log.
info(
"Flushing in "+time+
"ms");
91 long dist = (long)unitsPerSecond*(
long)seconds;
93 if(delt>2147483646 || delt<-2147483646){
94 throw new PIDCommandException(
"(Current Position) - (Velocity * Time) too large: "+delt+
"\nTry resetting the encoders");
137 l.onPIDLimitEvent(e);
150 Log.
error(
"This event timestamp is out of date, aborting"+e);
175 l.onPIDReset(group,value);
234 channels=
new ArrayList<PIDChannel>();
270 throw new RuntimeException(
"Must be set to a real value");
static void info(String message)
static void error(String message)
Integer getChannelCount()
void removePIDEventListener(IPIDEventListener l)
AbstractPidNamespaceImp(BowlerAbstractDevice device)
ArrayList< IPIDEventListener > PIDEventListeners
void firePIDEvent(PIDEvent e)
void setChannels(ArrayList< PIDChannel > channels)
void setDevice(BowlerAbstractDevice device)
int getNumberOfChannels()
void setChannelCount(Integer channelCount)
void firePIDResetEvent(int group, float value)
boolean SetPIDInterpolatedVelocity(int group, int unitsPerSecond, double seconds)
abstract void onAsyncResponse(BowlerDatagram data)
void flushPIDChannels(double time)
BowlerAbstractDevice device
void addPIDEventListener(IPIDEventListener l)
void firePIDLimitEvent(PIDLimitEvent e)
float GetCachedPosition(int group)
ArrayList< PIDChannel > getChannels()
ArrayList< PIDChannel > channels
void SetCachedPosition(int group, float value)
PIDChannel getPIDChannel(int group)
BowlerAbstractDevice getDevice()
float getCachedTargetValue()
void setCurrentCachedPosition(float currentCachedPosition)
float getCurrentCachedPosition()
boolean SetAllPIDSetPoint(float[]setpoints, double seconds)
boolean SetPIDSetPoint(int group, float setpoint, double seconds)
void onPIDEvent(PIDEvent e)