18 : counter_(0), period_(period),
19 use_joint7_(false), use_joint8_(false),
20 joint7_is_linear_(false), joint8_is_linear_(false)
23 socket_ = socket (AF_INET, SOCK_DGRAM, 0);
30 ros::param::param<std::string>(
"~robot_ip",
robot_ip_,
"127.0.0.1");
32 ros::param::param<bool>(
"~use_joint7",
use_joint7_,
false);
33 ros::param::param<bool>(
"~use_joint8",
use_joint8_,
false);
37 addr_.sin_family = AF_INET;
38 addr_.sin_port = htons (10000);
39 addr_.sin_addr.s_addr = inet_addr (robot_ip_.c_str());
46 "joint1",
"joint2",
"joint3",
"joint4",
47 "joint5",
"joint6",
"joint7",
"joint8" 53 if (i==6 and not use_joint7_)
57 if (i==7 and not use_joint8_)
70 if (i==6 and not use_joint7_)
74 if (i==7 and not use_joint8_)
101 ROS_ERROR (
"Connot send packet to MELFA controller. Check the configuration.");
151 ROS_ERROR (
"Connot send packet to MELFA controller. Check the configuration.");
171 time.tv_usec = 2 *
period_ * 1000000;
173 int status = select (
socket_+1, &fds, (fd_set *) NULL, (fd_set *) NULL, &time);
178 if ((status > 0) && FD_ISSET (
socket_, &fds))
197 pos[6] = joint->
j7 / 1000.0;
207 pos[7] = joint->
j8 / 1000.0;
225 ROS_WARN (
"Failed to receive packet.");
237 stat.
summary(diagnostic_msgs::DiagnosticStatus::WARN,
238 "Periodic time exceeds 120%");
242 stat.
summary(diagnostic_msgs::DiagnosticStatus::OK,
243 "Periodic time is normal");
245 stat.
add (
"Period", diff);
void registerInterface(T *iface)
hardware_interface::PositionJointInterface joint_pos_interface
void summary(unsigned char lvl, const std::string s)
void diagnose(diagnostic_updater::DiagnosticStatusWrapper &stat)
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
union enet_rtcmd_str::rtdata dat
void registerHandle(const JointStateHandle &handle)
JointStateHandle getHandle(const std::string &name)
void add(const std::string &key, const T &val)
hardware_interface::JointStateInterface joint_state_interface