robot_state_interface.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Southwest Research Institute
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of the Southwest Research Institute, nor the names
16  * of its contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef MOTOMAN_DRIVER_INDUSTRIAL_ROBOT_CLIENT_ROBOT_STATE_INTERFACE_H
33 #define MOTOMAN_DRIVER_INDUSTRIAL_ROBOT_CLIENT_ROBOT_STATE_INTERFACE_H
34 
35 #include <vector>
36 #include <string>
37 #include <map>
47 
49 {
50 namespace robot_state_interface
51 {
52 
62 
70 // * RobotStateInterface
71 
72 class RobotStateInterface
73 {
74 public:
89  bool init(std::string default_ip = "", int default_port = StandardSocketPorts::STATE, bool legacy_mode = false);
90 
98  bool init(SmplMsgConnection* connection);
99 
110  bool init(SmplMsgConnection* connection, std::vector<std::string>& joint_names);
111 
122  bool init(SmplMsgConnection* connection, std::map<int, RobotGroup> robot_groups);
123 
127  void run();
128 
134  SmplMsgConnection* get_connection()
135  {
136  return this->connection_;
137  }
138 
144  MessageManager* get_manager()
145  {
146  return &this->manager_;
147  }
148 
149  std::vector<std::string> get_joint_names()
150  {
151  return this->joint_names_;
152  }
153 
154  std::map<int, RobotGroup> get_robot_groups()
155  {
156  return this->robot_groups_;
157  }
158 
165  void add_handler(MessageHandler* handler, bool allow_replace = true)
166  {
167  this->manager_.add(handler, allow_replace);
168  }
169 
170 protected:
171  TcpClient default_tcp_connection_;
172  JointRelayHandler default_joint_handler_;
173  JointFeedbackRelayHandler default_joint_feedback_handler_;
174  JointFeedbackExRelayHandler default_joint_feedback_ex_handler_;
175  RobotStatusRelayHandler default_robot_status_handler_;
176 
177  SmplMsgConnection* connection_;
178  MessageManager manager_;
179  std::vector<std::string> joint_names_;
180 
181  std::map<int, RobotGroup> robot_groups_;
182 
183  bool version_0_;
184 }; // class RobotStateInterface
185 
186 } // namespace robot_state_interface
187 } // namespace industrial_robot_client
188 
189 
190 #endif // MOTOMAN_DRIVER_INDUSTRIAL_ROBOT_CLIENT_ROBOT_STATE_INTERFACE_H
Message handler that relays joint positions (converts simple message types to ROS message types and p...
bool init(std::string default_ip="", int default_port=StandardSocketPorts::STATE)
bool add(industrial::message_handler::MessageHandler *handler, bool allow_replace=false)
void add_handler(MessageHandler *handler, bool allow_replace=true)
Message handler that relays joint positions (converts simple message types to ROS message types and p...
Message handler that relays joint positions (converts simple message types to ROS message types and p...


motoman_driver
Author(s): Jeremy Zoss (Southwest Research Institute), Ted Miller (MotoROS) (Yaskawa Motoman), Eric Marcil (MotoROS) (Yaskawa Motoman)
autogenerated on Sat May 8 2021 02:27:44