4#ifndef AUBO_SDK_REGISTER_CONTROL_INTERFACE_H
5#define AUBO_SDK_REGISTER_CONTROL_INTERFACE_H
12#include <aubo/global_config.h>
58namespace common_interface {
609 bool getBool(
const std::string &key,
bool default_value);
631 int setBool(
const std::string &key,
bool value);
655 const std::vector<char> &default_value);
678 int setVecChar(
const std::string &key,
const std::vector<char> &value);
700 int getInt32(
const std::string &key,
int default_value);
746 const std::vector<int32_t> &default_value);
769 int setVecInt32(
const std::string &key,
const std::vector<int32_t> &value);
792 float getFloat(
const std::string &key,
float default_value);
838 const std::vector<float> &default_value);
861 int setVecFloat(
const std::string &key,
const std::vector<float> &value);
884 double getDouble(
const std::string &key,
double default_value);
931 const std::vector<double> &default_value);
954 int setVecDouble(
const std::string &key,
const std::vector<double> &value);
977 const std::string &default_value);
999 int setString(
const std::string &key,
const std::string &value);
1137 int signal_address,
int signal_type,
1138 const std::string &signal_name,
bool sequential_mode);
1346 int slave_number,
int function_code,
1347 const std::vector<uint8_t> &data);
1380 const std::string &signal_name,
1399 const std::string &signal_name,
1457 uint16_t value,
double duration);
1488 int update_frequency);
1549 const std::string &signal_name);
1559 const std::string &key);
1575#define RegisterControl_DECLARES \
1576 _FUNC(RegisterControl, 1, getBoolInput, address) \
1577 _INST(RegisterControl, 2, setBoolInput, address, value) \
1578 _FUNC(RegisterControl, 1, getInt32Input, address) \
1579 _INST(RegisterControl, 2, setInt32Input, address, value) \
1580 _FUNC(RegisterControl, 1, getFloatInput, address) \
1581 _INST(RegisterControl, 2, setFloatInput, address, value) \
1582 _FUNC(RegisterControl, 1, getDoubleInput, address) \
1583 _INST(RegisterControl, 2, setDoubleInput, address, value) \
1584 _FUNC(RegisterControl, 1, getBoolOutput, address) \
1585 _INST(RegisterControl, 2, setBoolOutput, address, value) \
1586 _FUNC(RegisterControl, 1, getInt32Output, address) \
1587 _INST(RegisterControl, 2, setInt32Output, address, value) \
1588 _FUNC(RegisterControl, 1, getFloatOutput, address) \
1589 _INST(RegisterControl, 2, setFloatOutput, address, value) \
1590 _FUNC(RegisterControl, 1, getDoubleOutput, address) \
1591 _INST(RegisterControl, 2, setDoubleOutput, address, value) \
1592 _FUNC(RegisterControl, 1, getInt16Register, address) \
1593 _INST(RegisterControl, 2, setInt16Register, address, value) \
1594 _FUNC(RegisterControl, 2, variableUpdated, key, since) \
1595 _FUNC(RegisterControl, 1, hasNamedVariable, key) \
1596 _FUNC(RegisterControl, 1, getNamedVariableType, key) \
1597 _FUNC(RegisterControl, 2, getBool, key, default_value) \
1598 _INST(RegisterControl, 2, setBool, key, value) \
1599 _FUNC(RegisterControl, 2, getVecChar, key, default_value) \
1600 _INST(RegisterControl, 2, setVecChar, key, value) \
1601 _FUNC(RegisterControl, 2, getInt32, key, default_value) \
1602 _INST(RegisterControl, 2, setInt32, key, value) \
1603 _FUNC(RegisterControl, 2, getVecInt32, key, default_value) \
1604 _INST(RegisterControl, 2, setVecInt32, key, value) \
1605 _FUNC(RegisterControl, 2, getFloat, key, default_value) \
1606 _INST(RegisterControl, 2, setFloat, key, value) \
1607 _FUNC(RegisterControl, 2, getVecFloat, key, default_value) \
1608 _INST(RegisterControl, 2, setVecFloat, key, value) \
1609 _FUNC(RegisterControl, 2, getDouble, key, default_value) \
1610 _INST(RegisterControl, 2, setDouble, key, value) \
1611 _FUNC(RegisterControl, 2, getVecDouble, key, default_value) \
1612 _INST(RegisterControl, 2, setVecDouble, key, value) \
1613 _FUNC(RegisterControl, 2, getString, key, default_value) \
1614 _INST(RegisterControl, 2, setString, key, value) \
1615 _INST(RegisterControl, 1, clearNamedVariable, key) \
1616 _INST(RegisterControl, 3, setWatchDog, key, timeout, action) \
1617 _FUNC(RegisterControl, 1, getWatchDogAction, key) \
1618 _FUNC(RegisterControl, 1, getWatchDogTimeout, key) \
1619 _INST(RegisterControl, 6, modbusAddSignal, device_info, slave_number, signal_address, signal_type, signal_name, sequential_mode) \
1620 _INST(RegisterControl, 1, modbusDeleteSignal, signal_name) \
1621 _INST(RegisterControl, 0, modbusDeleteAllSignals) \
1622 _FUNC(RegisterControl, 1, modbusGetSignalStatus, signal_name) \
1623 _FUNC(RegisterControl, 0, modbusGetSignalNames) \
1624 _FUNC(RegisterControl, 0, modbusGetSignalTypes) \
1625 _FUNC(RegisterControl, 0, modbusGetSignalValues) \
1626 _FUNC(RegisterControl, 0, modbusGetSignalErrors) \
1627 _INST(RegisterControl, 4, modbusSendCustomCommand, IP, slave_number, function_code, data) \
1628 _INST(RegisterControl, 3, modbusSetDigitalInputAction, robot_name, signal_name, action) \
1629 _INST(RegisterControl, 3, modbusSetOutputRunstate, robot_name, signal_name, runstate) \
1630 _INST(RegisterControl, 2, modbusSetOutputSignal, signal_name, value) \
1631 _INST(RegisterControl, 3, modbusSetOutputSignalPulse, signal_name, value, duration) \
1632 _INST(RegisterControl, 2, modbusSetSignalUpdateFrequency, signal_name, update_frequency) \
1633 _FUNC(RegisterControl, 1, modbusGetSignalIndex, signal_name) \
1634 _FUNC(RegisterControl, 1, modbusGetSignalError, signal_name) \
1635 _FUNC(RegisterControl, 1, getModbusDeviceStatus, device_name) \
1636 _FUNC(RegisterControl, 3, addModbusEncoder, encoder_id, range_id, signal_name) \
1637 _FUNC(RegisterControl, 3, addInt32RegEncoder, encoder_id, range_id, key) \
1638 _FUNC(RegisterControl, 1, deleteVirtualEncoder, encoder_id)
float getFloatOutput(uint32_t address)
Reads the float from one of the output registers, which can also be accessed by a Field bus.
int setVecChar(const std::string &key, const std::vector< char > &value)
设置/更新变量值
int getInt32Output(uint32_t address)
Reads the integer from one of the output registers, which can also be accessed by a Field bus.
int setBool(const std::string &key, bool value)
设置/更新变量值
int deleteVirtualEncoder(int encoder_id)
删除虚拟编码器
int setVecFloat(const std::string &key, const std::vector< float > &value)
设置/更新变量值
int setVecInt32(const std::string &key, const std::vector< int32_t > &value)
设置/更新变量值
int getModbusDeviceStatus(const std::string &device_name)
获取指定 modbus 设备的连接状态
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.
bool getBool(const std::string &key, bool default_value)
获取变量值
std::vector< double > getVecDouble(const std::string &key, const std::vector< double > &default_value)
获取变量值
int modbusDeleteAllSignals()
Delete all modbus signals
std::vector< int > modbusGetSignalErrors()
获取所有信号的请求是否有错误(0:无错误,其他:有错误)集合
double getDoubleOutput(uint32_t address)
std::vector< int32_t > getVecInt32(const std::string &key, const std::vector< int32_t > &default_value)
获取变量值
int modbusGetSignalIndex(const std::string &signal_name)
获取指定 modbus 信号索引,从0开始,不能存在则返回-1
int setInt32(const std::string &key, int value)
设置/更新变量值
std::vector< std::string > modbusGetSignalNames()
获取所有信号的名字集合
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 getWatchDogTimeout(const std::string &key)
获取看门狗超时时间
int getInt32Input(uint32_t address)
Reads the integer from one of the input registers, which can also be accessed by a Field bus.
int setVecDouble(const std::string &key, const std::vector< double > &value)
设置/更新变量值
int setInt16Register(uint32_t address, int16_t value)
float getFloatInput(uint32_t address)
Reads the float from one of the input registers, which can also be accessed by a Field bus.
bool hasNamedVariable(const std::string &key)
具名变量是否存在
int getWatchDogAction(const std::string &key)
获取看门狗动作
std::string getNamedVariableType(const std::string &key)
获取具名变量的类型
std::vector< int > modbusGetSignalTypes()
获取所有信号的类型集合
int16_t getInt16Register(uint32_t address)
用于 Modbus Slave
int setInt32Input(uint32_t address, int value)
int getInt32(const std::string &key, int default_value)
获取变量值
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 setString(const std::string &key, const std::string &value)
设置/更新变量值
int modbusGetSignalError(const std::string &signal_name)
获取指定 modbus 信号的错误状态
int setFloat(const std::string &key, float value)
设置/更新变量值
int setDouble(const std::string &key, double value)
设置/更新变量值
int setWatchDog(const std::string &key, double timeout, int action)
设置看门狗
int modbusSetOutputRunstate(const std::string &robot_name, const std::string &signal_name, StandardOutputRunState runstate)
设置 Modbus 信号输出动作
int modbusSetOutputSignalPulse(const std::string &signal_name, uint16_t value, double duration)
设置modbus信号输出脉冲(仅支持线圈输出类型)
double getDouble(const std::string &key, double default_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 setDoubleOutput(uint32_t address, double value)
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.
bool variableUpdated(const std::string &key, uint64_t since)
具名变量是否更新
std::vector< float > getVecFloat(const std::string &key, const std::vector< float > &default_value)
获取变量值
std::vector< int > modbusGetSignalValues()
获取所有信号的数值集合
int addInt32RegEncoder(int encoder_id, int range_id, const std::string &key)
添加Int32寄存器的虚拟编码器
std::string getString(const std::string &key, const std::string &default_value)
获取变量值
int modbusGetSignalStatus(const std::string &signal_name)
Reads the current value of a specific signal.
int addModbusEncoder(int encoder_id, int range_id, const std::string &signal_name)
将某个 modbus 寄存器信号作为编码器
double getDoubleInput(uint32_t address)
int clearNamedVariable(const std::string &key)
清除变量
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...
int setBoolInput(uint32_t address, bool value)
int setInt32Output(uint32_t address, int value)
int setFloatInput(uint32_t address, float value)
int setBoolOutput(uint32_t address, bool value)
int modbusDeleteSignal(const std::string &signal_name)
Deletes the signal identified by the supplied signal name.
int setDoubleInput(uint32_t address, double value)
int setFloatOutput(uint32_t address, float value)
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.
std::vector< char > getVecChar(const std::string &key, const std::vector< char > &default_value)
获取变量值
float getFloat(const std::string &key, float default_value)
获取变量值
std::shared_ptr< RegisterControl > RegisterControlPtr
StandardInputAction
The StandardInputAction enum
StandardOutputRunState
标准输出运行状态
@ MB_ERR_NOT_INIT
MODBUS unit not initiallized
@ MB_ERR_SLAVE_DEVICE_BUSY
Specialized use in conjunction with programming commands sent to the remote MODBUS unit,...
@ MB_ERR_ILLEGAL_FUNCTION
The function code received in the query is not an allowable action for the server (or slave).
@ MB_ERR_ILLEGAL_DATA_ADDRESS
The function code received in the query is not an allowable action for the server (or slave),...
@ MB_ERR_DISCONNECTED
MODBUS unit disconnected
@ MB_ERR_SLAVE_DEVICE_FAILURE
An unrecoverable error occurred while the server (or slave) was attempting to perform the requested a...
@ MB_ERR_ILLEGAL_DATA_VALUE
A value contained in the query data field is not an allowable value for server (or slave),...
@ MB_ERR_ACKNOWLEDGE
Specialized use in conjunction with programming commands sent to the remote MODBUS unit.