Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dniewinski committed Nov 29, 2017
1 parent cb81bb0 commit fdc3d48
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/LMS1xx_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <LMS1xx/LMS1xx.h>
#include "ros/ros.h"
#include "sensor_msgs/LaserScan.h"
#include <limits>
#include <string>

#define DEG2RAD M_PI/180.0

Expand Down Expand Up @@ -89,15 +91,15 @@ int main(int argc, char **argv)
scan_msg.range_min = 0.01;
scan_msg.range_max = 20.0;
scan_msg.scan_time = 100.0 / cfg.scaningFrequency;
scan_msg.angle_increment = (double)outputRange.angleResolution / 10000.0 * DEG2RAD;
scan_msg.angle_min = (double)outputRange.startAngle / 10000.0 * DEG2RAD - M_PI / 2;
scan_msg.angle_max = (double)outputRange.stopAngle / 10000.0 * DEG2RAD - M_PI / 2;
scan_msg.angle_increment = static_cast<double>(outputRange.angleResolution / 10000.0 * DEG2RAD);
scan_msg.angle_min = static_cast<double>(outputRange.startAngle / 10000.0 * DEG2RAD - M_PI / 2);
scan_msg.angle_max = static_cast<double>(outputRange.stopAngle / 10000.0 * DEG2RAD - M_PI / 2);

ROS_DEBUG_STREAM("Device resolution is " << (double)outputRange.angleResolution / 10000.0 << " degrees.");
ROS_DEBUG_STREAM("Device frequency is " << (double)cfg.scaningFrequency / 100.0 << " Hz");

int angle_range = outputRange.stopAngle - outputRange.startAngle;
int num_values = angle_range / outputRange.angleResolution ;
int num_values = angle_range / outputRange.angleResolution;
if (angle_range % outputRange.angleResolution == 0)
{
// Include endpoint
Expand Down Expand Up @@ -130,8 +132,8 @@ int main(int argc, char **argv)
ROS_DEBUG("Waiting for ready status.");
ros::Time ready_status_timeout = ros::Time::now() + ros::Duration(5);

//while(1)
//{
// while(1)
// {
status_t stat = laser.queryStatus();
ros::Duration(1.0).sleep();
if (stat != ready_for_measurement)
Expand Down Expand Up @@ -162,7 +164,7 @@ int main(int argc, char **argv)
}*/

ROS_DEBUG("Starting device.");
laser.startDevice(); // Log out to properly re-enable system after config
laser.startDevice(); // Log out to properly re-enable system after config

ROS_DEBUG("Commanding continuous measurements.");
laser.scanContinous(1);
Expand All @@ -182,10 +184,12 @@ int main(int argc, char **argv)
{
float range_data = data.dist1[i] * 0.001;

if(inf_range && range_data < scan_msg.range_min){
if (inf_range && range_data < scan_msg.range_min)
{
scan_msg.ranges[i] = std::numeric_limits<float>::infinity();
}
else{
else
{
scan_msg.ranges[i] = range_data;
}
}
Expand Down

0 comments on commit fdc3d48

Please sign in to comment.