Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

Commit

Permalink
refs #45 Downsample some data logging streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoos committed Jun 17, 2015
1 parent 7c55f51 commit 3776038
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
7 changes: 6 additions & 1 deletion src/estimator/atmospheric_location_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,10 @@ void AtmosphericLocationEstimator::updateStream() {
locationMessageStream.publish(m);
}

logger.write(m);
// Downsample logging to 100 Hz
static int i=0;
if (i % 10 == 0) {
logger.write(m);
}
i = (i+1) % 1000;
}
9 changes: 8 additions & 1 deletion src/estimator/dcm_attitude_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,12 @@ void DCMAttitudeEstimator::updateStream() {
attitudeMessageStream.publish(m);
}

logger.write(m);
// Full-resolution attitude log by itself accounts for nearly half of all
// logging. Downsample to 100 Hz so the filesystem has an easier time keeping
// up.
static int i=0;
if (i % 10 == 0) {
logger.write(m);
}
i = (i+1) % 1000;
}
37 changes: 19 additions & 18 deletions src/estimator/world_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,28 @@ WorldEstimate WorldEstimator::update(const SensorMeasurements& meas) {
estimate.att = attEstimator.update(meas);
estimate.loc = locEstimator.update(meas, estimate.att);

// TODO(yoos): Need RateLimitedStream for logger.
static uint16_t i = 0;
// Log 1 kHz stream
protocol::message::raw_1000_message_t msg_1000 {
.time = ST2MS(chibios_rt::System::getTime()),
.accel = {(*meas.accel).axes[0],
(*meas.accel).axes[1],
(*meas.accel).axes[2]},
.accelH = {(*meas.accelH).axes[0],
(*meas.accelH).axes[1],
(*meas.accelH).axes[2]},
.gyro = {(*meas.gyro).axes[0],
(*meas.gyro).axes[1],
(*meas.gyro).axes[2]}
};
logger.write(msg_1000);
if (raw1000MessageStream.ready()) {
raw1000MessageStream.publish(msg_1000);
if (i % 1 == 0) {
protocol::message::raw_1000_message_t msg_1000 {
.time = ST2MS(chibios_rt::System::getTime()),
.accel = {(*meas.accel).axes[0],
(*meas.accel).axes[1],
(*meas.accel).axes[2]},
.accelH = {(*meas.accelH).axes[0],
(*meas.accelH).axes[1],
(*meas.accelH).axes[2]},
.gyro = {(*meas.gyro).axes[0],
(*meas.gyro).axes[1],
(*meas.gyro).axes[2]}
};
logger.write(msg_1000);
if (raw1000MessageStream.ready()) {
raw1000MessageStream.publish(msg_1000);
}
}

// Downsampled streams
// TODO(yoos): Need RateLimitedStream for logger.
static uint16_t i = 0;
// Log 50 Hz stream
if (i % 20 == 0) {
protocol::message::raw_50_message_t msg_50 {
Expand Down

0 comments on commit 3776038

Please sign in to comment.