public class CanOpenProxy extends Object implements BridgeToHardware, org.lsst.ccs.framework.HasLifecycle, AlertRaiser, CanOpenEventListener
| Modifier and Type | Field and Description |
|---|---|
protected int |
bootedDeviceNB |
protected boolean |
canbusConnected |
protected org.lsst.ccs.drivers.canopenjni.CanOpenInterface |
canInterface |
protected Map<String,EPOSController> |
controllerMapByName |
protected org.lsst.ccs.services.DataProviderDictionaryService |
dataProviderDictionaryService |
protected boolean |
hardwareBootProcessEnded |
long |
hardwareBootTimeout
A timeout for the booting process : during initialization, we wait for the
boot messages coming from CANbus field.
|
protected Map<String,PieceOfHardware> |
hardwareMapByName |
protected Map<Integer,PieceOfHardware> |
hardwareMapByNodeID
Map of PieceOfHardware objects this CanOpenProxy manages.
|
protected int |
master |
protected String |
name |
protected Map<String,PlutoGateway> |
plutoGatewayMapByName |
org.lsst.ccs.Subsystem |
subs |
alertSeparator, FCSLOG| Constructor and Description |
|---|
CanOpenProxy() |
| Modifier and Type | Method and Description |
|---|---|
void |
addReceivedPDO(int cobId) |
void |
addSlave(int nodeId) |
boolean |
allDevicesBooted()
This method returns true if : all the hardware items are booted and
identified and the hardware have the node ID expected within the
configuration and the hardware is initialized.
|
void |
bootProcess()
Check if all pieces of hardware in the configuration are booted with the
correct serial number.
|
void |
checkControllers() |
void |
checkNodeID(int nodeID)
Check that a nodeID entered by an end user at the console is a valid one:
nodeID should be in the hardwareMapByNodeID.
|
void |
clearReceivedPDOs() |
void |
connectHardware()
This method is used when the loader CANbus is connected.
|
void |
connectToCANbus() |
void |
disconnectHardware()
This methods stops the CWrapper client, and the TCP server.
|
void |
doDisableOperation(int nodeID) |
void |
doShutdown()
This has to be executed in post order : after controllers and other hardware
shutdown.
|
String |
findInfo(int nodeID) |
org.lsst.ccs.services.alert.AlertService |
getAlertService()
return alertService
|
org.lsst.ccs.drivers.canopenjni.CanOpenInterface |
getCanInterface() |
Instant |
getLastBeat(int id) |
int |
getLastState(int nodeId) |
String |
getNodeName(int aNodeID)
For a piece of hardware that this tcpProxy manages, this methods returns the
name of the device when the CANopen node id is given as argument.
|
org.lsst.ccs.drivers.canopenjni.PDOData |
getPDOData() |
Set<Integer> |
getRegisteredPDOs() |
org.lsst.ccs.Subsystem |
getSubsystem() |
String |
info(int nodeID)
for end users from ccs-console.
|
void |
init()
***********************************************************************************************
******************** END OF SETTERS AND GETTERS
**********************************************
***********************************************************************************************
|
void |
init(int master,
String baud,
String busName,
int nodeID) |
protected void |
initialize()
This method initializes the fields of the tcpProxy.
|
void |
initializePDOs()
Used with JNI interface to initialize canInterface to be able to received
PDOs.
|
boolean |
isCanbusConnected() |
boolean |
isReady()
This method should return true when connection to hardware is effective and
all devices connected to that bridge have been correctly identified.
|
List<String> |
listAcSensorsNames()
Return list of names of sensors plugged on AC pluto gateway.
|
String |
listBootedNodes()
List the can open bootedNodes which are in the bootedNodes table.
|
List<String> |
listHardwareNames()
For the GUI : Return an Array containing hardware names handled by this
component.
|
List<String> |
listLoSensorsNames() |
void |
onBootMessage(int nodeID) |
void |
onEmergencyMessage(int nodeID,
int errCode,
int errReg)
Process an emergency message received from a CANopen device on the status bus
: - ALARM or WARNING Alert is raised, - a message is logged
|
void |
postStart()
check that all pieces of hardware is booted.
|
String |
printHardwareList()
Return a String with the list of hardware expected in this subsystem.
|
String |
printHardwareState()
Return a printed list of hardware with the initialization state.
|
String |
printPDOList() |
void |
publishData()
Publish Data on status bus for trending data base and GUIs.
|
void |
quit() |
void |
readDevicesInfo()
This method is called in the bootProcess method during the initialization
process.
|
long |
readSDO(int nodeID,
int index,
int subindex)
Send a rsdo command to can interface and throw Exceptions or raise Alarms in
case of something went wrong.
|
void |
recoveryPDOMissing() |
void |
reset(int nodeId) |
void |
resetHomingForOnlineClampsControllers()
In case of a clean power transient failure : OFF/ON, the
onlineClampControllers loose their homing, so we have to reset the
boolean homingDone.
|
void |
retrieveHardwareInfo()
Identification of the hardware : we want to retrieve the information stored
in the hardware of the booted bootedNodes and update the array of bootedNodes
with this information.
|
int |
scan() |
void |
setNMTStateOperational(int nodeID) |
void |
setNMTStatePreOperational(int nodeID) |
void |
setNMTStateStop(int nodeId)
Device go to NMT stop state.
|
void |
setPDOTimeout() |
void |
shutdown()
executed in pre-order : before controllers and other hardware shutdown.
|
void |
start() |
org.lsst.ccs.drivers.canopenjni.PDOData |
sync()
Send a command sync to CAN bus to read sensors by PDO.
|
String |
toString() |
protected void |
updateDeviceInfo(PieceOfHardware poh)
send a message info,nodeID to the CANbus and update the CANopen device
information with data received from the device.
|
void |
updatePDOData()
Update pdoData in sending a sync command.
|
void |
writeSDO(int nodeID,
int index,
int subindex,
int size,
long value)
Command to be used by the end user at the console.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbuild, postBuild, postInit, postShutdownclearAlarm, getAlertSeparator, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarm, raiseAlarmOnlyIfNew, raiseAlertOnlyEveryTenMinutes, raiseAlertOnlyEveryTenMinutes, raiseAlertOnlyIfNew, raiseWarning, raiseWarning, raiseWarning, raiseWarning, raiseWarningOnlyEveryTenMinutes, raiseWarningOnlyIfNew@LookupField(strategy=TOP) public org.lsst.ccs.Subsystem subs
@LookupField(strategy=TREE) protected org.lsst.ccs.services.DataProviderDictionaryService dataProviderDictionaryService
@LookupName protected String name
@LookupField(strategy=CHILDREN) protected org.lsst.ccs.drivers.canopenjni.CanOpenInterface canInterface
protected int master
@ConfigurationParameter(range="1000..100000",
description="A timeout for the hardware booting process",
units="millisecond",
category="canbus")
public volatile long hardwareBootTimeout
protected final Map<Integer,PieceOfHardware> hardwareMapByNodeID
@LookupField(strategy=CHILDREN) protected final Map<String,PieceOfHardware> hardwareMapByName
@LookupField(strategy=CHILDREN) protected final Map<String,EPOSController> controllerMapByName
@LookupField(strategy=CHILDREN) protected final Map<String,PlutoGateway> plutoGatewayMapByName
protected boolean hardwareBootProcessEnded
protected int bootedDeviceNB
protected boolean canbusConnected
public org.lsst.ccs.Subsystem getSubsystem()
getSubsystem in interface AlertRaiserpublic boolean isCanbusConnected()
isCanbusConnected in interface BridgeToHardwarepublic org.lsst.ccs.drivers.canopenjni.CanOpenInterface getCanInterface()
public org.lsst.ccs.drivers.canopenjni.PDOData getPDOData()
getPDOData in interface BridgeToHardwarepublic void init()
init in interface org.lsst.ccs.framework.HasLifecycleprotected void initialize()
@Command(type=ACTION, level=1, description="Check if all pieces of hardware are booted with the correct serial number.") public void bootProcess()
bootProcess in interface BridgeToHardwarepublic void initializePDOs()
public void updatePDOData()
updatePDOData in interface BridgeToHardware@Command(type=ACTION, level=1, description="This command may be used to recover after a clean power shutdown. But the best solution is to restart fcs.") public void recoveryPDOMissing()
public void start()
start in interface org.lsst.ccs.framework.HasLifecyclepublic void setPDOTimeout()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionpublic void connectToCANbus()
public void doDisableOperation(int nodeID)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionpublic void postStart()
postStart in interface org.lsst.ccs.framework.HasLifecyclepublic void readDevicesInfo()
public void shutdown()
shutdown in interface org.lsst.ccs.framework.HasLifecyclepublic void doShutdown()
doShutdown in interface BridgeToHardwarepublic String getNodeName(int aNodeID)
aNodeID - @Command(type=QUERY, level=3, description="Print the list of CANopen nodes which are booted on the CAN bus.") public String listBootedNodes()
public void checkNodeID(int nodeID)
nodeID - @Command(type=ACTION, level=3, description="Send a CanOpen writeSDO command to the CANBus. size represents the number of bytes on which the value is encoded. See device documentation.") public void writeSDO(int nodeID, int index, int subindex, int size, long value)
nodeID - index - subindex - size - value - FcsHardwareException@Command(type=QUERY, level=3, description="Send a CanOpen readSDO command to the CANBus.") public long readSDO(int nodeID, int index, int subindex)
nodeID - index - subindex - @Command(type=QUERY, level=3, description="Send a command sync to CAN bus to read sensors by PDO.") public org.lsst.ccs.drivers.canopenjni.PDOData sync() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description=" init CAN interface.") public void init(int master, String baud, String busName, int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="add a received PDO to canInterface.") public void addReceivedPDO(int cobId) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Clear all received PDO from canInterface. \nTo add again PDOs use command addReceivedPDO for one PDO or use commande initializePDOs to add al received PDOs.") public void clearReceivedPDOs() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Add a slave nodeId. Only for debug.") public void addSlave(int nodeId)
@Command(type=ACTION, level=3, description="Return when was seen last heartbeat for nodeId.") public Instant getLastBeat(int id)
@Command(type=ACTION, level=3, description="Return last state for nodeId.") public int getLastState(int nodeId)
@Command(type=ACTION, level=3, description="Return list of registred PDOs.") public Set<Integer> getRegisteredPDOs()
@Command(type=ACTION, level=3, description="Scan CAN bus.") public int scan() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Reset a slave on CAN bus.") public void reset(int nodeId) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=3, description="Retrieve device information as serial number, device vendor, device type.") public String info(int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
nodeID - org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Send a command quit to canInterface to device.") public void quit() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Send a command setNMTStateOperational to canInterface to device.") public void setNMTStateOperational(int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Stop a slave on CAN bus.") public void setNMTStateStop(int nodeId) throws org.lsst.ccs.drivers.commons.DriverException
nodeId - org.lsst.ccs.drivers.commons.DriverException@Command(type=ACTION, level=3, description="Send a command setNMTStatePreOperational to canInterface to device.") public void setNMTStatePreOperational(int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(type=QUERY, level=0, description="Identification of the hardware : we want to retrieve the information stored in the hardware of the CANopen devices") public void retrieveHardwareInfo()
protected void updateDeviceInfo(PieceOfHardware poh)
poh - @Command(type=QUERY, level=0, description="Return true if all CANopen devices are booted and identified.") public boolean allDevicesBooted()
allDevicesBooted in interface BridgeToHardwarepublic void onBootMessage(int nodeID)
onBootMessage in interface CanOpenEventListenerpublic void onEmergencyMessage(int nodeID,
int errCode,
int errReg)
onEmergencyMessage in interface CanOpenEventListenernodeID - errCode - errReg - @Command(type=QUERY, level=1, description="Return a printed list of hardware expected in this subsystem.") public String printHardwareList()
printHardwareList in interface BridgeToHardware@Command(type=QUERY, level=1, description="Return a printed list of hardware with the initialization state.") public String printHardwareState()
printHardwareState in interface BridgeToHardware@Command(type=QUERY, level=0, description="Return an Array containing hardware names handled by this component.") public List<String> listHardwareNames()
listHardwareNames in interface BridgeToHardwarepublic List<String> listAcSensorsNames()
BridgeToHardwarelistAcSensorsNames in interface BridgeToHardwarepublic List<String> listLoSensorsNames()
listLoSensorsNames in interface BridgeToHardware@Command(type=QUERY, description="return a list of pdo recorded by this CanOpenProxy") public String printPDOList()
@Command(type=QUERY, level=1, description="Publish booting information for all CANopen devices.") public void publishData()
publishData in interface BridgeToHardwarepublic boolean isReady()
BridgeToHardwareisReady in interface BridgeToHardwarepublic org.lsst.ccs.services.alert.AlertService getAlertService()
AlertRaisergetAlertService in interface AlertRaiserpublic void connectHardware()
BridgeToHardwareconnectHardware in interface BridgeToHardwarepublic void disconnectHardware()
BridgeToHardwaredisconnectHardware in interface BridgeToHardware@Command(type=QUERY, level=0, description="Perform a check fault on all booted EPOS controllers") public void checkControllers()
checkControllers in interface BridgeToHardwarepublic void resetHomingForOnlineClampsControllers()
public String findInfo(int nodeID) throws org.lsst.ccs.drivers.commons.DriverException
nodeID - org.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2023 LSST. All rights reserved.