4 #include <boost/assign/list_of.hpp> 6 #define polling_timeout_ 20 11 std::ostringstream ostream;
14 ostream <<
"command: { " ;
15 ostream << std::setfill(
'0') << std::uppercase;
16 for (
unsigned int i=0; i < data.
length; i++)
17 ostream << std::hex << std::setw(2) <<
static_cast<unsigned int>(data.
data[i]) <<
" " << std::dec;
19 std_msgs::StringPtr
msg(
new std_msgs::String);
20 msg->data = ostream.str();
21 ROS_INFO(
"reveive command:%s",msg->data.c_str());
27 const uint8_t LEFT = 0, RIGHT = 1;
29 int main(
int argc,
char** argv){
31 std::string port =
"/dev/roch";
39 ROS_INFO(
"Received rangefinder Data, counts:%d, data[0]:%.2lf , data[1]:%.2lf, data[2]:%.2lf , data[3]:%.2lf, data[4]:%.2lf, data[5]:%.2lf, data[6]:%.2lf, data[7]:%.2lf.",
40 (
int)rangefinderData->getRangefinderCount(),rangefinderData->getDistance(0),
41 rangefinderData->getDistance(1),
42 rangefinderData->getDistance(2),
43 rangefinderData->getDistance(3),
44 rangefinderData->getDistance(4),
45 rangefinderData->getDistance(5),
46 rangefinderData->getDistance(6),
47 rangefinderData->getDistance(7));
54 if(rangefinderDataAndTime){
55 ROS_INFO(
"Received rangefinder Data and time, counts:%d, data[0]:%.2lf, time[0]:%d, " 56 " data[1]:%.2lf, time[1]:%d, " 57 " data[2]:%.2lf, time[2]:%d, " 58 " data[3]:%.2lf, time[3]:%d, " 59 " data[4]:%.2lf, time[4]:%d, " 60 " data[5]:%.2lf, time[5]:%d, " 61 " data[6]:%.2lf, time[6]:%d, " 62 " data[7]:%.2lf, time[7]:%d. ",
63 (
int)rangefinderDataAndTime->getRangefinderCount(),rangefinderDataAndTime->getDistance(0),rangefinderDataAndTime->getAcquisitionTime(0),
64 rangefinderDataAndTime->getDistance(1),rangefinderDataAndTime->getAcquisitionTime(1),
65 rangefinderDataAndTime->getDistance(2),rangefinderDataAndTime->getAcquisitionTime(2),
66 rangefinderDataAndTime->getDistance(3),rangefinderDataAndTime->getAcquisitionTime(3),
67 rangefinderDataAndTime->getDistance(4),rangefinderDataAndTime->getAcquisitionTime(4),
68 rangefinderDataAndTime->getDistance(5),rangefinderDataAndTime->getAcquisitionTime(5),
69 rangefinderDataAndTime->getDistance(6),rangefinderDataAndTime->getAcquisitionTime(6),
70 rangefinderDataAndTime->getDistance(7),rangefinderDataAndTime->getAcquisitionTime(7));
roch_driver::RawData getdata()
static Transport & instance()
void connect(std::string port)
unsigned char data[MAX_MSG_LENGTH]
static Ptr requestData(double timeout)
int main(int argc, char **argv)