ROS-Industrial 之 industrial_robot_client 分析理解(1)

本文深入分析ROS-Industrial的industrial_robot_client库中的实用函数,包括isWithinRange()、mapInsert()、toMap()等,探讨它们在检查变量差异和构建映射中的作用。同时,介绍RobotStatusRelayHandler和JointRelayHandler类,讲解如何将simple message转换为ROS消息并发布到相应话题。
摘要由CSDN通过智能技术生成

从之前industrial_robot_client的概述中,可以理解一些industrial_robot_client要实现的功能,从这里开始,就要正式开始分析并理解industrial_robot_client要实现的功能以及如何进行实现的,为之后的上层应用夯实基础。

UTILS

在utils对应的文件中,定义了5个实用的函数,用来检查变量之间是否在同一范围之内,并且经过前面那么多代码的理解,现在对于这样的文件相信看起来也不会太吃力。那么下面我们看一下不加注释的整个头文件的代码,从头文件中理解这些代码要实现什么样的功能。

#ifndef INDUSTRIAL_ROBOT_CLIENT_UTILS_H_
#define INDUSTRIAL_ROBOT_CLIENT_UTILS_H_
#include <vector>
#include <string>
#include <map>

namespace industrial_robot_client
{
namespace utils
{
    bool isWithinRange(const std::vector<double> & lhs, const std::vector<double> & rhs,double full_range);

    bool mapInsert(const std::string & key, double value, std::map<std::string, double> & mappings);

    bool toMap(const std::vector<std::string> & keys, const std::vector<double> & values,std::map<std::string, double> & mappings);

    bool isWithinRange(const std::vector<std::string> & keys, const std::map<std::string, double> & lhs,const std::map<std::string, double> & rhs, double full_range);

    bool isWithinRange(const std::vector<std::string> & lhs_keys, const std::vector<double> & lhs_values,const std::
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值