Skip to content

Commit dc71c10

Browse files
committed
Added more angles to drone gimbal tilting.
1 parent d0ffcda commit dc71c10

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

drone_base/control/manual/keyboard_controller.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ class KeyboardController:
2929
- y - Land the drone.
3030
- p - Takes a photo.
3131
- z - Resets the gimbal camera position.
32-
- x - Tilts the gimbal camera position 30 degrees.
33-
- c - Tilts the gimbal camera position 90 degrees.
32+
- x - Tilts the gimbal camera position 15 degrees.
33+
- c - Tilts the gimbal camera position 30 degrees.
34+
- v - Tilts the gimbal camera position 45 degrees.
35+
- s - Tilts the gimbal camera position 60 degrees.
36+
- d - Tilts the gimbal camera position 75 degrees.
37+
- f - Tilts the gimbal camera position 90 degrees.
3438
"""
3539

3640
MOVEMENT_KEYS: Final[dict[str, tuple[str, int]]] = {
@@ -49,8 +53,12 @@ class KeyboardController:
4953
"y": DroneCommand.LAND,
5054
"p": DroneCommand.PHOTO,
5155
"z": DroneCommand.TILT_RESET,
52-
"x": DroneCommand.TILT_30,
53-
"c": DroneCommand.TILT_90,
56+
"x": DroneCommand.TILT_15,
57+
"c": DroneCommand.TILT_30,
58+
"v": DroneCommand.TILT_45,
59+
"s": DroneCommand.TILT_60,
60+
"d": DroneCommand.TILT_75,
61+
"f": DroneCommand.TILT_90,
5462
"q": DroneCommand.EMERGENCY_STOP,
5563
}
5664

@@ -143,8 +151,16 @@ def _execute_command(self, command: DroneCommand):
143151
self.logger.info("Photo taken.")
144152
elif command == DroneCommand.TILT_RESET:
145153
self.commander.tilt_camera(pitch_deg=0, reference_type=GimbalType.REF_ABSOLUTE)
154+
elif command == DroneCommand.TILT_15:
155+
self.commander.tilt_camera(pitch_deg=-15, reference_type=GimbalType.REF_ABSOLUTE)
146156
elif command == DroneCommand.TILT_30:
147157
self.commander.tilt_camera(pitch_deg=-30, reference_type=GimbalType.REF_ABSOLUTE)
158+
elif command == DroneCommand.TILT_45:
159+
self.commander.tilt_camera(pitch_deg=-45, reference_type=GimbalType.REF_ABSOLUTE)
160+
elif command == DroneCommand.TILT_60:
161+
self.commander.tilt_camera(pitch_deg=-60, reference_type=GimbalType.REF_ABSOLUTE)
162+
elif command == DroneCommand.TILT_75:
163+
self.commander.tilt_camera(pitch_deg=-75, reference_type=GimbalType.REF_ABSOLUTE)
148164
elif command == DroneCommand.TILT_90:
149165
self.commander.tilt_camera(pitch_deg=-90, reference_type=GimbalType.REF_ABSOLUTE)
150166
elif command == DroneCommand.EMERGENCY_STOP:

drone_base/control/manual/operations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ class DroneCommand(Enum):
77
LAND = auto()
88
PHOTO = auto()
99
TILT_RESET = auto()
10+
TILT_15 = auto()
1011
TILT_30 = auto()
12+
TILT_45 = auto()
13+
TILT_60 = auto()
14+
TILT_75 = auto()
1115
TILT_90 = auto()
1216
EMERGENCY_STOP = auto()
1317

0 commit comments

Comments
 (0)