BowlerKernel
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice Class Reference
Inheritance diagram for com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice:
Inheritance graph
[legend]
Collaboration diagram for com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice:
Collaboration graph
[legend]

Classes

class  SyncThread
 

Public Member Functions

 VirtualGenericPIDDevice (String myVirtualDevName)
 
 VirtualGenericPIDDevice (double maxTicksPerSecond, String myVirtualDevName)
 
boolean ConfigurePDVelovityController (PDVelocityConfiguration config)
 
PDVelocityConfiguration getPDVelocityConfiguration (int group)
 
boolean ConfigurePIDController (PIDConfiguration config)
 
PIDConfiguration getPIDConfiguration (int group)
 
ArrayList< String > getNamespaces ()
 
boolean killAllPidGroups ()
 
BowlerDatagram send (BowlerAbstractCommand command) throws NoConnectionAvailableException, InvalidResponseException
 
boolean ResetPIDChannel (int group, float valueToSetCurrentTo)
 
boolean SetPIDSetPoint (int group, float setpoint, double seconds)
 
boolean SetPDVelocity (int group, int unitsPerSecond, double seconds) throws PIDCommandException
 
void flushPIDChannels (double time)
 
boolean SetAllPIDSetPoint (float[] setpoints, double seconds)
 
float GetPIDPosition (int group)
 
boolean isAvailable ()
 
float[] GetAllPIDPosition ()
 
void setMaxTicksPerSecond (double maxTicksPerSecond)
 
double getMaxTicksPerSecond ()
 
boolean connect ()
 
void disconnect ()
 
- Public Member Functions inherited from com.neuronrobotics.sdk.pid.GenericPIDDevice
 GenericPIDDevice ()
 
 GenericPIDDevice (BowlerAbstractConnection connection)
 
void setConnection (BowlerAbstractConnection connection)
 
int getPIDChannelCount ()
 
int getNumberOfChannels ()
 
void addPIDEventListener (IPIDEventListener l)
 
void removePIDEventListener (IPIDEventListener l)
 
boolean SetPIDInterpolatedVelocity (int group, int unitsPerSecond, double seconds) throws PIDCommandException
 
PIDChannel getPIDChannel (int group)
 
void onAsyncResponse (BowlerDatagram data)
 
ArrayList< PIDChannelgetChannels ()
 
void setChannels (ArrayList< PIDChannel > channels)
 
AbstractPidNamespaceImp getImplementation ()
 
void setImplementation (AbstractPidNamespaceImp implementation)
 
boolean runOutputHysteresisCalibration (int group)
 
void flush (double seconds)
 
- Public Member Functions inherited from com.neuronrobotics.sdk.common.BowlerAbstractDevice
void addConnectionEventListener (final IDeviceConnectionEventListener l)
 
void removeConnectionEventListener (IDeviceConnectionEventListener l)
 
BowlerAbstractConnection getConnection ()
 
void setAddress (MACAddress address)
 
MACAddress getAddress ()
 
BowlerDatagram send (BowlerAbstractCommand command, int retry) throws NoConnectionAvailableException, InvalidResponseException
 
Object[] send (String namespace, BowlerMethod method, String rpcString, Object[] arguments, int retry) throws DeviceConnectionException
 
Object[] send (String namespace, BowlerMethod method, String rpcString, Object[] arguments) throws DeviceConnectionException
 
boolean ping ()
 
boolean ping (boolean switchParser)
 
ArrayList< ByteListgetRevisions ()
 
boolean hasNamespace (String string)
 
void startHeartBeat ()
 
void startHeartBeat (long msHeartBeatTime)
 
void stopHeartBeat ()
 
void setThreadedUpstreamPackets (boolean up)
 
ArrayList< RpcEncapsulationgetRpcList (String namespace)
 
void loadRpcList ()
 
void onAllResponse (BowlerDatagram data)
 
boolean isKeepAlive ()
 
void setKeepAlive (boolean keepAlive)
 
long getLastPacketTime ()
 
void setLastPacketTime (long lastPacketTime)
 
String getScriptingName ()
 
void setScriptingName (String scriptingName)
 
ArrayList< IDeviceConnectionEventListenergetDisconnectListeners ()
 
- Public Member Functions inherited from com.neuronrobotics.sdk.addons.kinematics.IHardwareSyncPulseProvider
default void addIHardwareSyncPulseReciver (IHardwareSyncPulseReciver r)
 
default void removeIHardwareSyncPulseReciver (IHardwareSyncPulseReciver r)
 
default void doSync ()
 
default ArrayList< IHardwareSyncPulseRecivergetListeners ()
 

Private Member Functions

InterpolationEngine getDriveThread (int i)
 

Private Attributes

HashMap< PIDConfiguration, InterpolationEngineinterpolationEngines = new HashMap<>()
 
HashMap< Integer, PIDConfigurationconfigs = new HashMap<>()
 
ArrayList< PDVelocityConfigurationPDconfigs = new ArrayList<PDVelocityConfiguration>()
 
SyncThread sync = new SyncThread()
 
boolean runSync =true
 
double maxTicksPerSecond
 
int numChannels = 40
 
float[] backs
 
String myVirtualDevName
 

Static Private Attributes

static final long threadTime = 10
 

Additional Inherited Members

- Public Attributes inherited from com.neuronrobotics.sdk.addons.kinematics.IHardwareSyncPulseProvider
HashMap< IHardwareSyncPulseProvider, ArrayList< IHardwareSyncPulseReciver > > syncPulse =new HashMap<>()
 
- Protected Member Functions inherited from com.neuronrobotics.sdk.pid.GenericPIDDevice
void firePIDResetEvent (int group, float val)
 
void firePIDEvent (PIDEvent pidEvent)
 
- Protected Member Functions inherited from com.neuronrobotics.sdk.common.BowlerAbstractDevice
void fireDisconnectEvent ()
 
void fireConnectEvent ()
 

Detailed Description

The Class VirtualGenericPIDDevice.

Definition at line 20 of file VirtualGenericPIDDevice.java.

Constructor & Destructor Documentation

◆ VirtualGenericPIDDevice() [1/2]

com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.VirtualGenericPIDDevice ( String  myVirtualDevName)

Instantiates a new virtual generic pid device.

Parameters
myVirtualDevName

Definition at line 53 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.myVirtualDevName.

◆ VirtualGenericPIDDevice() [2/2]

com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.VirtualGenericPIDDevice ( double  maxTicksPerSecond,
String  myVirtualDevName 
)

Member Function Documentation

◆ ConfigurePDVelovityController()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.ConfigurePDVelovityController ( PDVelocityConfiguration  config)

This method sends a PID configuration object to the device. THe controller can be enabled/disabled with this method All PID parameters are stored in the PIDConfiguration ojbect prior to calling this method will be sent to the device.

Parameters
configthe configuration wrapper object
Returns
true if success

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 89 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.PDVelocityConfiguration.getGroup(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.PDconfigs.

Here is the call graph for this function:

◆ ConfigurePIDController()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.ConfigurePIDController ( PIDConfiguration  config)

This method sends a PID configuration object to the device. THe controller can be enabled/disabled with this method All PID parameters are stored in the PIDConfiguration ojbect prior to calling this method will be sent to the device.

Parameters
configthe configuration wrapper object
Returns
true if success

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 112 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.configs, and com.neuronrobotics.sdk.pid.PIDConfiguration.getGroup().

Here is the call graph for this function:

◆ connect()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.connect ( )

This method tells the connection object to start and connects the up and down streams pipes. Once this method is called and returns without exception, the device is ready to communicate with

Returns
true, if successful
Exceptions
InvalidConnectionExceptionthe invalid connection exception

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 434 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.common.BowlerAbstractDevice.fireConnectEvent().

Here is the call graph for this function:

◆ disconnect()

void com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.disconnect ( )

This method tells the connection object to disconnect its pipes and close out the connection. Once this is called, it is safe to remove your device.

Reimplemented from com.neuronrobotics.sdk.common.BowlerAbstractDevice.

Definition at line 444 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.common.BowlerAbstractDevice.fireDisconnectEvent(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.runSync.

Here is the call graph for this function:

◆ flushPIDChannels()

void com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.flushPIDChannels ( double  time)

This method will read all of the cached or current setpoints for all PID controllers and calls SetAllPIDSetPoint with its internal data.

Parameters
timethe time

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 233 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.PIDChannel.getCachedTargetValue(), com.neuronrobotics.sdk.pid.GenericPIDDevice.getChannels(), com.neuronrobotics.sdk.pid.GenericPIDDevice.getPIDChannel(), com.neuronrobotics.sdk.common.Log.info(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SetAllPIDSetPoint().

Here is the call graph for this function:

◆ GetAllPIDPosition()

float [] com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.GetAllPIDPosition ( )

◆ getDriveThread()

InterpolationEngine com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getDriveThread ( int  i)
private

◆ getMaxTicksPerSecond()

double com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getMaxTicksPerSecond ( )

Gets the max ticks per second.

Returns
the max ticks per second

Definition at line 343 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.maxTicksPerSecond.

Referenced by com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SetPDVelocity().

◆ getNamespaces()

ArrayList<String> com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getNamespaces ( )

Get all the namespaces.

Returns
the namespaces

Reimplemented from com.neuronrobotics.sdk.common.BowlerAbstractDevice.

Definition at line 133 of file VirtualGenericPIDDevice.java.

◆ getPDVelocityConfiguration()

PDVelocityConfiguration com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getPDVelocityConfiguration ( int  group)

Gets the current state of the PID group. The PIDConfiguration object will contain the current configuration state of the requested PID controller.

Parameters
groupthe index of the PID group
Returns
the configuration object

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 102 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.PDconfigs.

◆ getPIDConfiguration()

PIDConfiguration com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getPIDConfiguration ( int  group)

Gets the current state of the PID group. The PIDConfiguration object will contain the current configuration state of the requested PID controller.

Parameters
groupthe index of the PID group
Returns
the configuration object

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 123 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.configs.

◆ GetPIDPosition()

float com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.GetPIDPosition ( int  group)

This method requests a single PID controller group value. The value returned represents the current state of the PID controller's input sensor in raw units

Parameters
groupthe index of the PID group
Returns
The current value of the sensor input

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 280 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getDriveThread(), and com.neuronrobotics.sdk.pid.InterpolationEngine.getPosition().

Referenced by com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.GetAllPIDPosition(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.ResetPIDChannel().

Here is the call graph for this function:

◆ isAvailable()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.isAvailable ( )

Determines if the device is available.

Returns
true if the device is avaiable, false if it is not
Exceptions
InvalidConnectionExceptionthe invalid connection exception

Reimplemented from com.neuronrobotics.sdk.common.BowlerAbstractDevice.

Definition at line 291 of file VirtualGenericPIDDevice.java.

◆ killAllPidGroups()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.killAllPidGroups ( )

Sends a single packet to stop all PID groups at once.

Returns
true, if successful

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 145 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.configs.

◆ ResetPIDChannel()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.ResetPIDChannel ( int  group,
float  valueToSetCurrentTo 
)

This method calls a reset of the PID group. This will set the current value of the controllers input to the given value (if possible) and will set the setpoint of the PID group to the current value (stopping the output)

Parameters
groupthe index of the PID group
valueToSetCurrentTothe target value that the controller should be set to.
Returns
true if success

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 173 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.GenericPIDDevice.firePIDResetEvent(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getDriveThread(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.GetPIDPosition(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.interpolationEngines, com.neuronrobotics.sdk.pid.InterpolationEngine.ResetEncoder(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SyncThread.setPause(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.sync.

Here is the call graph for this function:

◆ send()

BowlerDatagram com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.send ( BowlerAbstractCommand  command) throws NoConnectionAvailableException, InvalidResponseException

since there is no connection, this is an easy to nip off com functionality.

Parameters
commandthe command
Returns
the bowler datagram
Exceptions
NoConnectionAvailableExceptionthe no connection available exception
InvalidResponseExceptionthe invalid response exception

Reimplemented from com.neuronrobotics.sdk.common.BowlerAbstractDevice.

Definition at line 160 of file VirtualGenericPIDDevice.java.

◆ SetAllPIDSetPoint()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SetAllPIDSetPoint ( float[]  setpoints,
double  seconds 
)

Same as SetPIDSetPoint, but will set all setpoints at once. This can be used for co-ordinated motion of independant PID control groups.

Parameters
setpointsand array of setpoint values (must match the number of availible PID control groups)
secondsunits in Seconds, the time it takes to make the transition from current to target. Zero will tell the controllers to go as fast as possible.
Returns
true if no errors occur

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 249 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getDriveThread(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.interpolationEngines, com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SyncThread.setPause(), com.neuronrobotics.sdk.pid.InterpolationEngine.StartLinearMotion(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.sync.

Referenced by com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.flushPIDChannels().

Here is the call graph for this function:

◆ setMaxTicksPerSecond()

void com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.setMaxTicksPerSecond ( double  maxTicksPerSecond)

Sets the max ticks per second.

Parameters
maxTicksPerSecondthe new max ticks per second

Definition at line 334 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.maxTicksPerSecond.

Referenced by com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.VirtualGenericPIDDevice().

◆ SetPDVelocity()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SetPDVelocity ( int  group,
int  unitsPerSecond,
double  seconds 
) throws PIDCommandException

This method will use the internal PD velocity controller to run a PID controller at a constant velocity. Since this is not using the linear interpolation, it can run forever by giving Zero as the 'seconds' parameter.

Parameters
groupthe index of the PID group
unitsPerSeconda velocity in raw units per second
secondsthe amount of time to run at this velocity, or Zero to run forever
Returns
true, if successful
Exceptions
PIDCommandExceptionIf the values are out of range with the given data

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 208 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getDriveThread(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getMaxTicksPerSecond(), com.neuronrobotics.sdk.pid.GenericPIDDevice.SetPIDInterpolatedVelocity(), and com.neuronrobotics.sdk.pid.InterpolationEngine.SetVelocity().

Here is the call graph for this function:

◆ SetPIDSetPoint()

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SetPIDSetPoint ( int  group,
float  setpoint,
double  seconds 
)

This method sets the target setpoint for the specified PID controller group. This method will set up a linear interpolation from current position to target position which will take the specified number of seconds to make that transition

Parameters
groupthe index of the PID group
setpointthe target position for the controller
secondsunits in Seconds, the time it takes to make the transition from current to target. Zero will tell the controller to go as fast as possible.
Returns
true if no errors occur

Reimplemented from com.neuronrobotics.sdk.pid.GenericPIDDevice.

Definition at line 191 of file VirtualGenericPIDDevice.java.

References com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.getDriveThread(), com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.interpolationEngines, com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SyncThread.setPause(), com.neuronrobotics.sdk.pid.InterpolationEngine.StartLinearMotion(), and com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.sync.

Here is the call graph for this function:

Member Data Documentation

◆ backs

float [] com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.backs
private

◆ configs

HashMap<Integer, PIDConfiguration> com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.configs = new HashMap<>()
private

◆ interpolationEngines

HashMap<PIDConfiguration, InterpolationEngine> com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.interpolationEngines = new HashMap<>()
private

◆ maxTicksPerSecond

double com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.maxTicksPerSecond
private

◆ myVirtualDevName

String com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.myVirtualDevName
private

◆ numChannels

int com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.numChannels = 40
private

◆ PDconfigs

ArrayList<PDVelocityConfiguration> com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.PDconfigs = new ArrayList<PDVelocityConfiguration>()
private

◆ runSync

boolean com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.runSync =true
private

◆ sync

SyncThread com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.sync = new SyncThread()
private

◆ threadTime

final long com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.threadTime = 10
staticprivate

The Constant threadTime.

Definition at line 23 of file VirtualGenericPIDDevice.java.

Referenced by com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice.SyncThread.run().


The documentation for this class was generated from the following file: