Skip to content

Commit

Permalink
added bool client
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHumais committed Jul 28, 2022
1 parent a5c43b2 commit c308c38
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/HEAR_ROS/ROSUnit_BoolClnt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef ROSUNIT_BOOLCLNT
#define ROSUNIT_BOOLCLNT

#include <ros/ros.h>
#include <std_srvs/SetBool.h>

namespace HEAR{

class ROSUnitBoolClient {
private:
ros::ServiceClient m_client;
public:
ROSUnitBoolClient(ros::NodeHandle&, std::string);
bool process(bool data);
};

}

#endif
15 changes: 15 additions & 0 deletions src/ROSUnit_BoolClnt.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "HEAR_ROS/ROSUnit_BoolClnt.hpp"

namespace HEAR{

ROSUnitBoolClient::ROSUnitBoolClient(ros::NodeHandle &nh, std::string t_name){
m_client = nh.serviceClient<std_srvs::SetBool>(t_name);
}

bool ROSUnitBoolClient::process(bool data){
std_srvs::SetBool msg;
msg.request.data = data;
return m_client.call(msg);
}

}

0 comments on commit c308c38

Please sign in to comment.