diff --git a/drone_api/sample/rc.py b/drone_api/sample/rc.py index 20b7d818..15d5c940 100644 --- a/drone_api/sample/rc.py +++ b/drone_api/sample/rc.py @@ -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) diff --git a/drone_control/common/include/flight_controller_types.hpp b/drone_control/common/include/flight_controller_types.hpp index 9d6e6d08..148a4c04 100644 --- a/drone_control/common/include/flight_controller_types.hpp +++ b/drone_control/common/include/flight_controller_types.hpp @@ -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 @@ -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 /* @@ -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 diff --git a/hakoniwa/config/api_sample/drone_config_0.json b/hakoniwa/config/api_sample/drone_config_0.json index 133df75f..d431cc20 100644 --- a/hakoniwa/config/api_sample/drone_config_0.json +++ b/hakoniwa/config/api_sample/drone_config_0.json @@ -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 ], diff --git a/hakoniwa/config/rc/drone_config_0.json b/hakoniwa/config/rc/drone_config_0.json index b461acf4..54f27d50 100644 --- a/hakoniwa/config/rc/drone_config_0.json +++ b/hakoniwa/config/rc/drone_config_0.json @@ -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": {