![]() |
AUBO SDK
0.26.0
|
General Registers. More...
#include <register_control.h>
Public Member Functions | |
| RegisterControl () | |
| virtual | ~RegisterControl () |
| bool | getBoolInput (uint32_t address) |
| Reads the boolean from one of the input registers, which can also be accessed by a Field bus. | |
| int | setBoolInput (uint32_t address, bool value) |
| int | getInt32Input (uint32_t address) |
| Reads the integer from one of the input registers, which can also be accessed by a FieldBus. | |
| int | setInt32Input (uint32_t address, int value) |
| float | getFloatInput (uint32_t address) |
| Reads the float from one of the input registers, which can also be accessed by a Field bus. | |
| int | setFloatInput (uint32_t address, float value) |
| double | getDoubleInput (uint32_t address) |
| Reads the double value from one of the input registers, which can also be accessed by a FieldBus. | |
| int | setDoubleInput (uint32_t address, double value) |
| bool | getBoolOutput (uint32_t address) |
| Reads the boolean from one of the output registers, which can also be accessed by a Field bus. | |
| int | setBoolOutput (uint32_t address, bool value) |
| int | getInt32Output (uint32_t address) |
| Reads the integer from one of the output registers, which can also be accessed by a FieldBus. | |
| int | setInt32Output (uint32_t address, int value) |
| float | getFloatOutput (uint32_t address) |
| Reads the float from one of the output registers, which can also be accessed by a FieldBus. | |
| int | setFloatOutput (uint32_t address, float value) |
| double | getDoubleOutput (uint32_t address) |
| Reads the double value from one of the output registers. | |
| int | setDoubleOutput (uint32_t address, double value) |
| int16_t | getInt16Register (uint32_t address) |
| Used for Modbus Slave | |
| int | setInt16Register (uint32_t address, int16_t value) |
| bool | hasNamedVariable (const std::string &key) |
| Whether the named variable exists | |
| std::string | getNamedVariableType (const std::string &key) |
| Get the type of a named variable | |
| bool | variableUpdated (const std::string &key, uint64_t since) |
| Whether the named variable has been updated | |
| bool | getBool (const std::string &key, bool default_value) |
| Get variable value | |
| int | setBool (const std::string &key, bool value) |
| Set or update the variable value | |
| std::vector< char > | getVecChar (const std::string &key, const std::vector< char > &default_value) |
| Get variable value | |
| int | setVecChar (const std::string &key, const std::vector< char > &value) |
| Set or update the variable value | |
| int | getInt32 (const std::string &key, int default_value) |
| Get variable value | |
| int | setInt32 (const std::string &key, int value) |
| Set or update the variable value | |
| std::vector< int32_t > | getVecInt32 (const std::string &key, const std::vector< int32_t > &default_value) |
| Get variable value | |
| int | setVecInt32 (const std::string &key, const std::vector< int32_t > &value) |
| Set or update the variable value | |
| float | getFloat (const std::string &key, float default_value) |
| Get variable value | |
| int | setFloat (const std::string &key, float value) |
| Set or update the variable value | |
| std::vector< float > | getVecFloat (const std::string &key, const std::vector< float > &default_value) |
| Get variable value | |
| int | setVecFloat (const std::string &key, const std::vector< float > &value) |
| Set or update the variable value | |
| double | getDouble (const std::string &key, double default_value) |
| Get variable value | |
| int | setDouble (const std::string &key, double value) |
| Set or update the variable value | |
| std::vector< double > | getVecDouble (const std::string &key, const std::vector< double > &default_value) |
| Get variable value | |
| int | setVecDouble (const std::string &key, const std::vector< double > &value) |
| Set or update the variable value | |
| std::string | getString (const std::string &key, const std::string &default_value) |
| Get variable value | |
| int | setString (const std::string &key, const std::string &value) |
| Set or update the variable value | |
| int | clearNamedVariable (const std::string &key) |
| Clear variable | |
| int | setWatchDog (const std::string &key, double timeout, int action) |
| Set the watchdog | |
| int | getWatchDogAction (const std::string &key) |
| Get the watchdog action | |
| int | getWatchDogTimeout (const std::string &key) |
| Get the watchdog timeout value | |
| int | modbusAddSignal (const std::string &device_info, int slave_number, int signal_address, int signal_type, const std::string &signal_name, bool sequential_mode) |
| Adds a new modbus signal for the controller to supervise. | |
| int | modbusDeleteSignal (const std::string &signal_name) |
| Deletes the signal identified by the supplied signal name. | |
| int | modbusDeleteAllSignals () |
| Delete all modbus signals | |
| int | modbusGetSignalStatus (const std::string &signal_name) |
| Reads the current value of a specific signal. | |
| std::vector< std::string > | modbusGetSignalNames () |
| Get the collection of all signal names | |
| std::vector< int > | modbusGetSignalTypes () |
| Get the collection of all signal types | |
| std::vector< int > | modbusGetSignalValues () |
| Get the collection of all signal values | |
| std::vector< int > | modbusGetSignalErrors () |
| Get the error status of all signal requests (0: no error, others: error) as a collection | |
| int | modbusSendCustomCommand (const std::string &device_info, int slave_number, int function_code, const std::vector< uint8_t > &data) |
| Sends a command specified by the user to the modbus unit located on the specified IP address. | |
| int | modbusSetDigitalInputAction (const std::string &robot_name, const std::string &signal_name, StandardInputAction action) |
| Sets the selected digital input signal to either a "default" or "freedrive" action. | |
| int | modbusSetOutputRunstate (const std::string &robot_name, const std::string &signal_name, StandardOutputRunState runstate) |
| Set Modbus signal output action | |
| int | modbusSetOutputSignal (const std::string &signal_name, uint16_t value) |
| Sets the output register signal identified by the given name to the given value. | |
| int | modbusSetOutputSignalWithTimeout (const std::string &signal_name, uint16_t value, double timeout) |
| Sets the output register signal identified by the given name to the given, with timeout value. | |
| int | modbusSetOutputSignalPulse (const std::string &signal_name, uint16_t value, double duration) |
| Set modbus signal output pulse (only supports coil output type) | |
| int | modbusSetSignalUpdateFrequency (const std::string &signal_name, int update_frequency) |
| Sets the frequency with which the robot will send requests to the Modbus controller to either read or write the signal value. | |
| int | modbusGetSignalIndex (const std::string &signal_name) |
| Get the index of the specified modbus signal, starting from 0. | |
| int | modbusGetSignalError (const std::string &signal_name) |
| Get the error status of the specified modbus signal | |
| int | getModbusDeviceStatus (const std::string &device_name) |
| Get the connection status of the specified modbus device | |
| int | addModbusEncoder (int encoder_id, int range_id, const std::string &signal_name) |
| Use a modbus register signal as an encoder | |
| int | addInt32RegEncoder (int encoder_id, int range_id, const std::string &key) |
| Add a virtual encoder for an Int32 register | |
| int | deleteVirtualEncoder (int encoder_id) |
| Delete virtual encoder | |
Protected Attributes | |
| void * | d_ |
General Registers.
Definition at line 63 of file register_control.h.
| arcs::common_interface::RegisterControl::RegisterControl | ( | ) |
|
virtual |
| int arcs::common_interface::RegisterControl::addInt32RegEncoder | ( | int | encoder_id, |
| int | range_id, | ||
| const std::string & | key | ||
| ) |
Add a virtual encoder for an Int32 register
| encoder_id | Encoder ID |
| range_id | Range ID |
| key | Variable name |
| int arcs::common_interface::RegisterControl::addModbusEncoder | ( | int | encoder_id, |
| int | range_id, | ||
| const std::string & | signal_name | ||
| ) |
Use a modbus register signal as an encoder
| encoder_id | Must not be 0 |
| signal_name | Name of the modbus signal, must be of register type |
| int arcs::common_interface::RegisterControl::clearNamedVariable | ( | const std::string & | key | ) |
Clear variable
| key |
| int arcs::common_interface::RegisterControl::deleteVirtualEncoder | ( | int | encoder_id | ) |
Delete virtual encoder
| encoder_id |
| bool arcs::common_interface::RegisterControl::getBool | ( | const std::string & | key, |
| bool | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| bool arcs::common_interface::RegisterControl::getBoolInput | ( | uint32_t | address | ) |
Reads the boolean from one of the input registers, which can also be accessed by a Field bus.
Note, uses its own memory space.
| address | Address of the register (0:127) |
| bool arcs::common_interface::RegisterControl::getBoolOutput | ( | uint32_t | address | ) |
Reads the boolean from one of the output registers, which can also be accessed by a Field bus.
Note, uses its own memory space.
| address | Address of the register (0:127) |
| double arcs::common_interface::RegisterControl::getDouble | ( | const std::string & | key, |
| double | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| double arcs::common_interface::RegisterControl::getDoubleInput | ( | uint32_t | address | ) |
Reads the double value from one of the input registers, which can also be accessed by a FieldBus.
Note, uses its own memory space.
| address | Address of the register (0:47) |
| double arcs::common_interface::RegisterControl::getDoubleOutput | ( | uint32_t | address | ) |
Reads the double value from one of the output registers.
| address | Address of the register |
| float arcs::common_interface::RegisterControl::getFloat | ( | const std::string & | key, |
| float | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| float arcs::common_interface::RegisterControl::getFloatInput | ( | uint32_t | address | ) |
Reads the float from one of the input registers, which can also be accessed by a Field bus.
Note, uses it’s own memory space.
| address | Address of the register (0:47) |
| float arcs::common_interface::RegisterControl::getFloatOutput | ( | uint32_t | address | ) |
Reads the float from one of the output registers, which can also be accessed by a FieldBus.
Note, uses its own memory space.
| address | Address of the register (0:47) |
| int16_t arcs::common_interface::RegisterControl::getInt16Register | ( | uint32_t | address | ) |
Used for Modbus Slave
| address |
| int arcs::common_interface::RegisterControl::getInt32 | ( | const std::string & | key, |
| int | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| int arcs::common_interface::RegisterControl::getInt32Input | ( | uint32_t | address | ) |
Reads the integer from one of the input registers, which can also be accessed by a FieldBus.
Note, uses it’s own memory space.
| address | Address of the register (0:47) |
| int arcs::common_interface::RegisterControl::getInt32Output | ( | uint32_t | address | ) |
Reads the integer from one of the output registers, which can also be accessed by a FieldBus.
Note, uses its own memory space.
| address | Address of the register (0:47) |
| int arcs::common_interface::RegisterControl::getModbusDeviceStatus | ( | const std::string & | device_name | ) |
Get the connection status of the specified modbus device
| device_name | Device name in TCP format: "ip:port", e.g. "127.0.0.1:502" Device name in RTU format: "serial_port", e.g. "/dev/ttyUSB0" |
| std::string arcs::common_interface::RegisterControl::getNamedVariableType | ( | const std::string & | key | ) |
Get the type of a named variable
| key |
| std::string arcs::common_interface::RegisterControl::getString | ( | const std::string & | key, |
| const std::string & | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| std::vector< char > arcs::common_interface::RegisterControl::getVecChar | ( | const std::string & | key, |
| const std::vector< char > & | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| std::vector< double > arcs::common_interface::RegisterControl::getVecDouble | ( | const std::string & | key, |
| const std::vector< double > & | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| std::vector< float > arcs::common_interface::RegisterControl::getVecFloat | ( | const std::string & | key, |
| const std::vector< float > & | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| std::vector< int32_t > arcs::common_interface::RegisterControl::getVecInt32 | ( | const std::string & | key, |
| const std::vector< int32_t > & | default_value | ||
| ) |
Get variable value
| key | |
| default_value |
| int arcs::common_interface::RegisterControl::getWatchDogAction | ( | const std::string & | key | ) |
Get the watchdog action
| key |
| int arcs::common_interface::RegisterControl::getWatchDogTimeout | ( | const std::string & | key | ) |
Get the watchdog timeout value
| key |
| bool arcs::common_interface::RegisterControl::hasNamedVariable | ( | const std::string & | key | ) |
Whether the named variable exists
| key | Variable name |
| int arcs::common_interface::RegisterControl::modbusAddSignal | ( | const std::string & | device_info, |
| int | slave_number, | ||
| int | signal_address, | ||
| int | signal_type, | ||
| const std::string & | signal_name, | ||
| bool | sequential_mode | ||
| ) |
Adds a new modbus signal for the controller to supervise.
Expects no response.
| device_info | is rtu format. eg,"serial_port,baud,parity,data_bit,stop_bit" (1)The serial_port argument specifies the name of the serial port eg. On Linux ,"/dev/ttyS0" or "/dev/ttyUSB0". On Windows, "\.\COM10". (2)The baud argument specifies the baud rate of the communication, eg. 9600, 19200, 57600, 115200, etc. (3)parity:N for none,E for even,O for odd. (4)data_bit:The data_bits argument specifies the number of bits of data, the allowed values are 5, 6, 7 and 8. (5)stop_bit:The stop_bits argument specifies the bits of stop, the allowed values are 1 and 2. |
device_info is tcp format.eg,"ip address,port" (1)The ip address parameter specifies the ip address of the server (2)The port parameter specifies the port number that the server is listening on.
| slave_number | An integer normally not used and set to 255, but is a free choice between 0 and 255. |
| signal_address | An integer specifying the address of the either the coil or the register that this new signal should reflect. Consult the configuration of the modbus unit for this information. |
| signal_type | An integer specifying the type of signal to add. 0 = digital input, 1 = digital output, 2 = register input and 3 = register output. |
| signal_name | A string uniquely identifying the signal. If a string is supplied which is equal to an already added signal, the new signal will replace the old one. The length of the string cannot exceed 20 characters. |
| sequential_mode | Setting to True forces the modbus client to wait for a response before sending the next request. This mode is required by some fieldbus units (Optional). |
| int arcs::common_interface::RegisterControl::modbusDeleteAllSignals | ( | ) |
Delete all modbus signals
| int arcs::common_interface::RegisterControl::modbusDeleteSignal | ( | const std::string & | signal_name | ) |
Deletes the signal identified by the supplied signal name.
| signal_name | A string equal to the name of the signal that should be deleted. |
| int arcs::common_interface::RegisterControl::modbusGetSignalError | ( | const std::string & | signal_name | ) |
Get the error status of the specified modbus signal
| signal_name |
| std::vector< int > arcs::common_interface::RegisterControl::modbusGetSignalErrors | ( | ) |
Get the error status of all signal requests (0: no error, others: error) as a collection
| int arcs::common_interface::RegisterControl::modbusGetSignalIndex | ( | const std::string & | signal_name | ) |
Get the index of the specified modbus signal, starting from 0.
Returns -1 if it does not exist.
| signal_name |
| std::vector< std::string > arcs::common_interface::RegisterControl::modbusGetSignalNames | ( | ) |
Get the collection of all signal names
| int arcs::common_interface::RegisterControl::modbusGetSignalStatus | ( | const std::string & | signal_name | ) |
Reads the current value of a specific signal.
| signal_name | A string equal to the name of the signal for which the value should be gotten. |
| std::vector< int > arcs::common_interface::RegisterControl::modbusGetSignalTypes | ( | ) |
Get the collection of all signal types
| std::vector< int > arcs::common_interface::RegisterControl::modbusGetSignalValues | ( | ) |
Get the collection of all signal values
| int arcs::common_interface::RegisterControl::modbusSendCustomCommand | ( | const std::string & | device_info, |
| int | slave_number, | ||
| int | function_code, | ||
| const std::vector< uint8_t > & | data | ||
| ) |
Sends a command specified by the user to the modbus unit located on the specified IP address.
Cannot be used to request data, since the response will not be received. The user is responsible for supplying data which is meaningful to the supplied function code. The builtin function takes care of constructing the modbus frame, so the user should not be concerned with the length of the command.
| device_info | is rtu format. eg,"serial_port,baud,parity,data_bit,stop_bit" (1)The serial_port argument specifies the name of the serial port eg. On Linux ,"/dev/ttyS0" or "/dev/ttyUSB0". On Windows, "\.\COM10". (2)The baud argument specifies the baud rate of the communication, eg. 9600, 19200, 57600, 115200, etc. (3)parity:N for none,E for even,O for odd. (4)data_bit:The data_bits argument specifies the number of bits of data, the allowed values are 5, 6, 7 and 8. (5)stop_bit:The stop_bits argument specifies the bits of stop, the allowed values are 1 and 2. |
device_info is tcp format.eg,"ip address,port" (1)The ip address parameter specifies the ip address of the server (2)The port parameter specifies the port number that the server is listening on.
| slave_number | An integer specifying the slave number to use for the custom command. |
| function_code | An integer specifying the function code for the custom command. |
Modbus function codes MODBUS_FC_READ_COILS 0x01 MODBUS_FC_READ_DISCRETE_INPUTS 0x02 MODBUS_FC_READ_HOLDING_REGISTERS 0x03 MODBUS_FC_READ_INPUT_REGISTERS 0x04 MODBUS_FC_WRITE_SINGLE_COIL 0x05 MODBUS_FC_WRITE_SINGLE_REGISTER 0x06 MODBUS_FC_READ_EXCEPTION_STATUS 0x07 MODBUS_FC_WRITE_MULTIPLE_COILS 0x0F MODBUS_FC_WRITE_MULTIPLE_REGISTERS 0x10 MODBUS_FC_REPORT_SLAVE_ID 0x11 MODBUS_FC_MASK_WRITE_REGISTER 0x16 MODBUS_FC_WRITE_AND_READ_REGISTERS 0x17
| data | An array of integers in which each entry must be a valid byte (0-255) value. |
| int arcs::common_interface::RegisterControl::modbusSetDigitalInputAction | ( | const std::string & | robot_name, |
| const std::string & | signal_name, | ||
| StandardInputAction | action | ||
| ) |
Sets the selected digital input signal to either a "default" or "freedrive" action.
| robot_name | A string identifying a robot name that connected robot |
| signal_name | A string identifying a digital input signal that was previously added. |
| action | The type of action. The action can either be "default" or "freedrive". (string) |
| int arcs::common_interface::RegisterControl::modbusSetOutputRunstate | ( | const std::string & | robot_name, |
| const std::string & | signal_name, | ||
| StandardOutputRunState | runstate | ||
| ) |
Set Modbus signal output action
| robot_name | |
| signal_name | |
| runstate |
| int arcs::common_interface::RegisterControl::modbusSetOutputSignal | ( | const std::string & | signal_name, |
| uint16_t | value | ||
| ) |
Sets the output register signal identified by the given name to the given value.
| signal_name | A string identifying an output register signal that in advance has been added. |
| value | An integer which must be a valid word (0-65535) |
| int arcs::common_interface::RegisterControl::modbusSetOutputSignalPulse | ( | const std::string & | signal_name, |
| uint16_t | value, | ||
| double | duration | ||
| ) |
Set modbus signal output pulse (only supports coil output type)
| signal_name | A string identifying an output register signal that has been added in advance. |
| value | An integer which must be a valid word (0-65535) |
| duration | Duration of the signal, in seconds |
| int arcs::common_interface::RegisterControl::modbusSetOutputSignalWithTimeout | ( | const std::string & | signal_name, |
| uint16_t | value, | ||
| double | timeout | ||
| ) |
Sets the output register signal identified by the given name to the given, with timeout value.
| signal_name | A string identifying an output register signal that in advance has been added. |
| value | An integer which must be a valid word (0-65535) |
| timeout | seconds |
| int arcs::common_interface::RegisterControl::modbusSetSignalUpdateFrequency | ( | const std::string & | signal_name, |
| int | update_frequency | ||
| ) |
Sets the frequency with which the robot will send requests to the Modbus controller to either read or write the signal value.
| signal_name | A string identifying an output digital signal that in advance has been added. |
| update_frequency | An integer in the range 0-125 specifying the update frequency in Hz. |
| int arcs::common_interface::RegisterControl::setBool | ( | const std::string & | key, |
| bool | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setBoolInput | ( | uint32_t | address, |
| bool | value | ||
| ) |
| address | Address of the register (0:127) |
| value | Boolean value to set (true or false) |
| int arcs::common_interface::RegisterControl::setBoolOutput | ( | uint32_t | address, |
| bool | value | ||
| ) |
| address | Address of the register (0:127) |
| value | Boolean value to set (true or false) |
| int arcs::common_interface::RegisterControl::setDouble | ( | const std::string & | key, |
| double | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setDoubleInput | ( | uint32_t | address, |
| double | value | ||
| ) |
| address | |
| value |
| int arcs::common_interface::RegisterControl::setDoubleOutput | ( | uint32_t | address, |
| double | value | ||
| ) |
| address | Address of the register |
| value | Double value to set |
| int arcs::common_interface::RegisterControl::setFloat | ( | const std::string & | key, |
| float | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setFloatInput | ( | uint32_t | address, |
| float | value | ||
| ) |
| address | Address of the register (0:47) |
| value | Float value to set |
| int arcs::common_interface::RegisterControl::setFloatOutput | ( | uint32_t | address, |
| float | value | ||
| ) |
| address | Address of the register (0:47) |
| value | Float value to set |
| int arcs::common_interface::RegisterControl::setInt16Register | ( | uint32_t | address, |
| int16_t | value | ||
| ) |
| address | Register address |
| value | Value to set |
| int arcs::common_interface::RegisterControl::setInt32 | ( | const std::string & | key, |
| int | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setInt32Input | ( | uint32_t | address, |
| int | value | ||
| ) |
| address | Address of the register (0:47) |
| value | Integer value to set |
| int arcs::common_interface::RegisterControl::setInt32Output | ( | uint32_t | address, |
| int | value | ||
| ) |
| address | Address of the register (0:47) |
| value | Integer value to set |
| int arcs::common_interface::RegisterControl::setString | ( | const std::string & | key, |
| const std::string & | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setVecChar | ( | const std::string & | key, |
| const std::vector< char > & | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setVecDouble | ( | const std::string & | key, |
| const std::vector< double > & | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setVecFloat | ( | const std::string & | key, |
| const std::vector< float > & | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setVecInt32 | ( | const std::string & | key, |
| const std::vector< int32_t > & | value | ||
| ) |
Set or update the variable value
| key | |
| value |
| int arcs::common_interface::RegisterControl::setWatchDog | ( | const std::string & | key, |
| double | timeout, | ||
| int | action | ||
| ) |
Set the watchdog
After the watchdog is triggered, the controller will perform the corresponding action and automatically delete the watchdog.
| key | |
| timeout | Timeout in seconds (s), minimum timeout is 0.1s |
| action | NONE (0): No action PAUSE(1): Pause runtime STOP (2): Stop runtime/stop robot motion PROTECTIVE_STOP (3): Trigger protective stop |
| bool arcs::common_interface::RegisterControl::variableUpdated | ( | const std::string & | key, |
| uint64_t | since | ||
| ) |
Whether the named variable has been updated
| key | |
| since |
|
protected |
Definition at line 3146 of file register_control.h.