Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Odor98 opened this issue Sep 9, 2018 · 1 comment

Comments

@Odor98
Copy link

Odor98 commented Sep 9, 2018

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);

  }

}

@Vericoly
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants