analog_outputs_ros_i.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Open Source Robotics Foundation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef PHIDGETS_ANALOG_OUTPUTS_ANALOG_OUTPUTS_ROS_I_H
31 #define PHIDGETS_ANALOG_OUTPUTS_ANALOG_OUTPUTS_ROS_I_H
32 
33 #include <memory>
34 #include <string>
35 #include <vector>
36 
37 #include <ros/ros.h>
38 #include <std_msgs/Float64.h>
39 
41 #include "phidgets_msgs/SetAnalogOutput.h"
42 
43 namespace phidgets {
44 
45 class AnalogOutputSetter final
46 {
47  public:
48  explicit AnalogOutputSetter(AnalogOutputs* aos, int index,
49  ros::NodeHandle nh,
50  const std::string& topicname);
51 
52  private:
53  void setMsgCallback(const std_msgs::Float64::ConstPtr& msg);
56  int index_;
57 };
58 
59 class AnalogOutputsRosI final
60 {
61  public:
62  explicit AnalogOutputsRosI(ros::NodeHandle nh, ros::NodeHandle nh_private);
63 
64  private:
65  std::unique_ptr<AnalogOutputs> aos_;
66  std::vector<std::unique_ptr<AnalogOutputSetter>> out_subs_;
67 
71  std::string server_name_;
72  std::string server_ip_;
73 
74  bool setSrvCallback(phidgets_msgs::SetAnalogOutput::Request& req,
75  phidgets_msgs::SetAnalogOutput::Response& res);
76 };
77 
78 } // namespace phidgets
79 
80 #endif // PHIDGETS_ANALOG_OUTPUTS_ANALOG_OUTPUTS_ROS_I_H
phidgets
phidgets::AnalogOutputSetter::AnalogOutputSetter
AnalogOutputSetter(AnalogOutputs *aos, int index, ros::NodeHandle nh, const std::string &topicname)
Definition: analog_outputs_ros_i.cpp:110
phidgets::AnalogOutputSetter::setMsgCallback
void setMsgCallback(const std_msgs::Float64::ConstPtr &msg)
Definition: analog_outputs_ros_i.cpp:119
phidgets::AnalogOutputsRosI::out_subs_
std::vector< std::unique_ptr< AnalogOutputSetter > > out_subs_
Definition: analog_outputs_ros_i.h:66
phidgets::AnalogOutputsRosI::server_ip_
std::string server_ip_
Definition: analog_outputs_ros_i.h:72
ros.h
phidgets::AnalogOutputsRosI::aos_
std::unique_ptr< AnalogOutputs > aos_
Definition: analog_outputs_ros_i.h:65
phidgets::AnalogOutputsRosI::nh_
ros::NodeHandle nh_
Definition: analog_outputs_ros_i.h:68
phidgets::AnalogOutputSetter
Definition: analog_outputs_ros_i.h:45
ros::ServiceServer
phidgets::AnalogOutputsRosI::AnalogOutputsRosI
AnalogOutputsRosI(ros::NodeHandle nh, ros::NodeHandle nh_private)
Definition: analog_outputs_ros_i.cpp:41
phidgets::AnalogOutputSetter::subscription_
ros::Subscriber subscription_
Definition: analog_outputs_ros_i.h:54
phidgets::AnalogOutputSetter::aos_
AnalogOutputs * aos_
Definition: analog_outputs_ros_i.h:55
phidgets::AnalogOutputs
phidgets::AnalogOutputSetter::index_
int index_
Definition: analog_outputs_ros_i.h:56
phidgets::AnalogOutputsRosI::nh_private_
ros::NodeHandle nh_private_
Definition: analog_outputs_ros_i.h:69
phidgets::AnalogOutputsRosI
Definition: analog_outputs_ros_i.h:59
phidgets::AnalogOutputsRosI::setSrvCallback
bool setSrvCallback(phidgets_msgs::SetAnalogOutput::Request &req, phidgets_msgs::SetAnalogOutput::Response &res)
Definition: analog_outputs_ros_i.cpp:101
phidgets::AnalogOutputsRosI::out_srv_
ros::ServiceServer out_srv_
Definition: analog_outputs_ros_i.h:70
analog_outputs.h
phidgets::AnalogOutputsRosI::server_name_
std::string server_name_
Definition: analog_outputs_ros_i.h:71
ros::NodeHandle
ros::Subscriber


phidgets_analog_outputs
Author(s): Carsten Plasberg
autogenerated on Sat Dec 2 2023 03:18:53