rplidar_arduino icon indicating copy to clipboard operation
rplidar_arduino copied to clipboard

arduino doesn't work like that "roslaunch rplidar_ros rplidarNodeClient"?

Open Odor98 opened this issue 6 years ago • 1 comments

i following robopeak example "simple_connent" but that protocol send measuring samples very little ⸮P⸮%⸮ angle : 40.36, distance : 217.50 angle : 34.48, distance : 227.25 angle : 36.42, distance : 222.75 angle : 37.09, distance : 221.50 angle : 37.77, distance : 221.00 angle : 38.42, distance : 220.00 angle : 39.09, distance : 219.50 angle : 40.02, distance : 0.00 angle : 40.44, distance : 208.00 angle : 40.06, distance : 218.50 angle : 41.77, distance : 217.75 angle : 42.41, distance : 217.25 angle : 41.97, distance : 4687.50 ⸮P⸮%⸮ angle : 287.13, distance : 392.00 angle : 272.73, distance : 431.00 angle : 273.47, distance : 427.75 angle : 278.63, distance : 0.00 angle : 279.36, distance : 0.00 angle : 280.02, distance : 0.00 angle : 276.97, distance : 370.25 angle : 277.13, distance : 370.50 angle : 278.25, distance : 370.50 angle : 278.73, distance : 370.00 angle : 279.67, distance : 349.00 angle : 279.94, distance : 347.50 angle : 281.02, distance : 5306.25 ⸮P⸮%⸮

how to recieve samples like roslaunch rplidar_ros rplidarNodeClient?

my code ::

#include <RPLidar.h>

RPLidar lidar;

#define RPLIDAR_MOTOR 3 void setup() { lidar.begin(Serial); pinMode(RPLIDAR_MOTOR, OUTPUT);

} void Count() { time += 0.1; }

int a=0; void loop() { while(IS_OK(lidar.waitPoint())) { //perform data processing here...

float distance = lidar.getCurrentPoint().distance; float angle = lidar.getCurrentPoint().angle;

      Serial.print("angle : ");
      Serial.print(angle);
      Serial.print(", distance : ");
      Serial.println(distance);

}

rplidar_response_device_info_t info; if (IS_OK(lidar.getDeviceInfo(info, 100)) && !IS_OK(lidar.waitPoint())) {

   //detected...
   lidar.startScan();
   
   analogWrite(RPLIDAR_MOTOR, 255);
   delay(500);

  }

}

Odor98 avatar Sep 09 '18 04:09 Odor98

I have been facing the same issue.I am using RPLidar A1M8 and the same simple connect example.Is this an issue with the library?

Vericoly avatar Mar 12 '20 17:03 Vericoly