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

RSDK-4861 - C++/cgo support for Odometer #301

Merged
merged 17 commits into from
Dec 8, 2023

Conversation

kkufieta
Copy link
Contributor

@kkufieta kkufieta commented Dec 5, 2023

Ticket: https://viam.atlassian.net/browse/RSDK-4861

Done:

  • Bumped dependencies
  • Added C++/cgo support for Odometer

Tested on Intel Mac:

  • online mode with a lidar
  • offline mode with both lidar & imu replay sensors

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Dec 5, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 6, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 6, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 6, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 6, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 6, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 6, 2023
Comment on lines -831 to -846
// PATRICIA TODO: #242
// non first sensor
{
viam_carto_lidar_reading sr;
// must be they first sensor in the sensor list
sr.lidar = bfromcstr("sensor_2");
std::string pcd = help::binary_pcd(points);
sr.lidar_reading = blk2bstr(pcd.c_str(), pcd.length());
BOOST_TEST(sr.lidar_reading != nullptr);
sr.lidar_reading_time_unix_milli = 1687900014152474;
BOOST_TEST(viam_carto_add_lidar_reading(vc, &sr) ==
VIAM_CARTO_UNKNOWN_SENSOR_NAME);
BOOST_TEST(viam_carto_add_lidar_reading_destroy(&sr) ==
VIAM_CARTO_SUCCESS);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate from the case above.

Comment on lines -1496 to -1502
BOOST_TEST(pr.x == 0);
BOOST_TEST(pr.y == 0);
BOOST_TEST(pr.x != 0);
BOOST_TEST(pr.y != 0);
BOOST_TEST(pr.z == 0);
BOOST_TEST(pr.imag == 0);
BOOST_TEST(pr.jmag == 0);
BOOST_TEST(pr.kmag == 0);
BOOST_TEST(pr.real == 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was something wrong before since those values were supposed to have been non-zero. This might be connected to the fact that the IMU data had the same timestamps as the lidar data. Either way, this is fixed now with this PR.

Copy link
Contributor

@jeremyrhyde jeremyrhyde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great PR. a few minor comments but all logic looks good!

cartofacade/capi.go Show resolved Hide resolved
@@ -15,7 +15,8 @@ import (

var emptyRequestParams = map[RequestParamType]interface{}{}

// ErrUnableToAcquireLock is the error returned from AddLidarReading and/or AddIMUReading when lock can't be acquired.
// ErrUnableToAcquireLock is the error returned from AddLidarReading and/or AddIMUReading
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ErrUnableToAcquireLock is the error returned from AddLidarReading and/or AddIMUReading
// ErrUnableToAcquireLock is the error returned from AddLidarReading, AddIMUReading,

cartofacade/carto_facade_test.go Outdated Show resolved Hide resolved
cartofacade/capi_test.go Show resolved Hide resolved
cartofacade/capi_test.go Outdated Show resolved Hide resolved
viam-cartographer/src/carto_facade/carto_facade_test.cc Outdated Show resolved Hide resolved
viam-cartographer/src/carto_facade/carto_facade_test.cc Outdated Show resolved Hide resolved
viam-cartographer/src/carto_facade/carto_facade_test.cc Outdated Show resolved Hide resolved
viam-cartographer/src/carto_facade/carto_facade_test.cc Outdated Show resolved Hide resolved
defer C.free(unsafe.Pointer(sensorCStr))
sr.odometer = C.blk2bstr(unsafe.Pointer(sensorCStr), C.int(len(movementSensor)))

translation := spatialmath.GeoPointToPose(reading.Position, geo.NewPoint(0, 0)).Point()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this function is in latest anymore. But the logic in GeoPointToPoint is what you want.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 8, 2023
Copy link
Contributor

@jeremyrhyde jeremyrhyde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cartofacade/capi_test.go Show resolved Hide resolved
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 8, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 8, 2023
@kkufieta kkufieta merged commit ad0e0f5 into viam-modules:main Dec 8, 2023
6 checks passed
@kkufieta kkufieta deleted the kk/rsdk-4861-cpp-cgo-2 branch December 8, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants