Skip to content

Commit

Permalink
Update sdk.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Allen committed Jul 7, 2018
1 parent f6c55cf commit 7066b0c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/driver_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ void DriverNodelet::onInit() {
// Initialize sdk
cepton_sdk::SensorErrorCode error_code;

const int ver = 11;
auto options = cepton_sdk::create_options();
options.control_flags = control_flags;
options.frame.mode = CEPTON_SDK_FRAME_CYCLE;
error_code = cepton_sdk::initialize(ver, options, global_on_error, this);
error_code = cepton_sdk::initialize(13, options, global_on_error, this);
if (error_code) {
NODELET_FATAL("cepton_sdk::initialize failed: %s",
cepton_sdk::get_error_code_name(error_code));
Expand Down
Binary file added tests/multi/lidar.pcap.cep0
Binary file not shown.
12 changes: 6 additions & 6 deletions third_party/cepton_sdk/include/cepton_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {

#include "cepton_export.h"

#define CEPTON_SDK_VERSION 11
#define CEPTON_SDK_VERSION 13

//------------------------------------------------------------------------------
// Errors
Expand Down Expand Up @@ -87,7 +87,7 @@ struct EXPORT CeptonSensorInformation {
float last_reported_age; ///< [hours]
float padding;

uint64_t ptp_ts;
int64_t ptp_ts;

uint8_t gps_ts_year; ///< 0-99 (2017 -> 17)
uint8_t gps_ts_month; ///< 1-12
Expand All @@ -113,14 +113,14 @@ EXPORT extern const size_t cepton_sensor_information_size;
* To convert to 3d point, refer to `cepton_sdk_util.hpp`.
*/
struct EXPORT CeptonSensorImagePoint {
uint64_t timestamp; ///< unix time [microseconds]
int64_t timestamp; ///< unix time [microseconds]
float image_x; ///< x image coordinate
float distance; ///< distance [meters]
float image_z; ///< z image coordinate
float intensity; ///< 0-1 scaled intensity
uint8_t return_number; ///< 0=first return, 1=second return
uint8_t valid; ///< 1=valid; 0=clipped/invalid
uint8_t saturated; ///< If satruated, intensity cannot be trusted
uint8_t saturated; ///< If saturated, intensity cannot be trusted
uint8_t reserved;
};
EXPORT extern const size_t cepton_sensor_image_point_size;
Expand Down Expand Up @@ -255,7 +255,7 @@ EXPORT CeptonSensorErrorCode cepton_sdk_listen_network_packet(
FpCeptonNetworkReceiveCallback cb, void *const user_data);
EXPORT CeptonSensorErrorCode cepton_sdk_unlisten_network_packet();

EXPORT CeptonSensorErrorCode cepton_sdk_set_mock_time_base(uint64_t time_base);
EXPORT CeptonSensorErrorCode cepton_sdk_set_mock_time_base(int64_t time_base);

EXPORT CeptonSensorErrorCode cepton_sdk_mock_network_receive(
CeptonSensorHandle handle, const uint8_t *const buffer, size_t buffer_size);
Expand All @@ -268,7 +268,7 @@ EXPORT CeptonSensorErrorCode
cepton_sdk_capture_replay_open(const char *const path);
EXPORT CeptonSensorErrorCode cepton_sdk_capture_replay_close();

EXPORT uint64_t cepton_sdk_capture_replay_get_start_time();
EXPORT int64_t cepton_sdk_capture_replay_get_start_time();
EXPORT float cepton_sdk_capture_replay_get_position();
EXPORT float cepton_sdk_capture_replay_get_length();
EXPORT int cepton_sdk_capture_replay_is_end();
Expand Down
9 changes: 5 additions & 4 deletions third_party/cepton_sdk/include/cepton_sdk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ static bool is_initialized() { return (bool)cepton_sdk_is_initialized(); }
/**
* Must be called before any other sdk function listed below.
*/
static SensorErrorCode initialize(int ver, const Options &options,
const FpSensorErrorCallback &cb,
void *const user_data) {
return cepton_sdk_initialize(ver, &options, cb, user_data);
static SensorErrorCode initialize(int version,
const Options &options = create_options(),
const FpSensorErrorCallback &cb = nullptr,
void *const user_data = nullptr) {
return cepton_sdk_initialize(version, &options, cb, user_data);
}

/// Resets everything and deallocates memory.
Expand Down
8 changes: 4 additions & 4 deletions third_party/cepton_sdk/include/cepton_sdk_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static uint64_t get_time() {

/// Sleeps or resumes capture replay for duration.
static SensorErrorCode wait(float t_length = 0.1f) {
if (is_live()) {
if (is_live() || capture_replay::is_running()) {
std::this_thread::sleep_for(
std::chrono::milliseconds((int)(1e3f * t_length)));
return CEPTON_SUCCESS;
Expand Down Expand Up @@ -77,7 +77,7 @@ static void check_error_code(SensorErrorCode error_code,
/**
* Calls `cepton_sdk::api::check_error_code`.
*/
static void default_on_error(SensorHandle h, int error_code,
static void default_on_error(SensorHandle h, SensorErrorCode error_code,
const char *const error_msg,
const void *const error_data,
std::size_t error_data_size,
Expand All @@ -94,8 +94,8 @@ inline static SensorErrorCode initialize(Options options = create_options(),
// Initialize
if (!capture_path.empty())
options.control_flags |= CEPTON_SDK_CONTROL_DISABLE_NETWORK;
auto error_code = ::cepton_sdk::initialize(CEPTON_SDK_VERSION, options,
default_on_error, nullptr);
auto error_code =
::cepton_sdk::initialize(CEPTON_SDK_VERSION, options, default_on_error);
if (error_code) return error_code;

// Open capture replay
Expand Down
Binary file modified third_party/cepton_sdk/lib/linux-aarch64/libcepton_sdk.a
Binary file not shown.
Binary file modified third_party/cepton_sdk/lib/linux-aarch64/libcepton_sdk.so
Binary file not shown.
Binary file modified third_party/cepton_sdk/lib/linux-x86_64/libcepton_sdk.a
Binary file not shown.
Binary file modified third_party/cepton_sdk/lib/linux-x86_64/libcepton_sdk.so
Binary file not shown.

0 comments on commit 7066b0c

Please sign in to comment.