Skip to content

Commit

Permalink
fix #216
Browse files Browse the repository at this point in the history
  • Loading branch information
tmori committed May 14, 2024
1 parent d7d40e9 commit 775aaf4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 42 deletions.
1 change: 1 addition & 0 deletions drone_api/sample/rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def main():
joystick.init()
# connect to the HakoSim simulator
client = hakosim.MultirotorClient(sys.argv[1])
client.default_drone_name = "DroneTransporter"
client.confirmConnection()
client.enableApiControl(True)
client.armDisarm(True)
Expand Down
48 changes: 9 additions & 39 deletions drone_control/common/include/flight_controller_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
* Position Control
*/
#define PID_PARM_POSX_Kp 1.5
#define PID_PARM_POSX_Ki 0.3
#define PID_PARM_POSX_Ki 0.01
#define PID_PARM_POSX_Kd 2.0
#define PID_PARM_POSY_Kp 1.5
#define PID_PARM_POSY_Ki 0.3
#define PID_PARM_POSY_Ki 0.01
#define PID_PARM_POSY_Kd 2.0
#define PID_PARAM_MAX_SPD 20.0
#define POS_CONTROL_CYCLE (SIMULATION_DELTA_TIME * 10) //33.3Hz
Expand All @@ -49,37 +49,15 @@
/*
* Speed Control
*/
#ifdef RADIO_CONTROL_ON
#define PID_PARAM_V_BASE 10.0
#else
#define PID_PARAM_V_BASE 10.0
#endif
#define PID_PARM_VX_Kp PID_PARAM_V_BASE
#ifdef RADIO_CONTROL_ON
#define PID_PARM_VX_Ki 0.0
#else
#define PID_PARM_VX_Ki 0.1
#endif
#ifdef RADIO_CONTROL_ON
#define PID_PARM_VX_Kd PID_PARAM_V_BASE * 2
#else
#define PID_PARM_VX_Kd PID_PARAM_V_BASE
#endif
#define PID_PARM_VY_Kp PID_PARAM_V_BASE
#ifdef RADIO_CONTROL_ON
#define PID_PARM_VY_Kp PID_PARAM_V_BASE * 2
#define PID_PARM_VY_Ki 0.0
#else
#define PID_PARM_VY_Ki 0.1
#endif
#ifdef RADIO_CONTROL_ON
#define PID_PARM_VY_Kd PID_PARAM_V_BASE * 2
#define PID_PARAM_MAX_ROLL 8
#define PID_PARAM_MAX_PITCH 8
#else
#define PID_PARM_VY_Kd PID_PARAM_V_BASE
#define PID_PARAM_MAX_ROLL 5
#define PID_PARAM_MAX_PITCH 5
#endif
#define SPD_CONTROL_CYCLE (SIMULATION_DELTA_TIME * 10) //33.3Hz

/*
Expand All @@ -91,26 +69,18 @@

#define PID_PARM_ANGLE_BASE 40.0
#define PID_PARM_ROLL_Kp PID_PARM_ANGLE_BASE
#ifdef RADIO_CONTROL_ON
#define PID_PARM_ROLL_Ki 0.0
#else
#define PID_PARM_ROLL_Ki 0.1
#endif
#define PID_PARM_ROLL_Kd PID_PARM_ANGLE_BASE
#define PID_PARM_PITCH_Kp PID_PARM_ANGLE_BASE
#ifdef RADIO_CONTROL_ON
#define PID_PARM_PITCH_Ki 0.0
#else
#define PID_PARM_PITCH_Ki 0.1
#endif
#define PID_PARM_PITCH_Kd PID_PARM_ANGLE_BASE

#define PID_PARM_ROLL_RATE_Kp 0.001
#define PID_PARM_ROLL_RATE_Ki 0.0001
#define PID_PARM_ROLL_RATE_Kd 0.001
#define PID_PARM_PITCH_RATE_Kp 0.001
#define PID_PARM_PITCH_RATE_Ki 0.0001
#define PID_PARM_PITCH_RATE_Kd 0.001
#define PID_PARM_ROLL_RATE_Kp 0.0045
#define PID_PARM_ROLL_RATE_Ki 0.3
#define PID_PARM_ROLL_RATE_Kd 0.0045
#define PID_PARM_PITCH_RATE_Kp 0.0045
#define PID_PARM_PITCH_RATE_Ki 0.3
#define PID_PARM_PITCH_RATE_Kd 0.0045
#define PID_PARM_YAW_RATE_Kp 0.01
#define PID_PARM_YAW_RATE_Ki 0.001
#define PID_PARM_YAW_RATE_Kd 0.01
Expand Down
2 changes: 1 addition & 1 deletion hakoniwa/config/api_sample/drone_config_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"physicsEquation": "BodyFrame",
"collision_detection": true,
"manual_control": false,
"airFrictionCoefficient": [ 0.02, 0.0 ],
"airFrictionCoefficient": [ 0.05, 0.0 ],
"inertia": [ 0.0000625, 0.00003125, 0.00009375 ],
"mass_kg": 0.1,
"body_size": [ 0.1, 0.1, 0.01 ],
Expand Down
4 changes: 2 additions & 2 deletions hakoniwa/config/rc/drone_config_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
"physicsEquation": "BodyFrame",
"collision_detection": true,
"manual_control": false,
"airFrictionCoefficient": [ 0.02, 0.0 ],
"airFrictionCoefficient": [ 0.05, 0.0 ],
"inertia": [ 0.0000625, 0.00003125, 0.00009375 ],
"mass_kg": 0.1,
"body_size": [ 0.1, 0.1, 0.01 ],
"position_meter": [ 0, 0, 0 ],
"position_meter": [ 0, 5, 0 ],
"angle_degree": [ 0, 0, 0 ]
},
"rotor": {
Expand Down

0 comments on commit 775aaf4

Please sign in to comment.