Skip to content

Commit

Permalink
fix map value types in various places
Browse files Browse the repository at this point in the history
  • Loading branch information
mfehr committed Dec 5, 2019
1 parent 736b1c4 commit 2d75b35
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class PoseInterpolator {
std::vector<int64_t>* vertex_timestamps_nanoseconds) const;

private:
typedef std::pair<int64_t, StateLinearizationPoint> state_buffer_value_type;
typedef std::pair<const int64_t, StateLinearizationPoint>
state_buffer_value_type;
typedef common::TemporalBuffer<
StateLinearizationPoint,
Eigen::aligned_allocator<state_buffer_value_type>>
Expand Down
2 changes: 1 addition & 1 deletion algorithms/landmark-triangulation/src/pose-interpolator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void PoseInterpolator::buildListOfAllRequiredIMUMeasurements(
CHECK_GE(end_index, 0);

// First add all imu measurements from this vertex to the buffer.
typedef std::pair<int64_t, IMUMeasurement> buffer_value_type;
typedef std::pair<const int64_t, IMUMeasurement> buffer_value_type;
using common::TemporalBuffer;
typedef TemporalBuffer<
IMUMeasurement, Eigen::aligned_allocator<buffer_value_type>>
Expand Down
14 changes: 8 additions & 6 deletions algorithms/simulation/include/mav_planning_utils/path_planning.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ class Vertex {
static const int D = _D;
typedef Eigen::Matrix<double, D, 1> ConstraintValueT;
typedef std::pair<int, ConstraintValueT> Constraint;
typedef std::map<int, ConstraintValueT, std::less<int>,
Eigen::aligned_allocator<std::pair<int, ConstraintValueT> > >
typedef std::map<
int, ConstraintValueT, std::less<int>,
Eigen::aligned_allocator<std::pair<const int, ConstraintValueT> > >
Constraints;

double time_to_next;
Expand Down Expand Up @@ -482,7 +483,7 @@ class Path4D {
/// initializes the internal segments with the arguments, so that sample() can
/// be used
Path4D(
const SegmentVector& sx, const SegmentVector& sy, SegmentVector& sz,
const SegmentVector& sx, const SegmentVector& sy, const SegmentVector& sz,
const SegmentVector& syaw)
: sx_(sx), sy_(sy), sz_(sz), syaw_(syaw) {
assert(sx_.size() == sy_.size());
Expand Down Expand Up @@ -662,9 +663,10 @@ class Path4D {
*/
template <int n_p, int n_y>
void sample(
typename Motion4D<n_p, n_y>::Vector& result, double dt,
typename Motion4D<n_p, n_y>::Vector* result, double dt,
Eigen::VectorXd* timestamps_seconds) const {
CHECK_NOTNULL(timestamps_seconds);
CHECK_NOTNULL(result);
double path_time = 0;

for (typename SegmentVector::const_iterator it = sx_.begin();
Expand All @@ -675,14 +677,14 @@ class Path4D {
VLOG(3) << "path time: " << path_time;
int n_samples = (path_time + dt * 0.5) / dt + 1;

result.resize(n_samples);
result->resize(n_samples);
timestamps_seconds->resize(n_samples);

VLOG(3) << "num samples: " << n_samples;

double t = 0;
for (int i = 0; i < n_samples; ++i) {
Motion4D<n_p, n_y>& sample = result[i];
Motion4D<n_p, n_y>& sample = result->at(i);
samplePath(sample.x, sx_, t);
samplePath(sample.y, sy_, t);
samplePath(sample.z, sz_, t);
Expand Down
2 changes: 1 addition & 1 deletion algorithms/simulation/src/generic-path-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void GenericPathGenerator::generatePath() {

// Downsampling of the generated trajectory by the sampling time.
path.sample<5, 2>(
path_data_, settings_.sampling_time_second, &timestamps_seconds_);
&path_data_, settings_.sampling_time_second, &timestamps_seconds_);
// This is randomized.
this->motionVectorToImuData(settings_.imu_noise_bias_seed);
is_path_generated_ = true;
Expand Down
3 changes: 2 additions & 1 deletion common/maplab-common/include/maplab-common/temporal-buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace common {

template <
typename ValueType,
typename AllocatorType = std::allocator<std::pair<int64_t, ValueType> > >
typename AllocatorType =
std::allocator<std::pair<const int64_t, ValueType> > >
class TemporalBuffer {
public:
typedef std::map<int64_t, ValueType, std::less<int64_t>, AllocatorType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ImuMeasurementBuffer {
Eigen::Matrix<int64_t, 1, Eigen::Dynamic>* imu_timestamps,
Eigen::Matrix<double, 6, Eigen::Dynamic>* imu_measurements) const;

typedef std::pair<int64_t, vio::ImuMeasurement> BufferElement;
typedef std::pair<const int64_t, vio::ImuMeasurement> BufferElement;
typedef Eigen::aligned_allocator<BufferElement> BufferAllocator;
typedef common::TemporalBuffer<vio::ImuMeasurement, BufferAllocator> Buffer;

Expand Down

0 comments on commit 2d75b35

Please sign in to comment.