25 printf(
"start ls01b_node\n");
29 printf(
"end ls01b_node\n");
34 std::string scan_topic =
"/scan";
35 std::string frame_id =
"laser_link";
36 std::string port =
"/dev/ttyUSB0";
89 std::vector<ScanPoint> points;
93 int count = points.size();
97 sensor_msgs::LaserScan msg;
99 msg.header.stamp = start_time;
101 msg.angle_max = 2*M_PI;
102 msg.angle_increment = (msg.angle_max - msg.angle_min) / count;
103 msg.range_min = 0.01;
105 msg.ranges.resize(count);
106 msg.intensities.resize(count);
107 msg.scan_time = scan_time;
108 msg.time_increment = scan_time / (double)(count - 1);
110 for (
int i = count - 1; i >= 0; i--)
120 msg.ranges[i] = std::numeric_limits<float>::infinity();
121 msg.intensities[i] = 0;
123 else if (points[count - i - 1].range == 0.0)
125 msg.ranges[i] = std::numeric_limits<float>::infinity();
126 msg.intensities[i] = 0;
130 msg.ranges[i] = points[count - i - 1].range;
131 msg.intensities[i] = points[count-i-1].intensity;
134 double point_dist = msg.ranges[i];
135 if(point_dist < 1.0 && point_dist > 0.06)
142 msg.ranges[i] = std::numeric_limits<float>::infinity();
153 printf(
"handleSig\n");
158 int main(
int argv,
char **argc)
void publishScan(const ros::TimerEvent &)
double angle_disable_max_3
double angle_disable_min_0
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static LS01B * instance(std::string port, int baud_rate, double resolution)
double angle_disable_min_4
int setMotorSpeed(int rpm)
double angle_disable_min_2
int switchData(bool use_angle)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
double angle_disable_max_2
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
int getScan(std::vector< ScanPoint > &points, ros::Time &scan_time, float &scan_duration)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int setScanMode(bool is_continuous)
double angle_disable_min_3
double angle_disable_max_1
double angle_disable_max_0
int setResolution(double resolution)
int main(int argv, char **argc)
void handleSig(int signo)
double angle_disable_max_4
ROSCPP_DECL void shutdown()
double angle_disable_min_1