RTDE客户端
More...
#include <rtde.h>
|
| | RtdeClient (int mode=0) |
| | RTDE客户端初始化
|
| | ~RtdeClient () |
| void | setLogHandler (std::function< void(int, const char *, int, const std::string &)> handler) |
| | 设置日志处理器
|
| int | connect (const std::string &ip="", int port=0) |
| | 连接到服务器
|
| bool | hasConnected () const |
| | socket 是否已连接
|
| bool | hasConnected1 (std::function< void(bool)> callback) |
| | socket 是否已连接
|
| int | login (const std::string &usrname, const std::string &passwd) |
| | 登录
|
| bool | hasLogined () |
| | 是否已经登录
|
| int | logout () |
| | 登出
|
| int | disconnect () |
| | 断开连接
|
| int | getProtocolVersion () |
| | 获取协议版本号
|
| std::map< std::string, int > | getInputMaps () |
| | 获取输入列表
|
| std::map< std::string, int > | getOutputMaps () |
| | 获取输出列表
|
| int | setTopic (bool to_server, const std::vector< std::string > &names, double freq, int expected_chanel) |
| | 设置话题
|
| int | removeTopic (bool to_server, int chanel) |
| | 取消订阅
|
| std::unordered_map< int, agvc_interface::RtdeRecipe > | getRegisteredInputRecipe () |
| | 获取已注册的输入菜单
|
| std::unordered_map< int, agvc_interface::RtdeRecipe > | getRegisteredOutputRecipe () |
| | 获取已注册的输出菜单
|
| int | subscribe (int chanel, std::function< void(InputParser &)> callback) |
| | 订阅 subscribe from output
|
| int | publish (int chanel, std::function< void(OutputBuilder &)> callback) |
| | 发布 publish to input
|
| int | setEventHandler (std::function< void(int)> cb) |
| | 设置事件处理
|
RTDE客户端
Definition at line 79 of file rtde.h.
◆ Event
| Enumerator |
|---|
| Connected | |
| Disconnected | |
Definition at line 82 of file rtde.h.
◆ RtdeClient()
| agvc_interface::RtdeClient::RtdeClient |
( |
int | mode = 0 | ) |
|
RTDE客户端初始化
- Parameters
-
| mode | 设置通讯方式, 0 tcp通讯 1 uds通讯 |
◆ ~RtdeClient()
| agvc_interface::RtdeClient::~RtdeClient |
( |
| ) |
|
◆ connect()
| int agvc_interface::RtdeClient::connect |
( |
const std::string & | ip = "", |
|
|
int | port = 0 ) |
连接到服务器
- Parameters
-
| ip | IP地址 |
| port | 端口号,RTDE 端口号为30110 |
- Return values
-
◆ disconnect()
| int agvc_interface::RtdeClient::disconnect |
( |
| ) |
|
◆ getInputMaps()
| std::map< std::string, int > agvc_interface::RtdeClient::getInputMaps |
( |
| ) |
|
◆ getOutputMaps()
| std::map< std::string, int > agvc_interface::RtdeClient::getOutputMaps |
( |
| ) |
|
◆ getProtocolVersion()
| int agvc_interface::RtdeClient::getProtocolVersion |
( |
| ) |
|
◆ getRegisteredInputRecipe()
获取已注册的输入菜单
- Returns
- 已注册的输入菜单
◆ getRegisteredOutputRecipe()
获取已注册的输出菜单
- Returns
- 已注册的输出菜单
◆ hasConnected()
| bool agvc_interface::RtdeClient::hasConnected |
( |
| ) |
const |
socket 是否已连接
- Return values
-
| true | 已连接socket |
| false | 未连接socket |
◆ hasConnected1()
| bool agvc_interface::RtdeClient::hasConnected1 |
( |
std::function< void(bool)> | callback | ) |
|
socket 是否已连接
- Parameters
-
- Return values
-
| true | 已连接socket |
| false | 未连接socket |
◆ hasLogined()
| bool agvc_interface::RtdeClient::hasLogined |
( |
| ) |
|
◆ login()
| int agvc_interface::RtdeClient::login |
( |
const std::string & | usrname, |
|
|
const std::string & | passwd ) |
登录
- Parameters
-
- Return values
-
◆ logout()
| int agvc_interface::RtdeClient::logout |
( |
| ) |
|
◆ publish()
| int agvc_interface::RtdeClient::publish |
( |
int | chanel, |
|
|
std::function< void(OutputBuilder &)> | callback ) |
发布 publish to input
- Parameters
-
| chanel | 通道 |
| callback | 回调函数,用于构建发布的输出信息。
回调函数的定义如下: void callback(OutputBuilder &builder) |
- Return values
-
◆ removeTopic()
| int agvc_interface::RtdeClient::removeTopic |
( |
bool | to_server, |
|
|
int | chanel ) |
取消订阅
- Parameters
-
| to_server | 数据流向 true 表示客户端给服务器发送消息,false 表示服务器给客户端发送消息 |
| chanel | 通道 |
- Return values
-
◆ setEventHandler()
| int agvc_interface::RtdeClient::setEventHandler |
( |
std::function< void(int)> | cb | ) |
|
设置事件处理
- Parameters
-
- Returns
◆ setLogHandler()
| void agvc_interface::RtdeClient::setLogHandler |
( |
std::function< void(int, const char *, int, const std::string &)> | handler | ) |
|
设置日志处理器
此函数可设置自定义的日志处理函数来处理日志消息。
Aubo SDK 有一套默认的日志系统,按照默认的格式输出到默认的文件。 如果用户不希望采用默认的格式或者不希望输出到默认的文件,那就可以通过这个接口重新自定义格式,或者输出路径。 这个函数可以将用户自定义的日志系统与 Aubo SDK 默认的日志系统合并。
- Note
- setLogHandler函数要放在即将触发的日志之前, 否则会按照默认的形式输出日志。
- Parameters
-
| handler | 日志处理函数
此日志处理函数的下定义如下:
void handler(int level, const char* filename, int line, const
std::string& message)
level 表示日志等级
0: LOGLEVEL_FATAL 严重的错误
1: LOGLEVEL_ERROR 错误
2: LOGLEVEL_WARNING 警告
3: LOGLEVEL_INFO 通知
4: LOGLEVEL_DEBUG 调试
5: LOGLEVEL_BACKTRACE 跟踪
filename 表示文件名
line 表示代码行号
message 表示日志信息
|
- Returns
- 无
◆ setTopic()
| int agvc_interface::RtdeClient::setTopic |
( |
bool | to_server, |
|
|
const std::vector< std::string > & | names, |
|
|
double | freq, |
|
|
int | expected_chanel ) |
设置话题
- Parameters
-
| to_server | 数据流向。 true 表示客户端给服务器发送消息,false 表示服务器给客户端发送消息 |
| names | 服务器推送的信息列表 |
| freq | 服务器推送信息的频率 |
| expected_chanel | 通道。 取值范围:0~99, 发布不同的话题走不同的通道 |
- Return values
-
| expected_chanel参数的值 | 成功 |
| -1 | 失败 |
◆ subscribe()
| int agvc_interface::RtdeClient::subscribe |
( |
int | chanel, |
|
|
std::function< void(InputParser &)> | callback ) |
订阅 subscribe from output
- Parameters
-
| chanel | 通道 |
| callback | 回调函数,用于处理订阅的输入信息。
回调函数的定义如下: void callback(InputParser &parser) |
- Returns
- 0
◆ impl
| Impl* agvc_interface::RtdeClient::impl |
|
private |
The documentation for this class was generated from the following file: