diff --git a/aerial_gym/config/robot_config/base_quad_config.py b/aerial_gym/config/robot_config/base_quad_config.py index 4ecfcfe..95730eb 100644 --- a/aerial_gym/config/robot_config/base_quad_config.py +++ b/aerial_gym/config/robot_config/base_quad_config.py @@ -168,16 +168,16 @@ class control_allocator_config: ] class motor_model_config: - use_rps = True + use_rps = False motor_thrust_constant_min = 0.00000926312 motor_thrust_constant_max = 0.00001826312 - motor_time_constant_increasing_min = 0.09 - motor_time_constant_increasing_max = 0.12 + motor_time_constant_increasing_min = 0.03 + motor_time_constant_increasing_max = 0.03 - motor_time_constant_decreasing_min = 0.03 - motor_time_constant_decreasing_max = 0.05 + motor_time_constant_decreasing_min = 0.04 + motor_time_constant_decreasing_max = 0.04 max_thrust = 2 min_thrust = 0 @@ -185,5 +185,5 @@ class motor_model_config: max_thrust_rate = 100000.0 thrust_to_torque_ratio = 0.01 use_discrete_approximation = ( - False # Setting to false will compute f' based on difference and time constant + True # Setting to false will compute f' based on difference and time constant ) diff --git a/aerial_gym/control/motor_model.py b/aerial_gym/control/motor_model.py index ae5bef7..4eda4bf 100644 --- a/aerial_gym/control/motor_model.py +++ b/aerial_gym/control/motor_model.py @@ -10,8 +10,12 @@ def __init__(self, num_envs, motors_per_robot, dt, config, device="cuda:0"): self.cfg = config self.device = device self.num_motors_per_robot = motors_per_robot - self.max_thrust = self.cfg.max_thrust - self.min_thrust = self.cfg.min_thrust + self.max_thrust = torch.tensor(self.cfg.max_thrust, device=self.device, dtype=torch.float32).expand( + self.num_envs, self.num_motors_per_robot + ) + self.min_thrust = torch.tensor(self.cfg.min_thrust, device=self.device, dtype=torch.float32).expand( + self.num_envs, self.num_motors_per_robot + ) self.motor_time_constant_increasing_min = torch.tensor( self.cfg.motor_time_constant_increasing_min, device=self.device ).expand(self.num_envs, self.num_motors_per_robot) @@ -118,9 +122,6 @@ def reset_idx(self, env_ids): self.motor_thrust_constant[env_ids] = torch_rand_float_tensor( self.motor_thrust_constant_min, self.motor_thrust_constant_max )[env_ids] - self.first_order_linear_mixing_factor[env_ids] = self.mixing_factor_function( - self.dt, self.motor_time_constants - )[env_ids] def reset(self): self.reset_idx(torch.arange(self.num_envs, device=self.device)) diff --git a/aerial_gym/robots/base_multirotor.py b/aerial_gym/robots/base_multirotor.py index 1d76643..31cdc08 100644 --- a/aerial_gym/robots/base_multirotor.py +++ b/aerial_gym/robots/base_multirotor.py @@ -199,6 +199,7 @@ def reset_idx(self, env_ids): self.robot_state[env_ids, 10:13] = random_state[env_ids, 10:13] self.controller.randomize_params(env_ids=env_ids) + self.control_allocator.reset_idx(env_ids) # update the states after resetting because the RL agent gets the first state after reset self.update_states() diff --git a/aerial_gym/robots/robot_manager.py b/aerial_gym/robots/robot_manager.py index 6c2ec05..2d2fe42 100644 --- a/aerial_gym/robots/robot_manager.py +++ b/aerial_gym/robots/robot_manager.py @@ -436,6 +436,9 @@ def add_robot_to_env( props["stiffness"][j_index] = self.cfg.reconfiguration_config.stiffness[ j_index ] + props["damping"][j_index] = self.cfg.reconfiguration_config.damping[ + j_index + ] elif self.cfg.reconfiguration_config.dof_mode == "velocity": props["driveMode"].fill(gymapi.DOF_MODE_VEL) for j_index in range(len(props["damping"])):