Skip to content

Commit

Permalink
Removes sensor packet period histogram. (cartographer-project#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
damonkohler authored Oct 26, 2016
1 parent 6e6d2de commit 15f9244
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 187 deletions.
32 changes: 0 additions & 32 deletions cartographer/common/histogram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,6 @@
namespace cartographer {
namespace common {

namespace {

string PaddedTo(string input, int new_length) {
CHECK_GE(new_length, input.size());
input.insert(input.begin(), new_length - input.size(), ' ');
return input;
}

} // namespace

void BucketHistogram::Hit(const string& bucket) { ++buckets_[bucket]; }

string BucketHistogram::ToString() const {
int64 sum = 0;
size_t max_bucket_name_length = 0;
for (const auto& pair : buckets_) {
sum += pair.second;
max_bucket_name_length =
std::max(pair.first.size(), max_bucket_name_length);
}

string result;
for (const auto& pair : buckets_) {
const float percent = 100.f * pair.second / std::max<int64>(1, sum);
result += PaddedTo(pair.first, max_bucket_name_length) + ": " +
PaddedTo(std::to_string(pair.second), 7) + " (" +
std::to_string(percent) + " %)\n";
}
result += "Total: " + std::to_string(sum);
return result;
}

void Histogram::Add(const float value) { values_.push_back(value); }

string Histogram::ToString(const int buckets) const {
Expand Down
9 changes: 0 additions & 9 deletions cartographer/common/histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@
namespace cartographer {
namespace common {

class BucketHistogram {
public:
void Hit(const string& bucket);
string ToString() const;

private:
std::map<string, int64> buckets_;
};

class Histogram {
public:
void Add(float value);
Expand Down
12 changes: 0 additions & 12 deletions cartographer/sensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ google_library(sensor_collator
common_time
sensor_data
sensor_ordered_multi_queue
sensor_sensor_packet_period_histogram_builder
)

google_library(sensor_compressed_point_cloud
Expand Down Expand Up @@ -103,17 +102,6 @@ google_library(sensor_point_cloud
transform_transform
)

google_library(sensor_sensor_packet_period_histogram_builder
USES_GLOG
SRCS
sensor_packet_period_histogram_builder.cc
HDRS
sensor_packet_period_histogram_builder.h
DEPENDS
common_histogram
common_port
)

google_library(sensor_voxel_filter
SRCS
voxel_filter.cc
Expand Down
5 changes: 0 additions & 5 deletions cartographer/sensor/collator.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "cartographer/common/time.h"
#include "cartographer/sensor/data.h"
#include "cartographer/sensor/ordered_multi_queue.h"
#include "cartographer/sensor/sensor_packet_period_histogram_builder.h"
#include "glog/logging.h"

namespace cartographer {
Expand Down Expand Up @@ -71,16 +70,13 @@ class Collator {
// order.
void AddSensorData(const int trajectory_id, const string& sensor_id,
std::unique_ptr<Data> data) {
sensor_packet_period_histogram_builder_.Add(
trajectory_id, common::ToUniversal(data->time), sensor_id);
queue_.Add(QueueKey{trajectory_id, sensor_id}, std::move(data));
}

// Dispatches all queued sensor packets. May only be called once.
// AddSensorData may not be called after Flush.
void Flush() {
queue_.Flush();
sensor_packet_period_histogram_builder_.LogHistogramsAndClear();
}

// Returns the number of packets associated with 'trajectory_id' that are
Expand All @@ -99,7 +95,6 @@ class Collator {

// Map of trajectory ID to all associated QueueKeys.
std::unordered_map<int, std::vector<QueueKey>> queue_keys_;
SensorPacketPeriodHistogramBuilder sensor_packet_period_histogram_builder_;
};

} // namespace sensor
Expand Down
84 changes: 0 additions & 84 deletions cartographer/sensor/sensor_packet_period_histogram_builder.cc

This file was deleted.

45 changes: 0 additions & 45 deletions cartographer/sensor/sensor_packet_period_histogram_builder.h

This file was deleted.

0 comments on commit 15f9244

Please sign in to comment.