-
- All Implemented Interfaces:
-
se.cpacsystems.assist.common.Sqi,se.cpacsystems.assist.linkage.LaserSqi,se.cpacsystems.assist.sensor.SensorSqi
public class LinkageManager extends LinkageSupport implements LaserSqi
Manager for interaction with the linkage service.
To start listening for updates on linkage data: create an instance of this class LinkageManager, register a listener registerOnChangeListener, and connect to the underlying service connect.
Note! The connection towards the underlying service is asynchronous. This means that data is not ready immediately after connect. Data should be retrieved in the OnChangeListener callbacks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceLinkageManager.OnChangeListenerOnChangeListener for LinkageData change andLinkage configuration change
-
Field Summary
Fields Modifier and Type Field Description public final static intRADIANS_ABSOLUTEpublic final static intRADIANS_RELATIVEpublic final static intDEGREES_ABSOLUTEpublic final static intDEGREES_RELATIVEpublic final static intUPDATE_RATE_NORMALpublic final static intUPDATE_RATE_FASTERpublic final static intLASER_NOT_CONFIGpublic final static intLASER_CONFIG_AND_MOUNTEDpublic final static intLASER_CONFIG_AND_NOT_MOUNTEDprotected List<LinkageConfigData>linkageConfigDataprotected List<CylinderConfigData>cylinderConfigDataprotected intlinkageSqiprotected doubleheadingDriftprivate List<PressureConfigData>pressureConfigDataprivate List<ValidAngleLimitsData>validAngleLimitsData
-
Constructor Summary
Constructors Constructor Description LinkageManager(Context appC)Constructor used for creating an instance of this object.
-
Method Summary
Modifier and Type Method Description List<LinkageConfigData>getLinkageConfigData()Retrieve linkage configuration. List<CylinderConfigData>getCylinderConfigData()Return configuration of cylinders. intgetLinkageSqi()Return linkage configuration status. doublegetHeadingDrift()Return estimated heading drift between body IMU and tilt IMU.Used for tilt angle estimation. List<PressureConfigData>getPressureConfigData()Return the configuration of pressure sensors on the linkage. List<ValidAngleLimitsData>getValidAngleLimitsData()Returns the defined envelope that is valid for load indication. voidregisterOnChangeListener(LinkageManager.OnChangeListener listener)Register listening to linkage data change and linkage configuration change. voidregisterOnChangeListener(LinkageManager.OnChangeListener listener, Handler handler)Register listening to linkage data change and linkage configuration changeWithout this listener the configuration data and linkage position data will not be updated.So you most likely want to register a listener. voidunregisterOnChangeListener()Unregister listening to linkage data change and linkage configuration change voidconnect(int updateRate)Connect to Linkage Service to start receiving linkage updates voidconnect()Connect to Linkage Service to start receiving linkage updates voiddisconnect()Disconnect Linkage Service List<AngleSensorConfigData>getAngleSensorConfigData()Return configuration of angle sensors. List<LinkageConfigData>getMainLinkage()Return configuration of main linkages.Sorted from Body to tool, if no tool is mounted, last link will be tool mount. List<AngleData>getMainLinkageAngles(int angleFormat)Return angles of main linkages.Sorted from Body to tool, if no tool is mounted, last link will be tool mount. AngleDatagetAngleData(int link, int angleFormat, int axis)Retrieves the angle data of a specific link. List<AngleData>getAngleDataList(int angleFormat)Retrieves a List of AngleData objects, three (x-, y- and z-angles) for each link in thelinkage. List<AngleData>getAngleDataList(int start, int stop, int angleFormat)Return angles in part of linkage. Point3DgetLinkagePosition(int link)Returns the coordinates of the origin of the requested link in the local coordinate system. List<Point3D>getLinkagePositionList()Retrieves a List of Point3D objects, one for each link in the linkage. List<Point3D>getLinkagePositions(int start, int stop)Return positions in part of linkage.Sorted from inner to outer. List<PressureData>getPressureDataList()Return all pressures for cylinders. intgetLinkageIndex(int link)Method to get a link's index in the lists from its identifier. booleansetTiltRotator(TiltRotator tiltRotator)Set tilt rotator TiltRotatorgetTiltRotator()Get TiltRotator TiltRotatorresetTiltRotator()Reset tilt rotator intgetTiltRotatorStatus()Get tilt rotator status (sqi) TiltCouplergetTiltCoupler()Get TiltCoupler booleansetTiltCoupler(TiltCoupler tiltCoupler)Set tilt coupler intgetLaserMountedStatus()Get laser status booleansetLaserMounted(boolean mounted)Set laser status booleanenableInfoDiagnostics()Enables the information (blue messages). TiltRotatortiltRotatorReset(int step)Reset tilt rotator according to step -
-
Constructor Detail
-
LinkageManager
LinkageManager(Context appC)
Constructor used for creating an instance of this object.
-
-
Method Detail
-
getLinkageConfigData
List<LinkageConfigData> getLinkageConfigData()
Retrieve linkage configuration. Returns a list containing a LinkageConfigData object for eachof the links in the linkage.
Depending on linkage configuration, the following permissions can be requiredto access the linkage configuration:
- se.cpacsystems.permission.LINKAGE_CONFIG
- se.cpacsystems.permission.LINKAGE_CONFIG_EXTENDED
-
getCylinderConfigData
List<CylinderConfigData> getCylinderConfigData()
Return configuration of cylinders.
-
getLinkageSqi
int getLinkageSqi()
Return linkage configuration status.
-
getHeadingDrift
double getHeadingDrift()
Return estimated heading drift between body IMU and tilt IMU.Used for tilt angle estimation.
-
getPressureConfigData
List<PressureConfigData> getPressureConfigData()
Return the configuration of pressure sensors on the linkage.
-
getValidAngleLimitsData
List<ValidAngleLimitsData> getValidAngleLimitsData()
Returns the defined envelope that is valid for load indication.
-
registerOnChangeListener
void registerOnChangeListener(LinkageManager.OnChangeListener listener)
Register listening to linkage data change and linkage configuration change.
Without this listener the configuration data and linkage position data will not be updated.So you most likely want to register a listener.
Will try to post the listener events on the looper associated with the thread this method wascalled on. If looper not available will resort to the main looper.
- Parameters:
listener- the listener
-
registerOnChangeListener
void registerOnChangeListener(LinkageManager.OnChangeListener listener, Handler handler)
Register listening to linkage data change and linkage configuration change
Without this listener the configuration data and linkage position data will not be updated.So you most likely want to register a listener.
- Parameters:
listener- the listenerhandler- the handler where the listener events will be delivered to.If null will try to post the listener events on the looper associated with the thread this methodwas called on.
-
unregisterOnChangeListener
void unregisterOnChangeListener()
Unregister listening to linkage data change and linkage configuration change
-
connect
void connect(int updateRate)
Connect to Linkage Service to start receiving linkage updates
- Parameters:
updateRate- requested update rate.
-
connect
void connect()
Connect to Linkage Service to start receiving linkage updates
-
disconnect
void disconnect()
Disconnect Linkage Service
-
getAngleSensorConfigData
List<AngleSensorConfigData> getAngleSensorConfigData()
Return configuration of angle sensors.
-
getMainLinkage
List<LinkageConfigData> getMainLinkage()
Return configuration of main linkages.Sorted from Body to tool, if no tool is mounted, last link will be tool mount.
-
getMainLinkageAngles
List<AngleData> getMainLinkageAngles(int angleFormat)
Return angles of main linkages.Sorted from Body to tool, if no tool is mounted, last link will be tool mount.
-
getAngleData
AngleData getAngleData(int link, int angleFormat, int axis)
Retrieves the angle data of a specific link. Angles can be requested in degrees or radians,either relative the previous link (angleFormat requested as RADIANS_RELATIVE orDEGREES_RELATIVE) or relative the local coordinate system (angleFormat requested asRADIANS_ABSOLUTE or DEGREES_ABSOLUTE). Angles can be requested for one of the threecoordinate axes x, y, or z. Angles are returned as AngleData objects AngleData
The following permissions are required to access angle data:
- se.cpacsystems.permission.LINKAGE_ANGLE
- se.cpacsystems.permission.LINKAGE_ANGLE_EXTENDED
- Parameters:
link- the identifier of the requested link (see inherited fields from LinkageManager)angleFormat- an int with the format of the requested angle, RADIANS_RELATIVE,DEGREES_RELATIVE, RADIANS_ABSOLUTE or DEGREES_ABSOLUTEaxis- an int with the requested axis of the angle, AXIS_X, AXIS_Y or AXIS_Z.
-
getAngleDataList
List<AngleData> getAngleDataList(int angleFormat)
Retrieves a List of AngleData objects, three (x-, y- and z-angles) for each link in thelinkage. The link order of the list is identical to that in the list returned from getLinkageConfigData, however all three angles of one link is grouped together. That is, theorder of the list is [link 1 x-angle, link 1 y-angle, link 1 z-angle, link 2 x-angle, ...link n x-angle, link n y-angle, link n z-angle].
The following permissions are required to access angle data:
- se.cpacsystems.permission.LINKAGE_ANGLE
- se.cpacsystems.permission.LINKAGE_ANGLE_EXTENDED
- Parameters:
angleFormat- an int with the format of the requested angle, RADIANS_RELATIVE,DEGREES_RELATIVE, RADIANS_ABSOLUTE or DEGREES_ABSOLUTE
-
getAngleDataList
List<AngleData> getAngleDataList(int start, int stop, int angleFormat)
Return angles in part of linkage.Sorted from inner to outer with three AngleData per link (X, Y, Z).
- Parameters:
start- Start link.stop- Stop link.angleFormat- Format to return angle in, RADIANS_ABSOLUTE, RADIANS_RELATIVE, DEGREES_ABSOLUTE, DEGREES_RELATIVE
-
getLinkagePosition
Point3D getLinkagePosition(int link)
Returns the coordinates of the origin of the requested link in the local coordinate system.This is returned as a Point3D object, in which the following fields are defined:
- x - (double) the x-coordinate in meters
- y - (double) the y-coordinate in meters
- z - (double) the z-coordinate in meters
- sqi - (integer) the SQI of the point data
Depending on linkage configuration, the following permissions can be requiredlinkage positions:
- se.cpacsystems.permission.LINKAGE_POSITION_MAIN
- se.cpacsystems.permission.LINKAGE_POSITION_GNSS
- se.cpacsystems.permission.LINKAGE_POSITION_LASER
- se.cpacsystems.permission.LINKAGE_POSITION_OTHER
- Parameters:
link- the identifier of the requested link
-
getLinkagePositionList
List<Point3D> getLinkagePositionList()
Retrieves a List of Point3D objects, one for each link in the linkage. The link order of thelist is identical to that in the list returned from getLinkageConfigData.
-
getLinkagePositions
List<Point3D> getLinkagePositions(int start, int stop)
Return positions in part of linkage.Sorted from inner to outer.
- Parameters:
start- Start linkstop- Stop link
-
getPressureDataList
List<PressureData> getPressureDataList()
Return all pressures for cylinders.
-
getLinkageIndex
int getLinkageIndex(int link)
Method to get a link's index in the lists from its identifier. This can be used to get a specifics link's datafrom the list i.e. getLinkageConfigDataList().get(getLinkageIndex(link)).
- Parameters:
link- the linkage identifier, e.g.
-
setTiltRotator
boolean setTiltRotator(TiltRotator tiltRotator)
Set tilt rotator
-
getTiltRotator
TiltRotator getTiltRotator()
Get TiltRotator
-
resetTiltRotator
TiltRotator resetTiltRotator()
Reset tilt rotator
-
getTiltRotatorStatus
int getTiltRotatorStatus()
Get tilt rotator status (sqi)
-
getTiltCoupler
TiltCoupler getTiltCoupler()
Get TiltCoupler
-
setTiltCoupler
boolean setTiltCoupler(TiltCoupler tiltCoupler)
Set tilt coupler
-
getLaserMountedStatus
int getLaserMountedStatus()
Get laser status
-
setLaserMounted
boolean setLaserMounted(boolean mounted)
Set laser status
-
enableInfoDiagnostics
boolean enableInfoDiagnostics()
Enables the information (blue messages).
-
tiltRotatorReset
TiltRotator tiltRotatorReset(int step)
Reset tilt rotator according to step
-
-
-
-