nclib
August 22, 2024, 2:08pm
1
Hello everyone,
I am trying to set up a multicopter with tiltable arms (similar to a vtol with tiltrotor). However, I am not sure which plugin I should use in my .sdf file to control the arm tilt. Looking at other sdf files, maybe the plugin should be JointPositionController
, but I could not make sense out of its parameters when looking into the documentation.
In the QGroundControl GUI, actuators section, it shows the 4 servos (one for each arm) but when I test then, nothing happens to my model in gazebo. The other actuators work fine. Since I am able to interact with the servos in QGroundControl, I am assuming my mixer file is correct, and the problem lies in the communication between gazebo model and px4.
I am using PX4 and gz (not gazebo-classic).
I will add the code for the mixer and sdf below in the comments.
nclib
August 22, 2024, 2:11pm
2
# Set variables for Gazebo simulation
PX4_SIMULATOR=${PX4_SIMULATOR:=gz}
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=octo_cox_H}
param set-default SIM_GZ_EN 1
param set-default SENS_EN_GPSSIM 1
param set-default SENS_EN_BAROSIM 0
param set-default SENS_EN_MAGSIM 1
# Set vehicle airframe
param set-default CA_AIRFRAME 8
param set-default SYS_HAS_BARO 0
param set-default SYS_HAS_MAG 0
# Square quadrotor X with reverse turn direction
param set-default CA_ROTOR_COUNT 8
param set-default CA_ROTOR0_PX 0.295
param set-default CA_ROTOR0_PY 0.1725
param set-default CA_ROTOR0_PZ 0.05
param set-default CA_ROTOR0_TILT 1
param set-default CA_ROTOR0_KM 0.05
param set-default CA_ROTOR1_KM -0.05
param set-default CA_ROTOR1_PX 0.295
param set-default CA_ROTOR1_PY -0.1725
param set-default CA_ROTOR1_PZ 0.05
param set-default CA_ROTOR1_TILT 2
param set-default CA_ROTOR2_PX -0.295
param set-default CA_ROTOR2_PY -0.1725
param set-default CA_ROTOR2_PZ 0.05
param set-default CA_ROTOR2_TILT 3
param set-default CA_ROTOR2_KM 0.05
param set-default CA_ROTOR3_PX -0.295
param set-default CA_ROTOR3_PY 0.1725
param set-default CA_ROTOR3_PZ 0.05
param set-default CA_ROTOR3_TILT 4
param set-default CA_ROTOR3_KM -0.05
param set-default CA_ROTOR4_PX 0.295
param set-default CA_ROTOR4_PY -0.1725
param set-default CA_ROTOR4_TILT 2
param set-default CA_ROTOR4_PZ -0.05
param set-default CA_ROTOR4_KM 0.05
param set-default CA_ROTOR5_PX 0.295
param set-default CA_ROTOR5_PY 0.1725
param set-default CA_ROTOR5_PZ -0.05
param set-default CA_ROTOR5_TILT 1
param set-default CA_ROTOR5_KM -0.05
param set-default CA_ROTOR6_PX -0.295
param set-default CA_ROTOR6_PY 0.1725
param set-default CA_ROTOR6_PZ -0.05
param set-default CA_ROTOR6_TILT 4
param set-default CA_ROTOR6_KM 0.05
param set-default CA_ROTOR7_KM -0.05
param set-default CA_ROTOR7_PX -0.295
param set-default CA_ROTOR7_PY -0.1725
param set-default CA_ROTOR7_PZ -0.05
param set-default CA_ROTOR7_TILT 3
# Add tilt control
param set-default CA_SV_TL0_MAXA 45
param set-default CA_SV_TL0_MINA -45
param set-default CA_SV_TL0_TD 0
param set-default CA_SV_TL0_CT 1
param set-default CA_SV_TL1_MAXA 45
param set-default CA_SV_TL1_MINA -45
param set-default CA_SV_TL1_TD 0
param set-default CA_SV_TL1_CT 1
param set-default CA_SV_TL2_MAXA 45
param set-default CA_SV_TL2_MINA -45
param set-default CA_SV_TL2_TD 0
param set-default CA_SV_TL2_CT 1
param set-default CA_SV_TL3_MAXA 45
param set-default CA_SV_TL3_MINA -45
param set-default CA_SV_TL3_TD 0
param set-default CA_SV_TL3_CT 1
param set-default CA_SV_TL_COUNT 4
# Simulation parameters
param set-default SIM_GZ_EC_FUNC1 101
param set-default SIM_GZ_EC_FUNC2 102
param set-default SIM_GZ_EC_FUNC3 103
param set-default SIM_GZ_EC_FUNC4 104
param set-default SIM_GZ_EC_FUNC5 105
param set-default SIM_GZ_EC_FUNC6 106
param set-default SIM_GZ_EC_FUNC7 107
param set-default SIM_GZ_EC_FUNC8 108
param set-default SIM_GZ_SV_FUNC1 201
param set-default SIM_GZ_SV_FUNC2 202
param set-default SIM_GZ_SV_FUNC3 203
param set-default SIM_GZ_SV_FUNC4 204
param set-default SIM_GZ_EC_MIN1 150
param set-default SIM_GZ_EC_MIN2 150
param set-default SIM_GZ_EC_MIN3 150
param set-default SIM_GZ_EC_MIN4 150
param set-default SIM_GZ_EC_MIN5 150
param set-default SIM_GZ_EC_MIN6 150
param set-default SIM_GZ_EC_MIN7 150
param set-default SIM_GZ_EC_MIN8 150
param set-default SIM_GZ_SV_MIN1 -10
param set-default SIM_GZ_SV_MIN2 -10
param set-default SIM_GZ_SV_MIN3 -10
param set-default SIM_GZ_SV_MIN4 -10
param set-default SIM_GZ_EC_MAX1 2000
param set-default SIM_GZ_EC_MAX2 2000
param set-default SIM_GZ_EC_MAX3 2000
param set-default SIM_GZ_EC_MAX4 2000
param set-default SIM_GZ_EC_MAX5 2000
param set-default SIM_GZ_EC_MAX6 2000
param set-default SIM_GZ_EC_MAX7 2000
param set-default SIM_GZ_EC_MAX8 2000
param set-default SIM_GZ_SV_MAX1 10
param set-default SIM_GZ_SV_MAX2 10
param set-default SIM_GZ_SV_MAX3 10
param set-default SIM_GZ_SV_MAX4 10