phidgetik_ros.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _PHIDGETIKROS_H_
19 #define _PHIDGETIKROS_H_
20 
21 #include <ros/ros.h>
22 #include <cob_phidgets/phidgetik.h>
23 #include <cob_phidgets/SetDataRate.h>
24 #include <cob_phidgets/SetDigitalSensor.h>
25 #include <cob_phidgets/SetTriggerValue.h>
26 #include <cob_phidgets/DigitalSensor.h>
27 #include <cob_phidgets/AnalogSensor.h>
28 
29 #include <thread>
30 #include <mutex>
31 #include <map>
32 
33 class PhidgetIKROS: public PhidgetIK
34 {
35 public:
36  PhidgetIKROS(ros::NodeHandle nh, int serial_num, std::string board_name, XmlRpc::XmlRpcValue* sensor_params, SensingMode mode);
37  ~PhidgetIKROS();
38 
39 private:
47 
49  std::string _board_name;
50 
52  {
53  bool updated;
54  int index;
55  int state;
56  };
57 
59  std::mutex _mutex;
60 
61  std::map<int, std::string> _indexNameMapAnalog;
62  std::map<std::string, int> _indexNameMapAnalogRev;
63  std::map<int, std::string> _indexNameMapDigitalIn;
64  std::map<std::string, int> _indexNameMapDigitalInRev;
65  std::map<int, std::string> _indexNameMapDigitalOut;
66  std::map<std::string, int> _indexNameMapDigitalOutRev;
67  std::map<int, std::string>::iterator _indexNameMapItr;
68  std::map<std::string, int>::iterator _indexNameMapRevItr;
69 
70  auto readParams(XmlRpc::XmlRpcValue* sensor_params) -> void;
71 
72  auto update() -> void;
73 
74  auto attachHandler() -> int;
75  auto detachHandler() -> int;
76 
77  auto inputChangeHandler(int index, int inputState) -> int;
78  auto outputChangeHandler(int index, int outputState) -> int;
79  auto sensorChangeHandler(int index, int sensorValue) -> int;
80 
81  auto onDigitalOutCallback(const cob_phidgets::DigitalSensorConstPtr& msg) -> void;
82  auto setDigitalOutCallback(cob_phidgets::SetDigitalSensor::Request &req,
83  cob_phidgets::SetDigitalSensor::Response &res) -> bool;
84  auto setDataRateCallback(cob_phidgets::SetDataRate::Request &req,
85  cob_phidgets::SetDataRate::Response &res) -> bool;
86  auto setTriggerValueCallback(cob_phidgets::SetTriggerValue::Request &req,
87  cob_phidgets::SetTriggerValue::Response &res) -> bool;
88 };
89 #endif //_PHIDGETIK_H_
auto readParams(XmlRpc::XmlRpcValue *sensor_params) -> void
std::map< int, std::string > _indexNameMapDigitalOut
Definition: phidgetik_ros.h:65
std::map< std::string, int > _indexNameMapAnalogRev
Definition: phidgetik_ros.h:62
auto inputChangeHandler(int index, int inputState) -> int
ros::Subscriber _subDigital
Definition: phidgetik_ros.h:43
ros::NodeHandle _nh
Definition: phidgetik_ros.h:40
auto setDigitalOutCallback(cob_phidgets::SetDigitalSensor::Request &req, cob_phidgets::SetDigitalSensor::Response &res) -> bool
SensingMode
Definition: phidget.h:27
OutputCompare _outputChanged
Definition: phidgetik_ros.h:58
ros::ServiceServer _srvTriggerValue
Definition: phidgetik_ros.h:46
auto update() -> void
ros::Publisher _pubAnalog
Definition: phidgetik_ros.h:41
std::mutex _mutex
Definition: phidgetik_ros.h:59
auto detachHandler() -> int
auto sensorChangeHandler(int index, int sensorValue) -> int
std::map< std::string, int > _indexNameMapDigitalInRev
Definition: phidgetik_ros.h:64
auto setDataRateCallback(cob_phidgets::SetDataRate::Request &req, cob_phidgets::SetDataRate::Response &res) -> bool
std::map< int, std::string >::iterator _indexNameMapItr
Definition: phidgetik_ros.h:67
std::map< std::string, int > _indexNameMapDigitalOutRev
Definition: phidgetik_ros.h:66
auto outputChangeHandler(int index, int outputState) -> int
auto onDigitalOutCallback(const cob_phidgets::DigitalSensorConstPtr &msg) -> void
ros::Publisher _pubDigital
Definition: phidgetik_ros.h:42
ros::ServiceServer _srvDataRate
Definition: phidgetik_ros.h:45
auto attachHandler() -> int
std::map< int, std::string > _indexNameMapDigitalIn
Definition: phidgetik_ros.h:63
ros::ServiceServer _srvDigitalOut
Definition: phidgetik_ros.h:44
auto setTriggerValueCallback(cob_phidgets::SetTriggerValue::Request &req, cob_phidgets::SetTriggerValue::Response &res) -> bool
PhidgetIKROS(ros::NodeHandle nh, int serial_num, std::string board_name, XmlRpc::XmlRpcValue *sensor_params, SensingMode mode)
std::map< int, std::string > _indexNameMapAnalog
Definition: phidgetik_ros.h:61
std::string _board_name
Definition: phidgetik_ros.h:49
std::map< std::string, int >::iterator _indexNameMapRevItr
Definition: phidgetik_ros.h:68


cob_phidgets
Author(s): Florian Weisshardt
autogenerated on Wed Apr 7 2021 02:11:43