v0.1.4
This commit is contained in:
@@ -19,7 +19,7 @@ from robogauge.utils.logger import logger
|
||||
class Go2(BaseRobot):
|
||||
def __init__(self, cfg: Go2Config):
|
||||
super().__init__(cfg)
|
||||
self.max_velocity_cmd = np.array(cfg.control.max_velocity_cmd, dtype=np.float32)
|
||||
self.cmd_range = cfg.commands
|
||||
self.default_dof_pos = np.array(cfg.control.default_dof_pos, dtype=np.float32)
|
||||
self.last_action = np.zeros(self.num_action, dtype=np.float32)
|
||||
self.action_scale = cfg.control.scales.action
|
||||
@@ -35,8 +35,11 @@ class Go2(BaseRobot):
|
||||
dof_pos = (sim_proprio.joint.pos - self.default_dof_pos) * self.cfg.control.scales.dof_pos
|
||||
dof_vel = sim_proprio.joint.vel * self.cfg.control.scales.dof_vel
|
||||
|
||||
cmd = np.array(goal_data.velocity_goal.lin_vel[:2] + goal_data.velocity_goal.ang_vel[2:3], np.float32)
|
||||
cmd = np.minimum(np.maximum(cmd, -self.max_velocity_cmd), self.max_velocity_cmd)
|
||||
goal = goal_data.velocity_goal
|
||||
cmd = np.array([goal.lin_vel_x, goal.lin_vel_y, goal.ang_vel_yaw], dtype=np.float32)
|
||||
cmd = np.minimum(np.maximum(cmd, np.array([self.cmd_range.lin_vel_x[0], self.cmd_range.lin_vel_y[0], self.cmd_range.ang_vel_yaw[0]], dtype=np.float32)),
|
||||
np.array([self.cmd_range.lin_vel_x[1], self.cmd_range.lin_vel_y[1], self.cmd_range.ang_vel_yaw[1]], dtype=np.float32))
|
||||
|
||||
cmd *= self.cfg.control.scales.cmd
|
||||
|
||||
obs[:3] = ang_vel
|
||||
|
||||
@@ -20,6 +20,7 @@ class Go2Config(RobotConfig):
|
||||
class control(RobotConfig.control):
|
||||
device = 'cpu'
|
||||
torch_script_model_path = "{ROBOGAUGE_ROOT_DIR}/resources/models/go2/go2_cts_83501.pt"
|
||||
# torch_script_model_path = "{ROBOGAUGE_ROOT_DIR}/resources/models/go2/go2_cts_cmd-1,1_38k.pt"
|
||||
control_dt = 0.02 # 50 Hz
|
||||
control_type = 'P' # Position control
|
||||
|
||||
@@ -30,7 +31,6 @@ class Go2Config(RobotConfig):
|
||||
num_observations = 45
|
||||
num_actions = 12
|
||||
|
||||
max_velocity_cmd = [1.5, 1.0, 2.0]
|
||||
default_dof_pos = [0.1, 0.8, -1.5, -0.1, 0.8, -1.5,
|
||||
0.1, 1.0, -1.5, -0.1, 1.0, -1.5]
|
||||
|
||||
@@ -45,6 +45,10 @@ class Go2Config(RobotConfig):
|
||||
cmd = [2.0, 2.0, 0.25]
|
||||
|
||||
class commands(RobotConfig.commands):
|
||||
lin_vel_x = [-1, 1] # min max [m/s]
|
||||
lin_vel_x = [-1.5, 1.5] # min max [m/s]
|
||||
lin_vel_y = [-1, 1] # min max [m/s]
|
||||
ang_vel_yaw = [-1, 1] # min max [rad/s]
|
||||
lin_vel_z = None # min max [m/s]
|
||||
ang_vel_roll = None # min max [rad/s]
|
||||
ang_vel_pitch = None # min max [rad/s]
|
||||
ang_vel_yaw = [-2, 2] # min max [rad/s]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user