35 #include <sensor_msgs/JointState.h> 37 #include <std_msgs/Bool.h> 111 ros::param::param<bool>(
"~limits_enabled", limit,
true);
132 ROS_INFO_STREAM(
"FLIR PTU serial port opened, now initializing.");
146 ROS_INFO(
"FLIR PTU limits disabled.");
165 <sensor_msgs::JointState>(
"state", 1);
198 if (msg->position.size() != 2)
200 ROS_ERROR(
"JointState command to PTU has wrong number of position elements.");
204 double pan = msg->position[0];
205 double tilt = msg->position[1];
206 double panspeed, tiltspeed;
208 if (msg->velocity.size() == 2)
210 panspeed = msg->velocity[0];
211 tiltspeed = msg->velocity[1];
215 ROS_WARN_ONCE(
"JointState command to PTU has wrong number of velocity elements; using default velocity.");
228 stat.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"All normal.");
249 sensor_msgs::JointState joint_state;
251 joint_state.name.resize(2);
252 joint_state.position.resize(2);
253 joint_state.velocity.resize(2);
255 joint_state.position[0] = pan;
256 joint_state.velocity[0] = panspeed;
258 joint_state.position[1] = tilt;
259 joint_state.velocity[1] = tiltspeed;
267 int main(
int argc,
char** argv)
289 ROS_ERROR(
"FLIR PTU disconnected, attempting reconnection.");
void produce_diagnostics(diagnostic_updater::DiagnosticStatusWrapper &stat)
void resetCallback(const std_msgs::Bool::ConstPtr &msg)
float getPosition(char type)
bool setPosition(char type, float pos, bool Block=false)
void publish(const boost::shared_ptr< M > &message) const
diagnostic_updater::Updater * m_updater
void summary(unsigned char lvl, const std::string s)
ros::Subscriber m_reset_sub
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void setHardwareID(const std::string &hwid)
void setTimeout(Timeout &timeout)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void setBaudrate(uint32_t baudrate)
float getMaxSpeed(char type)
void add(const std::string &name, TaskFunction f)
float getResolution(char type)
ROSCPP_DECL void spin(Spinner &spinner)
void cmdCallback(const sensor_msgs::JointState::ConstPtr &msg)
float getMinSpeed(char type)
std::string m_joint_name_prefix
ros::Subscriber m_joint_sub
#define ROS_WARN_ONCE(...)
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
ros::Publisher m_joint_pub
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
Node(ros::NodeHandle &node_handle)
void spinCallback(const ros::TimerEvent &)
void setPort(const std::string &port)
#define ROS_INFO_STREAM(args)
float getSpeed(char type)
int main(int argc, char **argv)
void add(const std::string &key, const T &val)
#define ROS_ERROR_STREAM(args)
bool setSpeed(char type, float speed)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const