mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
IMU: changed members from Eigen to cv to avoid seg faults about Eigen memory alignment when copying IMU object created dynamically (#270)
This commit is contained in:
@@ -19,11 +19,11 @@ class IMU
|
||||
{
|
||||
public:
|
||||
IMU() {}
|
||||
IMU(const Eigen::Quaterniond & orientation,
|
||||
IMU(const cv::Vec4d & orientation,
|
||||
const cv::Mat & orientationCovariance,
|
||||
const Eigen::Vector3d & angularVelocity,
|
||||
const cv::Vec3d & angularVelocity,
|
||||
const cv::Mat & angularVelocityCovariance,
|
||||
const Eigen::Vector3d & linearAcceleration,
|
||||
const cv::Vec3d & linearAcceleration,
|
||||
const cv::Mat & linearAccelerationCovariance,
|
||||
const Transform & localTransform = Transform::getIdentity()) :
|
||||
orientation_(orientation),
|
||||
@@ -38,9 +38,9 @@ public:
|
||||
UASSERT(!angularVelocityCovariance.empty() && angularVelocityCovariance.cols == 3 && angularVelocityCovariance.rows == 3 && angularVelocityCovariance.type() == CV_64FC1);
|
||||
UASSERT(!linearAccelerationCovariance.empty() && linearAccelerationCovariance.cols == 3 && linearAccelerationCovariance.rows == 3 && linearAccelerationCovariance.type() == CV_64FC1);
|
||||
}
|
||||
IMU(const Eigen::Vector3d & angularVelocity,
|
||||
IMU(const cv::Vec3d & angularVelocity,
|
||||
const cv::Mat & angularVelocityCovariance,
|
||||
const Eigen::Vector3d & linearAcceleration,
|
||||
const cv::Vec3d & linearAcceleration,
|
||||
const cv::Mat & linearAccelerationCovariance,
|
||||
const Transform & localTransform = Transform::getIdentity()) :
|
||||
angularVelocity_(angularVelocity),
|
||||
@@ -53,13 +53,13 @@ public:
|
||||
UASSERT(!linearAccelerationCovariance.empty() && linearAccelerationCovariance.cols == 3 && linearAccelerationCovariance.rows == 3 && linearAccelerationCovariance.type() == CV_64FC1);
|
||||
}
|
||||
|
||||
const Eigen::Quaterniond & orientation() const {return orientation_;}
|
||||
const cv::Vec4d & orientation() const {return orientation_;}
|
||||
const cv::Mat & orientationCovariance() const {return orientationCovariance_;} // 3x3 double Row major about x, y, z axes, empty if orientation is not set
|
||||
|
||||
const Eigen::Vector3d & angularVelocity() const {return angularVelocity_;}
|
||||
const cv::Vec3d & angularVelocity() const {return angularVelocity_;}
|
||||
const cv::Mat & angularVelocityCovariance() const {return angularVelocityCovariance_;} // 3x3 double Row major about x, y, z axes, empty if angularVelocity is not set
|
||||
|
||||
const Eigen::Vector3d linearAcceleration() const {return linearAcceleration_;}
|
||||
const cv::Vec3d linearAcceleration() const {return linearAcceleration_;}
|
||||
const cv::Mat & linearAccelerationCovariance() const {return linearAccelerationCovariance_;} // 3x3 double Row major x, y z, empty if linearAcceleration is not set
|
||||
|
||||
const Transform & localTransform() const {return localTransform_;}
|
||||
@@ -71,13 +71,13 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
Eigen::Quaterniond orientation_;
|
||||
cv::Vec4d orientation_;
|
||||
cv::Mat orientationCovariance_; // 3x3 double Row major about x, y, z axes, empty if orientation is not set
|
||||
|
||||
Eigen::Vector3d angularVelocity_;
|
||||
cv::Vec3d angularVelocity_;
|
||||
cv::Mat angularVelocityCovariance_; // 3x3 double Row major about x, y, z axes, empty if angularVelocity is not set
|
||||
|
||||
Eigen::Vector3d linearAcceleration_;
|
||||
cv::Vec3d linearAcceleration_;
|
||||
cv::Mat linearAccelerationCovariance_; // 3x3 double Row major x, y z, empty if linearAcceleration is not set
|
||||
|
||||
Transform localTransform_;
|
||||
|
||||
@@ -121,13 +121,13 @@ void IMUThread::mainLoop()
|
||||
std::string nanoseconds = s.substr(s.size() - 9, 9);
|
||||
std::string seconds = s.substr(0, s.size() - 9);
|
||||
|
||||
Eigen::Vector3d gyr;
|
||||
cv::Vec3d gyr;
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
std::getline(stream, s, ',');
|
||||
gyr[j] = uStr2Double(s);
|
||||
}
|
||||
|
||||
Eigen::Vector3d acc;
|
||||
cv::Vec3d acc;
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
std::getline(stream, s, ',');
|
||||
acc[j] = uStr2Double(s);
|
||||
|
||||
@@ -200,7 +200,9 @@ Transform OdometryOkvis::computeTransform(
|
||||
data.imu().angularVelocity()[2]);
|
||||
if(okvisEstimator_ != 0)
|
||||
{
|
||||
imuUpdated = okvisEstimator_->addImuMeasurement(timeOkvis, data.imu().linearAcceleration(), data.imu().angularVelocity());
|
||||
Eigen::Vector3d acc(data.imu().linearAcceleration()[0], data.imu().linearAcceleration()[1], data.imu().linearAcceleration()[2]);
|
||||
Eigen::Vector3d ang(data.imu().angularVelocity()[0], data.imu().angularVelocity()[1], data.imu().angularVelocity()[2]);
|
||||
imuUpdated = okvisEstimator_->addImuMeasurement(timeOkvis, acc, ang);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
42
docker/artful/Dockerfile
Normal file
42
docker/artful/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
||||
# Image: introlab3it/rtabmap:artful
|
||||
|
||||
FROM ubuntu:17.10
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libsqlite3-dev \
|
||||
libpcl-dev \
|
||||
git \
|
||||
cmake \
|
||||
libproj-dev \
|
||||
libqt5svg5-dev \
|
||||
libfreenect-dev \
|
||||
libopenni2-dev \
|
||||
software-properties-common
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
# using OpenCV from source because ffmpeg (libav..) error with opencv binaries
|
||||
RUN git clone https://github.com/opencv/opencv_contrib.git
|
||||
RUN git clone https://github.com/opencv/opencv.git
|
||||
RUN cd rtabmap/build && \
|
||||
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd ../.. && \
|
||||
rm -rf opencv opencv_contrib
|
||||
|
||||
# Clone source code
|
||||
RUN git clone https://github.com/introlab/rtabmap.git
|
||||
|
||||
# Build RTAB-Map project
|
||||
RUN cd rtabmap/build && \
|
||||
cmake .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd ../.. && \
|
||||
rm -rf rtabmap && \
|
||||
ldconfig
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
@@ -375,13 +375,13 @@ int main(int argc, char * argv[])
|
||||
std::string nanoseconds = s.substr(s.size() - 9, 9);
|
||||
std::string seconds = s.substr(0, s.size() - 9);
|
||||
|
||||
Eigen::Vector3d gyr;
|
||||
cv::Vec3d gyr;
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
std::getline(stream, s, ',');
|
||||
gyr[j] = std::stof(s);
|
||||
}
|
||||
|
||||
Eigen::Vector3d acc;
|
||||
cv::Vec3d acc;
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
std::getline(stream, s, ',');
|
||||
acc[j] = std::stof(s);
|
||||
|
||||
Reference in New Issue
Block a user