From b06db5dce17f06a844842e4af4cbab8a12308513 Mon Sep 17 00:00:00 2001
From: crhunt <crhunt@iastate.edu>
Date: Mon, 6 Feb 2023 01:01:36 -0600
Subject: [PATCH] Adds setup function for modes

See Issue #145
---
 crazyflie_groundstation/inc/testStand.h   |  1 +
 crazyflie_groundstation/src/testStand.cpp | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/crazyflie_groundstation/inc/testStand.h b/crazyflie_groundstation/inc/testStand.h
index 625703cb6..8cef16215 100644
--- a/crazyflie_groundstation/inc/testStand.h
+++ b/crazyflie_groundstation/inc/testStand.h
@@ -17,6 +17,7 @@ class TestStand {
         void toggleMode();
         void setModePosition();
         void setModeRate();
+        void setupTestStand(int deviceMode);
 
         std::string getCurrentValue();
         std::string getCurrentPosition();
diff --git a/crazyflie_groundstation/src/testStand.cpp b/crazyflie_groundstation/src/testStand.cpp
index 9ae0ef63b..63ab8c103 100644
--- a/crazyflie_groundstation/src/testStand.cpp
+++ b/crazyflie_groundstation/src/testStand.cpp
@@ -114,4 +114,18 @@ std::string TestStand::getCurrentRate(){
 std::string TestStand::getCurrentADCValue(){
     this->serialInterface->write(&GET_ADC, 1);
     return this->serialInterface->readline();
-}
\ No newline at end of file
+}
+
+/**
+ * @brief Sets up Test Stand for opertation mode
+ *
+ * @param deviceMode 0 for Rate Mode | 1 for Position Mode (default)
+ */
+void TestStand::setupTestStand(int deviceMode){
+    if(deviceMode == 0){
+        setModeRate();
+    }else{
+        zeroHeading();
+        setModePosition();
+    }
+}
-- 
GitLab