test_rangefinder.cpp
Go to the documentation of this file.
1 #include <ros/ros.h>
3 
4 #include <boost/assign/list_of.hpp>
5 #include <float.h>
6 #define polling_timeout_ 20
7 using namespace std;
9 {
10  #if 0
11  std::ostringstream ostream;
13 
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;
18  ostream << "}";
19  std_msgs::StringPtr msg(new std_msgs::String);
20  msg->data = ostream.str();
21  ROS_INFO("reveive command:%s",msg->data.c_str());
22 #endif
23 }
24 
25 namespace
26 {
27  const uint8_t LEFT = 0, RIGHT = 1;
28 };
29 int main(int argc, char** argv){
30 
31  std::string port = "/dev/roch";
32  core::connect(port);
33  while(1){
34  // ROS_INFO("begin send requestData");
38  if(rangefinderData){
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));
48  }
49  #if 0
53 
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));
71  }
72 #endif
73  }
74  return 0;
75 }
msg
roch_driver::RawData getdata()
Definition: Transport.h:103
static Transport & instance()
Definition: Transport.cpp:129
data
#define ROS_INFO(...)
void publishRawData()
void connect(std::string port)
#define polling_timeout_
unsigned char data[MAX_MSG_LENGTH]
Definition: serial.h:62
static Ptr requestData(double timeout)
Definition: core_wrapper.h:98
int main(int argc, char **argv)


roch_base
Author(s): Mike Purvis , Paul Bovbel , Chen
autogenerated on Mon Jun 10 2019 14:41:14