#include #include #include #include #include #include "pibot_msgs/avoid.h" #include class UltrasonicNode { public: ros::NodeHandle nh; ros::Publisher ultrasonic_pub; libusb_device_handle *dev_handle; libusb_device **devs; libusb_context *ctx = NULL; int r; ssize_t cnt; float range; // boost::asio::io_service io; // boost::asio::serial_port serial; public: // UltrasonicNode() : nh("~"), serial(io), ultrasonic_pub(nh.advertise("ultrasonic", 1)) { // std::string port_name; // nh.param("port", port_name, "/dev/ttyUSB0"); // serial.open(port_name); // serial.set_option(boost::asio::serial_port_base::baud_rate(9600)); // } UltrasonicNode(); ~UltrasonicNode(); void readUltrasonic(); };