everything runs!
diff --git a/aos/common/logging/logging_impl.cc b/aos/common/logging/logging_impl.cc
index 5f4a9b2..a0c4e56 100644
--- a/aos/common/logging/logging_impl.cc
+++ b/aos/common/logging/logging_impl.cc
@@ -121,7 +121,7 @@
static_cast<int>(message.message_length), message.message);
break;
case LogMessage::Type::kStruct:
- char buffer[LOG_MESSAGE_LEN];
+ char buffer[1024];
size_t output_length = sizeof(buffer);
size_t input_length = message.message_length;
if (!PrintMessage(
@@ -157,7 +157,7 @@
type->name.c_str());
}
size_t used = serialize(serialized);
- char printed[LOG_MESSAGE_LEN * 5];
+ char printed[1024];
size_t printed_bytes = sizeof(printed);
if (!PrintMessage(printed, &printed_bytes, serialized, &used, *type)) {
LOG(FATAL, "PrintMessage(%p, %p(=%zd), %p, %p(=%zd), %p(name=%s)) failed\n",
diff --git a/aos/common/queue_types.cc b/aos/common/queue_types.cc
index d329cf1..bcf3e94 100644
--- a/aos/common/queue_types.cc
+++ b/aos/common/queue_types.cc
@@ -231,50 +231,57 @@
LOG(FATAL, "can't AddShm(%" PRIu32 ") without shm!\n", type_id);
}
- ::aos::MutexLocker locker(&cache_lock);
- CacheEntry &cached = cache.at(type_id);
- if (cached.in_shm) return;
+ const MessageType::Field **fields;
+ int number_fields;
+ {
+ ::aos::MutexLocker locker(&cache_lock);
+ CacheEntry &cached = cache.at(type_id);
+ if (cached.in_shm) return;
- if (mutex_lock(&global_core->mem_struct->queue_types.lock) != 0) {
- LOG(FATAL, "locking queue_types lock failed\n");
- }
- volatile ShmType *current = static_cast<volatile ShmType *>(
- global_core->mem_struct->queue_types.pointer);
- if (current != nullptr) {
- while (true) {
- if (current->id == type_id) {
- cached.in_shm = true;
- mutex_unlock(&global_core->mem_struct->queue_types.lock);
- return;
- }
- if (current->next == nullptr) break;
- current = current->next;
+ fields = cached.type.fields;
+ number_fields = cached.type.number_fields;
+
+ if (mutex_lock(&global_core->mem_struct->queue_types.lock) != 0) {
+ LOG(FATAL, "locking queue_types lock failed\n");
}
- }
- char buffer[512];
- ssize_t size = cached.type.Serialize(buffer, sizeof(buffer));
- if (size == -1) {
- LOG(FATAL, "type %s is too big to fit into %zd bytes\n",
- cached.type.name.c_str(), sizeof(buffer));
+ volatile ShmType *current = static_cast<volatile ShmType *>(
+ global_core->mem_struct->queue_types.pointer);
+ if (current != nullptr) {
+ while (true) {
+ if (current->id == type_id) {
+ cached.in_shm = true;
+ mutex_unlock(&global_core->mem_struct->queue_types.lock);
+ return;
+ }
+ if (current->next == nullptr) break;
+ current = current->next;
+ }
+ }
+ char buffer[512];
+ ssize_t size = cached.type.Serialize(buffer, sizeof(buffer));
+ if (size == -1) {
+ LOG(FATAL, "type %s is too big to fit into %zd bytes\n",
+ cached.type.name.c_str(), sizeof(buffer));
+ }
+
+ volatile ShmType *shm =
+ static_cast<volatile ShmType *>(shm_malloc(sizeof(ShmType) + size));
+ shm->id = type_id;
+ shm->next = nullptr;
+ shm->serialized_size = size;
+ memcpy(const_cast<char *>(shm->serialized), buffer, size);
+
+ if (current == NULL) {
+ global_core->mem_struct->queue_types.pointer = const_cast<ShmType *>(shm);
+ } else {
+ current->next = shm;
+ }
+ mutex_unlock(&global_core->mem_struct->queue_types.lock);
}
- volatile ShmType *shm =
- static_cast<volatile ShmType *>(shm_malloc(sizeof(ShmType) + size));
- shm->id = type_id;
- shm->next = nullptr;
- shm->serialized_size = size;
- memcpy(const_cast<char *>(shm->serialized), buffer, size);
-
- if (current == NULL) {
- global_core->mem_struct->queue_types.pointer = const_cast<ShmType *>(shm);
- } else {
- current->next = shm;
- }
- mutex_unlock(&global_core->mem_struct->queue_types.lock);
-
- for (int i = 0; i < cached.type.number_fields; ++i) {
- if (!MessageType::IsPrimitive(cached.type.fields[i]->type)) {
- AddShm(cached.type.fields[i]->type);
+ for (int i = 0; i < number_fields; ++i) {
+ if (!MessageType::IsPrimitive(fields[i]->type)) {
+ AddShm(fields[i]->type);
}
}
}
diff --git a/bbb_cape/src/bbb/uart_reader.cc b/bbb_cape/src/bbb/uart_reader.cc
index 9379252..34b907b 100644
--- a/bbb_cape/src/bbb/uart_reader.cc
+++ b/bbb_cape/src/bbb/uart_reader.cc
@@ -32,12 +32,13 @@
LOG(INFO, "unexporting BB-UART1\n");
if (system("bash -c 'echo -$(cat /sys/devices/bone_capemgr.*/slots"
" | fgrep BB-UART1"
- " | cut -d : -f 1) > /sys/devices/bone_capemgr.*/slots'") ==
- -1) {
+ " | cut -d : -f 1 | tr -d \" \")"
+ " > /sys/devices/bone_capemgr.*/slots'") == -1) {
LOG(FATAL, "system([disable OMAP UART]) failed with %d: %s\n", errno,
strerror(errno));
}
while (easy_access(device)) {
+ LOG(DEBUG, "waiting for BB-UART1 to be unexported\n");
::aos::time::SleepFor(::aos::time::Time::InSeconds(0.1));
}
}
@@ -52,6 +53,7 @@
strerror(errno));
}
while (!easy_access(device)) {
+ LOG(DEBUG, "waiting for BB-UART1 to be exported\n");
::aos::time::SleepFor(::aos::time::Time::InSeconds(0.1));
}
diff --git a/frc971/control_loops/shooter/shooter.h b/frc971/control_loops/shooter/shooter.h
index 2946b67..89109dd 100755
--- a/frc971/control_loops/shooter/shooter.h
+++ b/frc971/control_loops/shooter/shooter.h
@@ -91,7 +91,7 @@
void SetPositionValues(double position) {
Eigen::Matrix<double, 1, 1> Y;
Y << position;
- LOG(INFO, "Setting position to %f\n", position);
+ LOG(DEBUG, "Setting position to %f\n", position);
Correct(Y);
}
@@ -99,7 +99,7 @@
// austin said something about which matrix to set, but I didn't under
// very much of it
//some_matrix = {desired_position, desired_velocity};
- LOG(INFO, "ZSFL> dp: %.2f dz: %.2f\n", desired_position, desired_velocity);
+ LOG(DEBUG, "ZSFL> dp: %.2f dz: %.2f\n", desired_position, desired_velocity);
R << desired_position, desired_velocity, 0;
}