toppers / hakoniwa-px4sim

PX4-compatible drone simulation with physics-based modeling in C, visualizations via game engines, headless operation, and automated test scenarios. Supports external parameterization and MATLAB/Simulink integration.
40 stars 11 forks source link

離陸するには?(ubuntu22.04_install&operation_pythonAPI編.md) #409

Open yamati-kz opened 5 hours ago

yamati-kz commented 5 hours ago

@tmori さん こんにちは。 すみません、アドバイスいただけたらと思います。

PS4コントローラのXボタンを押してプロペラが回った後に左側JoyStickを操作しても離陸できません。 以前の手順を思い出しながら試したのですがうまく行かない状態です。2台のPCで試しましたがうまくいかないのは同じです。 ubuntu22.04.5LTSをクリーンインストール後、ubuntu22.04_install&operation_pythonAPI編.mdに沿ってインストールしています。 1.4.1. 箱庭コア機能の起動 , 1.4.2. Unityアプリの起動 , 1.4.4. PS4のコントローラでのドローン操作 の順に各アプリを起動しています。 1.4.3. sampleアプリの起動 では飛行して荷物も運べています。

以下に各Terminalのログを添付します。

#1.4.1. 箱庭コア機能の起動
ububtu@Lenovo:~$ cd ~/work/hakoniwa-px4sim/hakoniwa
ububtu@Lenovo:~/work/hakoniwa-px4sim/hakoniwa$ bash drone-app.bash ../../hakoniwa-unity-drone-model/DroneAppLinux ./config/api_sample
hakoniwa master is enabled
HAKO_CAPTURE_SAVE_FILEPATH : ./capture.bin
HAKO_BYPASS_IPADDR : 127.0.0.1
HAKO_CUSTOM_JSON_PATH : ../../hakoniwa-unity-drone-model/DroneAppLinux/custom.json
DRONE_CONFIG_PATH : ./config/api_sample
HAKO_BYPASS_PORTNO : 54001
INFO: LOADED drone config file: ./config/api_sample/drone_config_0.json
INFO: hako_master_init() success
INFO: setup start
DroneDynamicType: BodyFrame
INFO: logpath: ./drone_log0/drone_dynamics.csv
Rotor vendor: None
Thruster vendor: None
param_A: 8.30482e-07
param_B: 3e-08
param_Jr: 0
INFO: mixer is not enabled
INFO: loading drone & controller: 0
controller param path: ../drone_control/config/param-api.txt
SIMULATION_DELTA_TIME: 0.003
PID_ALT_CONTROL_CYCLE: 0
PID_ALT_MAX_POWER: 9.81
PID_ALT_MAX_SPD: 10
PID_ALT_THROTTLE_GAIN: 1
MASS: 0.71
GRAVITY: 9.81
PID_ALT_Kd: 1.5
PID_ALT_Ki: 0.1
PID_ALT_Kp: 10
PID_ALT_SPD_Kd: 0.1
PID_ALT_SPD_Ki: 0.1
PID_ALT_SPD_Kp: 5
SIMULATION_DELTA_TIME: 0.003
POS_CONTROL_CYCLE: 0
PID_POS_MAX_SPD: 20
PID_POS_X_Kd: 0.6
PID_POS_X_Ki: 0
PID_POS_X_Kp: 1
PID_POS_Y_Kd: 0.6
PID_POS_Y_Ki: 0
PID_POS_Y_Kp: 1
SPD_CONTROL_CYCLE: 0
PID_POS_MAX_ROLL: 10
PID_POS_MAX_PITCH: 10
PID_POS_VX_Kd: 0.1
PID_POS_VX_Ki: 0
PID_POS_VX_Kp: 20
PID_POS_VY_Kd: 0.1
PID_POS_VY_Ki: 0
PID_POS_VY_Kp: 20
SIMULATION_DELTA_TIME: 0.003
HEAD_CONTROL_CYCLE: 0
PID_YAW_RPM_MAX: 10
PID_YAW_Kd: 0
PID_YAW_Ki: 0
PID_YAW_Kp: 1.1
SIMULATION_DELTA_TIME: 0.003
ANGULAR_CONTROL_CYCLE: 0
PID_ROLL_RPM_MAX: 20
PID_PITCH_RPM_MAX: 20
PID_ROLL_Kd: 0
PID_ROLL_Ki: 0
PID_ROLL_Kp: 4
PID_PITCH_Kd: 0
PID_PITCH_Ki: 0
PID_PITCH_Kp: 4
ANGULAR_RATE_CONTROL_CYCLE: 0
PID_ROLL_TORQUE_MAX: 10
PID_PITCH_TORQUE_MAX: 10
PID_YAW_TORQUE_MAX: 10
PID_ROLL_RATE_Kd: 0
PID_ROLL_RATE_Ki: 0
PID_ROLL_RATE_Kp: 2
PID_PITCH_RATE_Kd: 0
PID_PITCH_RATE_Ki: 0
PID_PITCH_RATE_Kp: 2
PID_YAW_RATE_Kd: 0.1
PID_YAW_RATE_Ki: 0
PID_YAW_RATE_Kp: 1.1
SUCCESS: Loaded module name: DroneController
Initial state: Landed
Robot: DroneTransporter, PduWriter: DroneTransporter_drone_motor
channel_id: 0 pdu_size: 112
INFO: DroneTransporter create_lchannel: logical_id=0 real_id=0 size=112
Robot: DroneTransporter, PduWriter: DroneTransporter_drone_pos
channel_id: 1 pdu_size: 72
INFO: DroneTransporter create_lchannel: logical_id=1 real_id=1 size=72
Robot: DroneTransporter, PduWriter: DroneTransporter_drone_manual_pos_att_control
channel_id: 3 pdu_size: 80
INFO: DroneTransporter create_lchannel: logical_id=3 real_id=2 size=80
Robot: DroneTransporter, PduWriter: DroneTransporter_drone_cmd_takeoff
channel_id: 5 pdu_size: 64
INFO: DroneTransporter create_lchannel: logical_id=5 real_id=3 size=64
Robot: DroneTransporter, PduWriter: DroneTransporter_drone_cmd_move
channel_id: 6 pdu_size: 80
INFO: DroneTransporter create_lchannel: logical_id=6 real_id=4 size=80
Robot: DroneTransporter, PduWriter: DroneTransporter_drone_cmd_land
channel_id: 7 pdu_size: 64
INFO: DroneTransporter create_lchannel: logical_id=7 real_id=5 size=64
Robot: DroneTransporter, PduWriter: DroneTransporter_hako_cmd_game
channel_id: 8 pdu_size: 136
INFO: DroneTransporter create_lchannel: logical_id=8 real_id=6 size=136
Robot: DroneTransporter, PduWriter: DroneTransporter_hako_cmd_camera
channel_id: 9 pdu_size: 44
INFO: DroneTransporter create_lchannel: logical_id=9 real_id=7 size=44
Robot: DroneTransporter, PduWriter: DroneTransporter_hako_cmd_camera_move
channel_id: 11 pdu_size: 64
INFO: DroneTransporter create_lchannel: logical_id=11 real_id=8 size=64
Robot: DroneTransporter, PduWriter: DroneTransporter_hako_cmd_magnet_holder
channel_id: 13 pdu_size: 40
INFO: DroneTransporter create_lchannel: logical_id=13 real_id=9 size=40
WAIT START
WAIT RUNNING
START CREATE PDU DATA: total_size= 281620
PDU CREATED
Setup pdu data
INFO: start simulation
PDU DATA CREATED
CREATED ADDR=0x716b55cd400c
radio_control: 1
radio_control: 0
radio_control: 1
#1.4.2. Unityアプリの起動
ububtu@Lenovo:~/work/hakoniwa-unity-drone-model$ bash ./plugin/activate_app.bash DroneAppLinux
[UnityMemory] Configuration Parameters - Can be set up in boot.config
    "memorysetup-bucket-allocator-granularity=16"
    "memorysetup-bucket-allocator-bucket-count=8"
    "memorysetup-bucket-allocator-block-size=4194304"
    "memorysetup-bucket-allocator-block-count=1"
    "memorysetup-main-allocator-block-size=16777216"
    "memorysetup-thread-allocator-block-size=16777216"
    "memorysetup-gfx-main-allocator-block-size=16777216"
    "memorysetup-gfx-thread-allocator-block-size=16777216"
    "memorysetup-cache-allocator-block-size=4194304"
    "memorysetup-typetree-allocator-block-size=2097152"
    "memorysetup-profiler-bucket-allocator-granularity=16"
    "memorysetup-profiler-bucket-allocator-bucket-count=8"
    "memorysetup-profiler-bucket-allocator-block-size=4194304"
    "memorysetup-profiler-bucket-allocator-block-count=1"
    "memorysetup-profiler-allocator-block-size=16777216"
    "memorysetup-profiler-editor-allocator-block-size=1048576"
    "memorysetup-temp-allocator-size-main=4194304"
    "memorysetup-job-temp-allocator-block-size=2097152"
    "memorysetup-job-temp-allocator-block-size-background=1048576"
    "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
    "memorysetup-allocator-temp-initial-block-size-main=262144"
    "memorysetup-allocator-temp-initial-block-size-worker=262144"
    "memorysetup-temp-allocator-size-background-worker=32768"
    "memorysetup-temp-allocator-size-job-worker=262144"
    "memorysetup-temp-allocator-size-preload-manager=262144"
    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
    "memorysetup-temp-allocator-size-audio-worker=65536"
    "memorysetup-temp-allocator-size-cloud-worker=32768"
    "memorysetup-temp-allocator-size-gfx=262144"
# 1.4.4. PS4のコントローラでのドローン操作
ububtu@Lenovo:~/work/hakoniwa-px4sim/drone_api/sample$ python3 rc-custom.py ../../../hakoniwa-unity-drone-model/DroneAppLinux/custom.json rc_config/ps4-control-lnx.json
pygame 2.6.1 (SDL 2.28.4, Python 3.10.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
Controller:  rc_config/ps4-control-lnx.json
Mode:  2
Number of joysticks: 1
ジョイスティックの名前: Sony Interactive Entertainment Wireless Controller
ボタン数 : 13
INFO: Success for external initialization.
button event: switch_index=0 event_op_index=0 down: True event_triggered=True
button event: switch_index=0 event_op_index=0 down: False event_triggered=False
stick event: stick_index=1 op_index=1 event.value=-0.6078676717429121 stick_value=-0.10862393788948718
stick event: stick_index=1 op_index=1 event.value=-0.631397442548906 stick_value=-0.13196938051834645
stick event: stick_index=1 op_index=1 event.value=-0.6706137272255623 stick_value=-0.1584208023221179
stick event: stick_index=1 op_index=1 event.value=-0.7098300119022187 stick_value=-0.19118369922901654
stick event: stick_index=1 op_index=1 event.value=-0.7333597827082126 stick_value=-0.226458960282856
stick event: stick_index=1 op_index=1 event.value=-0.7647328104495377 stick_value=-0.262057403663311
stick event: stick_index=1 op_index=1 event.value=-0.7882625812555315 stick_value=-0.30119008212143855
stick event: stick_index=1 op_index=1 event.value=-0.8117923520615253 stick_value=-0.3395690817172594
stick event: stick_index=1 op_index=1 event.value=-0.8196356089968566 stick_value=-0.37156978194966356
stick event: stick_index=1 op_index=1 event.value=-0.8510086367381817 stick_value=-0.4080152392723312
stick event: stick_index=1 op_index=1 event.value=-0.8666951506088443 stick_value=-0.4414610172794147
stick event: stick_index=1 op_index=1 event.value=-0.8745384075441756 stick_value=-0.4711458629050161
stick event: stick_index=1 op_index=1 event.value=-0.8823816644795068 stick_value=-0.49639812536579064
stick event: stick_index=1 op_index=1 event.value=-0.8980681783501694 stick_value=-0.5254942500019136
stick event: stick_index=1 op_index=1 event.value=-0.9137546922208319 stick_value=-0.5495713929736409

お手数をおかけしてすみません。#407をチェックする前に、まずは修正前で動かそうとしています。

tmori commented 2 hours ago

多分、ここだと思われます。

bash drone-app.bash ../../hakoniwa-unity-drone-model/DroneAppLinux ./config/api_sample

ラジコン操作は、rcですね。

bash drone-app.bash ../../hakoniwa-unity-drone-model/DroneAppLinux ./config/rc