allaie le slender!
This commit is contained in:
1
audio_files/va_droite
Normal file
1
audio_files/va_droite
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Va à droite
|
||||||
0
audio_files/va_droite.pho
Normal file
0
audio_files/va_droite.pho
Normal file
1
audio_files/va_gauche
Normal file
1
audio_files/va_gauche
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Va à gauche
|
||||||
32
control.py
32
control.py
@@ -218,6 +218,16 @@ def coup_pied_droit():
|
|||||||
est_stop = 0
|
est_stop = 0
|
||||||
ajoute_action("Coup de pied droit !")
|
ajoute_action("Coup de pied droit !")
|
||||||
|
|
||||||
|
def attention_obstacle():
|
||||||
|
global est_stop
|
||||||
|
est_stop = 0
|
||||||
|
ajoute_action("Attention obstacle")
|
||||||
|
|
||||||
|
def attention_escalier():
|
||||||
|
global est_stop
|
||||||
|
est_stop = 0
|
||||||
|
ajoute_action("Attention escalier")
|
||||||
|
|
||||||
print(inputs.devices.gamepads)
|
print(inputs.devices.gamepads)
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
@@ -248,6 +258,8 @@ actions = {
|
|||||||
25 : saute,
|
25 : saute,
|
||||||
26 : coup_pied_gauche,
|
26 : coup_pied_gauche,
|
||||||
27 : coup_pied_droit,
|
27 : coup_pied_droit,
|
||||||
|
28 : attention_obstacle,
|
||||||
|
29 : attention_escalier,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -282,6 +294,12 @@ pied_droit = 0
|
|||||||
prev_A = -1
|
prev_A = -1
|
||||||
A = -1
|
A = -1
|
||||||
|
|
||||||
|
prev_Y = -1
|
||||||
|
Y = -1
|
||||||
|
|
||||||
|
prev_B = -1
|
||||||
|
B = -1
|
||||||
|
|
||||||
prev_brase_gauche = -1
|
prev_brase_gauche = -1
|
||||||
bras_gauche = -1
|
bras_gauche = -1
|
||||||
bras_gauche_tendu = 0
|
bras_gauche_tendu = 0
|
||||||
@@ -314,6 +332,10 @@ while (True) :
|
|||||||
X = event.state
|
X = event.state
|
||||||
if event.code == "BTN_SOUTH" :
|
if event.code == "BTN_SOUTH" :
|
||||||
A = event.state
|
A = event.state
|
||||||
|
if event.code == "BTN_EAST" :
|
||||||
|
B = event.state
|
||||||
|
if event.code == "BTN_WEST" :
|
||||||
|
Y = event.state
|
||||||
if event.code == "BTN_TL" :
|
if event.code == "BTN_TL" :
|
||||||
TL = event.state
|
TL = event.state
|
||||||
if event.code == "BTN_TR" :
|
if event.code == "BTN_TR" :
|
||||||
@@ -424,3 +446,13 @@ while (True) :
|
|||||||
if TR == 1 :
|
if TR == 1 :
|
||||||
actions[27]()
|
actions[27]()
|
||||||
prev_TR = TR
|
prev_TR = TR
|
||||||
|
|
||||||
|
if B > -1 and not B == prev_B :
|
||||||
|
if B == 1 :
|
||||||
|
actions[29]()
|
||||||
|
prev_B = B
|
||||||
|
|
||||||
|
if Y > -1 and not Y == prev_Y :
|
||||||
|
if Y == 1 :
|
||||||
|
actions[28]()
|
||||||
|
prev_Y = Y
|
||||||
|
|||||||
1
exemple.txt
Normal file
1
exemple.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Regarde à gauche
|
||||||
25
install_slender.sh
Normal file
25
install_slender.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script will create a virtual microphone for PulseAudio to use and set it
|
||||||
|
# as the default device.
|
||||||
|
|
||||||
|
# Load the "module-pipe-source" module to read audio data from a FIFO special
|
||||||
|
# file.
|
||||||
|
echo "Creating virtual microphone."
|
||||||
|
pactl load-module module-pipe-source source_name=virtmic file=/home/faquin/audioFiles/virtmic format=s16le rate=16000 channels=1
|
||||||
|
|
||||||
|
# Set the virtmic as the default source device.
|
||||||
|
echo "Set the virtual microphone as the default device."
|
||||||
|
pactl set-default-source virtmic
|
||||||
|
|
||||||
|
# Create a file that will set the default source device to virtmic for all
|
||||||
|
# PulseAudio client applications.
|
||||||
|
echo "default-source = virtmic" > /home/faquin/.config/pulse/client.conf
|
||||||
|
|
||||||
|
# Write the audio file to the named pipe virtmic. This will block until the
|
||||||
|
# named pipe is read.
|
||||||
|
echo "Writing audio file to virtual microphone."
|
||||||
|
#while true; do
|
||||||
|
#cat audioFile0.raw > /home/faquin/audioFiles/virtmic
|
||||||
|
#done
|
||||||
|
|
||||||
10
test_input.py
Normal file
10
test_input.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import inputs
|
||||||
|
|
||||||
|
print(inputs.devices.gamepads)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
events = inputs.get_gamepad()
|
||||||
|
for event in events:
|
||||||
|
if "ABS" not in event.code and "REPORT" not in event.code :
|
||||||
|
print(event.ev_type, event.code, event.state)
|
||||||
|
|
||||||
6
uninstall_slender.sh
Normal file
6
uninstall_slender.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Uninstall the virtual microphone.
|
||||||
|
|
||||||
|
pactl unload-module module-pipe-source
|
||||||
|
rm /home/faquin/.config/pulse/client.conf
|
||||||
14
v2.sh
Normal file
14
v2.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#Load pulseaudio virtual audio source
|
||||||
|
#pulseaudio -D --disable-shm=yes --exit-idle-time=-1
|
||||||
|
|
||||||
|
# Create virtual output device (used for audio playback)
|
||||||
|
pactl load-module module-null-sink sink_name=DummyOutput sink_properties=device.description="Virtual_Dummy_Output"
|
||||||
|
|
||||||
|
# Create virtual microphone output, used to play media into the "microphone"
|
||||||
|
pactl load-module module-null-sink sink_name=MicOutput sink_properties=device.description="Virtual_Microphone_Output"
|
||||||
|
|
||||||
|
pacmd load-module module-virtual-source source_name=VirtualMic
|
||||||
|
pacmd load-module module-virtual-sink sink_name=VirtualSink
|
||||||
|
|
||||||
|
pacmd set-default-sink VirtualSink
|
||||||
|
pacmd set-default-source VirtualSink.monitor
|
||||||
Reference in New Issue
Block a user