28 #include <std_msgs/String.h> 30 #include "../include/thormang3_offset_tuner_client/qnode.hpp" 69 "/robotis/offset_tuner/joint_offset_data", 0);
71 "/robotis/offset_tuner/torque_enable", 0);
75 "/robotis/offset_tuner/get_present_joint_offset_data");
77 std::string _config_path =
ros::package::getPath(
"thormang3_offset_tuner_client") +
"/config/joint_data.yaml";
94 std::cout <<
"Ros shutdown, proceeding to close the gui." << std::endl;
102 log(
Info,
"Joint Torque On/Off");
109 log(
Info,
"Send Joint Offset Data");
116 std::stringstream log_msg;
117 log_msg <<
"Send Command : " << msg.data;
125 thormang3_offset_tuner_msgs::GetPresentJointOffsetData get_present_joint_offset_data;
132 for (
int id = 0;
id < get_present_joint_offset_data.response.present_data_array.size();
id++)
134 thormang3_offset_tuner_msgs::JointOffsetPositionData present_joint_data = get_present_joint_offset_data.response
135 .present_data_array[id];
141 log(
Error,
"Fail to get joint offset data");
149 std::stringstream logging_model_msg;
155 logging_model_msg <<
"[DEBUG] [" <<
ros::Time::now() <<
"]: " << msg;
161 logging_model_msg <<
"[INFO] [" <<
ros::Time::now() <<
"]: " << msg;
167 logging_model_msg <<
"[INFO] [" <<
ros::Time::now() <<
"]: " << msg;
173 logging_model_msg <<
"[ERROR] [" <<
ros::Time::now() <<
"]: " << msg;
179 logging_model_msg <<
"[FATAL] [" <<
ros::Time::now() <<
"]: " << msg;
183 QVariant new_row(QString(logging_model_msg.str().c_str()));
194 doc = YAML::LoadFile(path.c_str());
195 }
catch (
const std::exception& e)
197 ROS_ERROR(
"Fail to load offset config yaml.");
202 YAML::Node right_arm_node = doc[
"right_arm"];
203 for (YAML::iterator yaml_it = right_arm_node.begin(); yaml_it != right_arm_node.end(); ++yaml_it)
206 std::string joint_name;
208 index = yaml_it->first.as<
int>();
209 joint_name = yaml_it->second.as<std::string>();
214 YAML::Node left_arm_node = doc[
"left_arm"];
215 for (YAML::iterator yaml_it = left_arm_node.begin(); yaml_it != left_arm_node.end(); ++yaml_it)
218 std::string joint_name;
220 index = yaml_it->first.as<
int>();
221 joint_name = yaml_it->second.as<std::string>();
226 YAML::Node legs_node = doc[
"legs"];
227 for (YAML::iterator yaml_it = legs_node.begin(); yaml_it != legs_node.end(); ++yaml_it)
230 std::string joint_name;
232 index = yaml_it->first.as<
int>();
233 joint_name = yaml_it->second.as<std::string>();
238 YAML::Node body_node = doc[
"body"];
239 for (YAML::iterator yaml_it = body_node.begin(); yaml_it != body_node.end(); ++yaml_it)
242 std::string joint_name;
244 index = yaml_it->first.as<
int>();
245 joint_name = yaml_it->second.as<std::string>();
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void publish(const boost::shared_ptr< M > &message) const
void getPresentJointOffsetData()
void send_command_msg(std_msgs::String msg)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
QNode(int argc, char **argv)
void log(const LogLevel &level, const std::string &msg)
QStringListModel logging_model_
std::map< int, std::string > right_arm_offset_group
void ParseOffsetGroup(const std::string &path)
#define ROS_FATAL_STREAM(args)
std::map< int, std::string > body_offset_group
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
ROSLIB_DECL std::string getPath(const std::string &package_name)
std::map< int, std::string > left_arm_offset_group
#define ROS_INFO_STREAM(args)
ROSCPP_DECL bool isStarted()
void send_torque_enable_msg(thormang3_offset_tuner_msgs::JointTorqueOnOffArray msg)
ros::ServiceClient get_present_joint_offset_data_client_
ROSCPP_DECL void shutdown()
ros::Publisher torque_enable_pub_
#define ROS_ERROR_STREAM(args)
void send_joint_offset_data_msg(thormang3_offset_tuner_msgs::JointOffsetData msg)
std::map< int, std::string > legs_offset_group
ROSCPP_DECL void spinOnce()
ros::Publisher joint_offset_data_pub_
ROSCPP_DECL void waitForShutdown()
ros::Publisher command_pub_
void update_present_joint_offset_data(thormang3_offset_tuner_msgs::JointOffsetPositionData msg)