SICKAG / sick_safetyscanners_base

CPP (C++) Driver for SICK safety laser scanners
https://www.sick.com/de/en/opto-electronic-protective-devices/safety-laser-scanners/c/g187225
Apache License 2.0
14 stars 32 forks source link

how to get point cloud data with nanoScan3 #2

Closed alvin1202 closed 4 years ago

alvin1202 commented 4 years ago

Hi, I followed the sample codes, but failed to get point cloud data, could you please instruct me to get the point cloud with this driver?

my code is: `
// set config sick::types::ip_address_t sensor_ip = boost::asio::ip::address_v4::from_string("192.168.0.49"); uint16_t tcpport = 2122; sick::types::port_t tcp_port = tcpport; sick::datastructure::CommSettings comm_settings { .channel=0, .publishing_frequency = 1, .e_interface_type = 0, .start_angle = 0.0, .end_angle = 0.0, .features = sick::SensorDataFeatures::ALL, .enabled = true, .host_udp_port = 0, .host_ip=boost::asio::ip::address_v4::from_string("192.168.0.50") };

// Define a sensor data callback
sick::types::ScanDataCb cb = [](const sick::datastructure::Data &data) {
    std::cout << "Number of beams: " << data.getMeasurementDataPtr()->getNumberOfBeams() << std::endl;
};

// run scanner
sick::AsyncSickSafetyScanner safety_scanner(sensor_ip, tcp_port, comm_settings, cb);

safety_scanner.run();

safety_scanner.stop();

return 0;

}`

and the result returns: `Hello, World! [INFO]: Command Method Acknowledged.

Process finished with exit code 0`