From a80e237a8a94dfa826446037d7ccdc2e2cb3ead7 Mon Sep 17 00:00:00 2001 From: abeinder <abeinder@iastate.edu> Date: Wed, 26 Apr 2023 21:34:47 -0500 Subject: [PATCH] I broke the gamepad and fixed it --- pycrocart/PyCroCart.py | 2 +- pycrocart/SetpointMenu.py | 17 ++++++++++------- pycrocart/logging_variables.json | 7 +------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pycrocart/PyCroCart.py b/pycrocart/PyCroCart.py index 5ea6ea8ec..49e40fd72 100644 --- a/pycrocart/PyCroCart.py +++ b/pycrocart/PyCroCart.py @@ -61,7 +61,7 @@ if __name__ == '__main__': app = QApplication(sys.argv) cf1 = CrazyflieProtoConnection() - uri = 'radio://0/80/2M/E7E7E7E7E7' + uri = 'radio://0/20/2M/E7E7E7E7E7' cf1.connect(uri) cf1.scf.cf.commander = uCartCommander.Commander(cf1.scf.cf) diff --git a/pycrocart/SetpointMenu.py b/pycrocart/SetpointMenu.py index a4a3580e8..0740a1815 100644 --- a/pycrocart/SetpointMenu.py +++ b/pycrocart/SetpointMenu.py @@ -173,13 +173,16 @@ class SetpointMenu(QWidget): else: self.setpoint_handler.setRateMode() - yaw = self.cap_max_value(yaw, 20, -20) - pitch = self.cap_max_value(pitch, 5, -5) - roll = self.cap_max_value(roll, 5, -5) - - # If you are a flypi do this - thrust = thrust + 100 - thrust = self.cap_max_value(thrust, 340, 240) + if self.gamepad_button.isChecked(): + yaw = self.cap_max_value(yaw, 20, -20) + pitch = self.cap_max_value(pitch, 5, -5) + roll = self.cap_max_value(roll, 5, -5) + + # If you are a flypi do this + thrust = thrust + 240 + thrust = self.cap_max_value(thrust, 340, 240) + print("thrust") + print(thrust) # otherwise don't..... but I'm not changing that rn diff --git a/pycrocart/logging_variables.json b/pycrocart/logging_variables.json index 8a5ebf63a..67b220d72 100644 --- a/pycrocart/logging_variables.json +++ b/pycrocart/logging_variables.json @@ -2,12 +2,7 @@ "group1": { "update_frequency_ms": 50, - "vars": ["ctrlStdnt.msrdPitchRate", "ctrlStdnt.dsirdPitchRate", "stateEstimate.roll", "stateEstimate.yaw", "ctrlStdnt.desiredPitch"] - }, - "group2": - { - "update_frequency_ms": 50, - "vars": ["ctrlStdnt.cmd_thrust", "ctrlStdnt.cmd_roll", "ctrlStdnt.cmd_pitch", "stateEstimate.pitch", "ctrlStdnt.cmd_yaw"] + "vars": ["stateEstimate.roll", "stateEstimate.yaw", "stateEstimate.pitch"] }, "group3": { -- GitLab