mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-01 10:44:00 +00:00
simplifying xbox
This commit is contained in:
parent
814be2ee60
commit
524992307c
3 changed files with 2 additions and 55 deletions
|
@ -212,20 +212,6 @@ class XBoxController:
|
||||||
self.last_right_trigger,
|
self.last_right_trigger,
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
|
||||||
self.last_commands,
|
|
||||||
A_pressed,
|
|
||||||
B_pressed,
|
|
||||||
X_pressed,
|
|
||||||
Y_pressed,
|
|
||||||
LB_pressed,
|
|
||||||
RB_pressed,
|
|
||||||
self.last_left_trigger,
|
|
||||||
self.last_right_trigger,
|
|
||||||
up_down,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
controller = XBoxController(20)
|
controller = XBoxController(20)
|
||||||
|
|
||||||
|
|
|
@ -45,18 +45,6 @@ limits = {
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
# (
|
|
||||||
# last_commands,
|
|
||||||
# A_pressed,
|
|
||||||
# B_pressed,
|
|
||||||
# X_pressed,
|
|
||||||
# Y_pressed,
|
|
||||||
# LB_pressed,
|
|
||||||
# RB_pressed,
|
|
||||||
# left_trigger,
|
|
||||||
# right_trigger,
|
|
||||||
# up_down,
|
|
||||||
# ) = xbox_controller.get_last_command()
|
|
||||||
|
|
||||||
last_commands, buttons, left_trigger, right_trigger = (
|
last_commands, buttons, left_trigger, right_trigger = (
|
||||||
xbox_controller.get_last_command()
|
xbox_controller.get_last_command()
|
||||||
|
|
|
@ -14,7 +14,6 @@ from mini_bdx_runtime.sounds import Sounds
|
||||||
from mini_bdx_runtime.antennas import Antennas
|
from mini_bdx_runtime.antennas import Antennas
|
||||||
from mini_bdx_runtime.projector import Projector
|
from mini_bdx_runtime.projector import Projector
|
||||||
from mini_bdx_runtime.rl_utils import make_action_dict, LowPassActionFilter
|
from mini_bdx_runtime.rl_utils import make_action_dict, LowPassActionFilter
|
||||||
from mini_bdx_runtime.buttons import Buttons
|
|
||||||
from mini_bdx_runtime.duck_config import DuckConfig
|
from mini_bdx_runtime.duck_config import DuckConfig
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -98,7 +97,6 @@ class RLWalk:
|
||||||
self.command_freq = 20 # hz
|
self.command_freq = 20 # hz
|
||||||
if self.commands:
|
if self.commands:
|
||||||
self.xbox_controller = XBoxController(self.command_freq)
|
self.xbox_controller = XBoxController(self.command_freq)
|
||||||
self.buttons = Buttons()
|
|
||||||
|
|
||||||
# Reference motion, but we only really need the length of one phase
|
# Reference motion, but we only really need the length of one phase
|
||||||
# TODO
|
# TODO
|
||||||
|
@ -206,34 +204,12 @@ class RLWalk:
|
||||||
while True:
|
while True:
|
||||||
left_trigger = 0
|
left_trigger = 0
|
||||||
right_trigger = 0
|
right_trigger = 0
|
||||||
up_down = 0
|
|
||||||
t = time.time()
|
t = time.time()
|
||||||
|
|
||||||
if self.commands:
|
if self.commands:
|
||||||
(
|
self.last_commands, self.buttons, left_trigger, right_trigger = (
|
||||||
self.last_commands,
|
self.xbox_controller.get_last_command()
|
||||||
A_pressed,
|
|
||||||
B_pressed,
|
|
||||||
X_pressed,
|
|
||||||
Y_pressed,
|
|
||||||
LB_pressed,
|
|
||||||
RB_pressed,
|
|
||||||
left_trigger,
|
|
||||||
right_trigger,
|
|
||||||
up_down,
|
|
||||||
) = self.xbox_controller.get_last_command()
|
|
||||||
|
|
||||||
self.buttons.update(
|
|
||||||
A_pressed,
|
|
||||||
B_pressed,
|
|
||||||
X_pressed,
|
|
||||||
Y_pressed,
|
|
||||||
LB_pressed,
|
|
||||||
RB_pressed,
|
|
||||||
up_down == 1,
|
|
||||||
up_down == -1,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.buttons.dpad_up.triggered:
|
if self.buttons.dpad_up.triggered:
|
||||||
self.phase_frequency_factor_offset += 0.05
|
self.phase_frequency_factor_offset += 0.05
|
||||||
print(
|
print(
|
||||||
|
@ -251,9 +227,6 @@ class RLWalk:
|
||||||
else:
|
else:
|
||||||
self.phase_frequency_factor = 1.0
|
self.phase_frequency_factor = 1.0
|
||||||
|
|
||||||
# self.phase_frequency_factor = self.get_phase_frequency_factor(self.last_commands[0])
|
|
||||||
# print(f"Phase frequency factor {self.phase_frequency_factor}")
|
|
||||||
|
|
||||||
if self.buttons.X.triggered:
|
if self.buttons.X.triggered:
|
||||||
if self.duck_config.projector:
|
if self.duck_config.projector:
|
||||||
self.projector.switch()
|
self.projector.switch()
|
||||||
|
|
Loading…
Reference in a new issue