3 #include <geometry_msgs/Twist.h> 4 #include <boost/assign/list_of.hpp> 7 #define polling_timeout_ 20 13 const uint8_t LEFT = 0, RIGHT = 1;
18 std::ostringstream ostream;
21 ostream << std::setfill(
'0') << std::uppercase;
22 for (
unsigned int i=0; i < data.
length; i++)
23 ostream << std::hex << std::setw(2) <<
static_cast<unsigned int>(data.
data[i]) <<
" " << std::dec;
25 std_msgs::StringPtr
msg(
new std_msgs::String);
26 msg->data = ostream.str();
27 ROS_INFO(
"reveive command:%s",msg->data.c_str());
33 double acc = (accel_left + accel_right)*0.5;
64 ROS_DEBUG_STREAM(
"Received speed information (speed:" << overallspeed->getTranslational() <<
" Rotational:" << overallspeed->getRotational()<<
" Acceleration:"<<overallspeed->getTransAccel() <<
")");
66 ROS_INFO(
"Received speed information, speed:%.2lf, Rotational:%.2lf, Acceleration:%.2lf",overallspeed->getTranslational(),overallspeed->getRotational(),overallspeed->getTransAccel());
72 int main(
int argc,
char** argv){
77 std::string port =
"/dev/ttyUSB0";
void controloverallSpeed(double lin_vel, double ang_vel, double accel_left, double accel_right)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
roch_driver::RawData getdata()
static Transport & instance()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
void connect(std::string port)
#define ROS_DEBUG_STREAM(args)
ros::Subscriber speedSubscriber_
void speedCallBack(const geometry_msgs::Twist::ConstPtr &speed)
int main(int argc, char **argv)
unsigned char data[MAX_MSG_LENGTH]
#define ROS_ERROR_STREAM(args)
static Ptr requestData(double timeout)