aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/px4_middleware.h
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-04 13:06:38 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-04 13:06:38 +0100
commite0bb713bb03c0aa79e69496c787c012a8e1b78d1 (patch)
treeb71614bc124479dbe7a57b434872fc7deb39eb20 /src/platforms/px4_middleware.h
parent0f094d35d5dd183e44148eb1acbd7b7d76fde669 (diff)
downloadpx4-firmware-e0bb713bb03c0aa79e69496c787c012a8e1b78d1.tar.gz
px4-firmware-e0bb713bb03c0aa79e69496c787c012a8e1b78d1.tar.bz2
px4-firmware-e0bb713bb03c0aa79e69496c787c012a8e1b78d1.zip
more documentation comments
Diffstat (limited to 'src/platforms/px4_middleware.h')
-rw-r--r--src/platforms/px4_middleware.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/platforms/px4_middleware.h b/src/platforms/px4_middleware.h
index dece72907..c1465b4b1 100644
--- a/src/platforms/px4_middleware.h
+++ b/src/platforms/px4_middleware.h
@@ -50,9 +50,15 @@ __EXPORT void init(int argc, char *argv[], const char *process_name);
__EXPORT uint64_t get_time_micros();
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
+/**
+ * Returns true if the app/task should continue to run
+ */
bool ok() { return ros::ok(); }
#else
extern bool task_should_exit;
+/**
+ * Returns true if the app/task should continue to run
+ */
bool ok() { return !task_should_exit; }
#endif
@@ -60,8 +66,15 @@ class Rate
{
public:
+ /**
+ * Construct the Rate object and set rate
+ * @param rate_hz rate from which sleep time is calculated in Hz
+ */
explicit Rate(unsigned rate_hz) { sleep_interval = 1e6 / rate_hz; }
+ /**
+ * Sleep for 1/rate_hz s
+ */
void sleep() { usleep(sleep_interval); }
private: