Wrist loop test case now runs and fails.
diff --git a/aos/atom_code/queue-tmpl.h b/aos/atom_code/queue-tmpl.h
index 3a8eea8..530f30f 100644
--- a/aos/atom_code/queue-tmpl.h
+++ b/aos/atom_code/queue-tmpl.h
@@ -179,6 +179,15 @@
}
template <class T>
+void Queue<T>::Clear() {
+ if (queue_ == NULL) {
+ queue_msg_.reset();
+ queue_ = NULL;
+ queue_msg_.set_queue(NULL);
+ }
+}
+
+template <class T>
bool Queue<T>::FetchNext() {
Init();
// TODO(aschuh): Use aos_queue_read_msg_index so that multiple readers
diff --git a/aos/common/control_loop/control_loops.q b/aos/common/control_loop/control_loops.q
index 5ba30ec..823005e 100644
--- a/aos/common/control_loop/control_loops.q
+++ b/aos/common/control_loop/control_loops.q
@@ -20,7 +20,7 @@
};
message Output {
- double pwm;
+ double voltage;
};
message Status {
diff --git a/aos/common/queue.h b/aos/common/queue.h
index 7b38e67..2ae2f0a 100644
--- a/aos/common/queue.h
+++ b/aos/common/queue.h
@@ -202,6 +202,10 @@
// take a different amount of time the first cycle.
void Init();
+ // Removes all internal references to shared memory so shared memory can be
+ // restarted safely. This should only be used in testing.
+ void Clear();
+
// Fetches the next message from the queue.
// Returns true if there was a new message available and we successfully
// fetched it. This removes the message from the queue for all readers.