Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef JOINT_RELAY_HANDLER_H
00034 #define JOINT_RELAY_HANDLER_H
00035
00036 #include <string>
00037 #include <vector>
00038
00039 #include "ros/ros.h"
00040 #include "control_msgs/FollowJointTrajectoryFeedback.h"
00041 #include "sensor_msgs/JointState.h"
00042 #include "simple_message/message_handler.h"
00043 #include "simple_message/messages/joint_message.h"
00044 #include "trajectory_msgs/JointTrajectoryPoint.h"
00045
00046 namespace industrial_robot_client
00047 {
00048 namespace joint_relay_handler
00049 {
00050
00051 using industrial::joint_message::JointMessage;
00052 using industrial::simple_message::SimpleMessage;
00053 using trajectory_msgs::JointTrajectoryPoint;
00054
00062 class JointRelayHandler : public industrial::message_handler::MessageHandler
00063 {
00064
00065 public:
00066
00070 JointRelayHandler() {};
00071
00072
00083 virtual bool init(industrial::smpl_msg_connection::SmplMsgConnection* connection, std::vector<std::string> &joint_names)
00084 {
00085 return init(connection, (int)industrial::simple_message::StandardMsgTypes::JOINT, joint_names);
00086 }
00087
00088 protected:
00089
00090 std::vector<std::string> all_joint_names_;
00091
00092 ros::Publisher pub_joint_control_state_;
00093 ros::Publisher pub_joint_sensor_state_;
00094 ros::NodeHandle node_;
00095
00107 virtual bool init(industrial::smpl_msg_connection::SmplMsgConnection* connection,
00108 int msg_type, std::vector<std::string> &joint_names);
00109
00110
00120 virtual bool create_messages(SimpleMessage& msg_in,
00121 control_msgs::FollowJointTrajectoryFeedback* control_state,
00122 sensor_msgs::JointState* sensor_state);
00123
00130 virtual bool convert_message(SimpleMessage& msg_in, JointTrajectoryPoint* joint_state);
00131
00141 virtual bool transform(const JointTrajectoryPoint& state_in, JointTrajectoryPoint* state_out)
00142 {
00143 *state_out = state_in;
00144 return true;
00145 }
00146
00157 virtual bool select(const JointTrajectoryPoint& all_joint_state, const std::vector<std::string>& all_joint_names,
00158 JointTrajectoryPoint* pub_joint_state, std::vector<std::string>* pub_joint_names);
00159
00167 bool internalCB(SimpleMessage& in);
00168
00169 private:
00176 bool convert_message(JointMessage& msg_in, JointTrajectoryPoint* joint_state);
00177
00178 };
00179
00180 }
00181 }
00182
00183
00184 #endif