diff --git a/demo/demo.bash b/demo/demo.bash index 763afe6c..ed022f56 100644 --- a/demo/demo.bash +++ b/demo/demo.bash @@ -85,6 +85,7 @@ function activate_vreal() function adjust_initial_pos() { CONFIG_PATH=`pwd`/demo/xr_config.json + cp ${CONFIG_PATH} ${HAKONIWA_VREAL_PATH}/ar-demo/ AR_DEVICE_IPADDR=`jq -r '.server_url' ${CONFIG_PATH} | awk -F: '{print $1}'` CURR_DIR=`pwd` cd $HAKONIWA_VREAL_PATH @@ -128,17 +129,16 @@ sleep 1 activate_vreal -sleep 1 - -echo "Pleaser Enter key after clicking START button..." -read +sleep 5 +hako-cmd start -sleep 1 if [ ${ACT_MODE} = "ar-demo" ] then + sleep 1 echo "START ADJUST INITIAL POSITION" adjust_initial_pos else + sleep 1 echo "START CAMERA" camera_control fi @@ -147,12 +147,5 @@ sleep 1 echo "START RADIO CONTROL" radio_control -echo "START" -while true; do - echo "Press ENTER to stop..." - read input - if [ -z "$input" ]; then - kill_process - break - fi -done +kill_process + diff --git a/demo/xr_config.json b/demo/xr_config.json index 6362a225..2f4f5ac7 100644 --- a/demo/xr_config.json +++ b/demo/xr_config.json @@ -2,9 +2,9 @@ "server_url": "192.168.2.101:54002", "client_url": "192.168.2.100:54001", "position": [ - -1.0900000000000003, - 0.99, - 1.1 + 0.5, + 0.5, + 0 ], "rotation": [ 0, diff --git a/drone_api/sample/rc_config/Nintendo-ProControl-lnx.json b/drone_api/sample/rc_config/Nintendo-ProControl-lnx.json new file mode 100644 index 00000000..92235a0e --- /dev/null +++ b/drone_api/sample/rc_config/Nintendo-ProControl-lnx.json @@ -0,0 +1,82 @@ +{ + "Os": [ "Darwin" ], + "mode": 2, + "stick": { + "Left": { + "UD": { + "index": 1, + "average": true, + "valueInverse": false, + "conversion": { + "paramA": 0.9, + "paramB": 0.1, + "paramC": 0.0 + } + }, + "LR": { + "index": 0, + "average": true, + "valueInverse": false, + "conversion": { + "paramA": 0.9, + "paramB": 0.1, + "paramC": 0.0 + } + } + }, + "Right": { + "UD": { + "index": 3, + "average": true, + "valueInverse": false, + "conversion": { + "paramA": 0.9, + "paramB": 0.1, + "paramC": 0.0 + } + }, + "LR": { + "index": 2, + "average": true, + "valueInverse": false, + "conversion": { + "paramA": 0.9, + "paramB": 0.1, + "paramC": 0.0 + } + } + } + }, + "Event": { + "RadioControlEnable": { + "index": 0, + "type": "switch", + "off": "up", + "on": "down" + }, + "Camera": { + "index": 3, + "type": "push", + "off": "up", + "on": "down" + }, + "GrabBaggage": { + "index": 1, + "type": "toggle", + "off": "up", + "on": "down" + }, + "CameraMoveUp": { + "index": 5, + "type": "switch", + "off": "up", + "on": "down" + }, + "CameraMoveDown": { + "index": 6, + "type": "switch", + "off": "up", + "on": "down" + } + } +} diff --git a/drone_api/sample/rc_debug/rc_control.py b/drone_api/sample/rc_debug/rc_control.py index dff27564..c38b5a49 100644 --- a/drone_api/sample/rc_debug/rc_control.py +++ b/drone_api/sample/rc_debug/rc_control.py @@ -8,6 +8,8 @@ joystick.init() print('ジョイスティックの名前:', joystick.get_name()) print('ボタン数 :', joystick.get_numbuttons()) + print("ジョイスティック数 : " + str(joystick.get_numaxes())) + print("十字キー数 : " + str(joystick.get_numhats())) except pygame.error: print('ジョイスティックが接続されていません') @@ -18,28 +20,14 @@ active = False if e.type == pygame.locals.JOYHATMOTION: - if e.value[0] == 0: - if e.value[1] == 1: - print("十字キー:上") - elif e.value[1] == 0: - print("十字キー:ー") - else: - print("十字キー:下") - elif e.value[0] == 1: - if e.value[1] == 0: - print("十字キー:右") - elif e.value[1] == 1: - print("十字キー:右上") - else: - print("十字キー:右下") - else: - if e.value[1] == 0: - print("十字キー:左") - elif e.value[1] == 1: - print("十字キー:左上") - else: - print("十字キー:左下") - + if e.value[0] > 0: + print("十字キー 右", e.value[0]) + if e.value[0] < 0: + print("十字キー 左", e.value[0]) + if e.value[1] > 0: + print("十字キー 上", e.value[1]) + if e.value[1] < 0: + print("十字キー 下", e.value[1]) elif e.type == pygame.locals.JOYAXISMOTION: if e.axis == 0 or e.axis == 1: if e.value == 0.0 or e.value == 1.0 or e.value == -1.0: @@ -62,4 +50,3 @@ print('ボタン押す {0}'.format(e.button)) elif e.type == pygame.locals.JOYBUTTONUP: print('ボタン離す {0}'.format(e.button)) -