diff --git a/examples/basic_usage.py b/examples/basic_usage.py index 6663442..244c8a4 100644 --- a/examples/basic_usage.py +++ b/examples/basic_usage.py @@ -60,7 +60,7 @@ # An instance of the simulator can be generated as follows: sim_instance = Environment(vehicle=Multirotor(quad_params), # vehicle object, must be specified. controller=SE3Control(quad_params), # controller object, must be specified. - trajectory=TwoDLissajous(), # trajectory object, must be specified. + trajectory=ThreeDCircularTraj(radius=np.array([3, 3, 0]), freq=np.array([0.15, 0.15, 0])), # trajectory object, must be specified. wind_profile=SinusoidWind(), # OPTIONAL: wind profile object, if none is supplied it will choose no wind. sim_rate = 100, # OPTIONAL: The update frequency of the simulator in Hz. Default is 100 Hz. imu = None, # OPTIONAL: imu sensor object, if none is supplied it will choose a default IMU sensor. diff --git a/pyproject.toml b/pyproject.toml index 1739412..3c18591 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "rotorpy" -version = "2.1.2" +version = "2.1.3" description = "A multirotor simulator with aerodynamics for education and research." readme = "README.md" requires-python = ">=3.8" diff --git a/rotorpy/controllers/quadrotor_control.py b/rotorpy/controllers/quadrotor_control.py index 9d8e05c..559310e 100644 --- a/rotorpy/controllers/quadrotor_control.py +++ b/rotorpy/controllers/quadrotor_control.py @@ -58,8 +58,8 @@ def __init__(self, quad_params): # Gains self.kp_pos = np.array([6.5,6.5,15]) self.kd_pos = np.array([4.0, 4.0, 9]) - self.kp_att = 544 - self.kd_att = 46.64 + self.kp_att = quad_params.get("kp_att", 310) + self.kd_att = quad_params.get("kd_att", 57.0) self.kp_vel = 0.1*self.kp_pos # P gain for velocity controller (only used when the control abstraction is cmd_vel) # Linear map from individual rotor forces to scalar thrust and vector @@ -207,13 +207,13 @@ def __init__(self, batch_params, num_drones, device, kp_pos=None, kd_pos=None, k else: self.kd_pos = kd_pos.to(self.device).double() if kp_att is None: - self.kp_att = torch.tensor([544], device=device).repeat(num_drones, 1).double() + self.kp_att = batch_params.kp_att.to(self.device).double() else: self.kp_att = kp_att.to(self.device).double() if len(self.kp_att.shape) < 2: self.kp_att = self.kp_att.unsqueeze(-1) if kd_att is None: - self.kd_att = torch.tensor([46.64], device=device).repeat(num_drones, 1).double() + self.kd_att = batch_params.kd_att.to(self.device).double() else: self.kd_att = kd_att.to(self.device).double() if len(self.kd_att.shape) < 2: diff --git a/rotorpy/vehicles/crazyflie_params.py b/rotorpy/vehicles/crazyflie_params.py index 7dae478..b796ac1 100644 --- a/rotorpy/vehicles/crazyflie_params.py +++ b/rotorpy/vehicles/crazyflie_params.py @@ -58,10 +58,10 @@ 'rotor_speed_max': 2500, # rad/s 'motor_noise_std': 0.0, # rad/s - # Lower level controller properties (for higher level control abstractions) + # Lower level controller properties 'k_w': 200, # The body rate P gain (for cmd_ctbr) 'k_v': 10, # The *world* velocity P gain (for cmd_vel) - 'kp_att': 1030, # The attitude P gain (for cmd_vel, cmd_acc, and cmd_ctatt) - 'kd_att': 51, # The attitude D gain (for cmd_vel, cmd_acc, and cmd_ctatt) + 'kp_att': 310, # The attitude P gain (for cmd_vel, cmd_acc, and cmd_ctatt) + 'kd_att': 57.0, # The attitude D gain (for cmd_vel, cmd_acc, and cmd_ctatt) }