34 #include <boost/algorithm/string.hpp> 65 std::string searched_param;
68 std::string full_topic = prefix +
"sendupdate";
73 full_topic = prefix +
"contrlr";
77 full_topic = prefix +
"config";
85 "sh_" + boost::to_lower_copy(joint->first +
"_position_controller/command"), 2,
96 int sendupdate_length = msg->sendupdate_length;
97 if (sendupdate_length == 0)
99 ROS_DEBUG(
"Received empty sendupdate command.");
103 for (uint16_t index_msg = 0; index_msg < msg->sendupdate_length; ++index_msg)
105 float target = msg->sendupdate_list[index_msg].joint_target;
106 string sensor_name = msg->sendupdate_list[index_msg].joint_name;
108 ROS_DEBUG(
"Received sendupdate Command [%s : %f]", sensor_name.c_str(), target);
121 vector<string> list_of_parameters = msg->list_of_parameters;
126 for (
unsigned int index_param = 0; index_param < msg->length_of_list; ++index_param)
129 vector<string> splitted_string;
130 boost::split(splitted_string, msg->list_of_parameters[index_param], boost::is_any_of(
":"));
133 param.
name = splitted_string[0];
134 param.
value = splitted_string[1];
136 ctrl_data.
data.push_back(param);
144 ROS_ERROR(
"Configuration command callback not implemented yet");
std::string name
name of the parameter
void contrlrCallback(const sr_robot_msgs::contrlrConstPtr &msg)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
boost::shared_ptr< SRArticulatedRobot > sr_articulated_robot
The shadowhand / shadowarm object (can be either an object connected to the real robot or a virtual h...
Subscriber config_sub
The subscriber to the config topic.
void configCallback(const sr_robot_msgs::configConstPtr &msg)
static double to_degrees(double rad)
~SRSubscriber()
Destructor.
void sendupdateCallback(const sr_robot_msgs::sendupdateConstPtr &msg)
std::vector< Subscriber > controllers_sub
The vector of subscribers to the different joint topics.
Subscriber sendupdate_sub
The subscriber to the sendupdate topic.
void cmd_callback(const std_msgs::Float64ConstPtr &msg, std::string &joint_name)
bool searchParam(const std::string &key, std::string &result) const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Subscriber contrlr_sub
The subscriber to the contrlr topic.
std::string value
value of the parameter
std::vector< Parameters > data
NodeHandle node
ros node handle
SRSubscriber(boost::shared_ptr< SRArticulatedRobot > sr_art_robot)
This ROS subscriber is used to issue commands to the hand / arm, from sending a set of targets...