def to_step_action(self): action = atlas.behavior_step_action_t() action.swing_height = self.step_height action.step_duration = self.bdi_step_duration action.sway_duration = self.bdi_sway_duration if self.terrain_pts.shape[1] >= 2: max_step_height = max(self.terrain_pts[1,0], self.terrain_pts[1,-1]) action.lift_height = max(self.terrain_pts[1,:]) - max_step_height + self.bdi_lift_height action.lift_height = min(action.lift_height, MAX_LIFT_HEIGHT); else: action.lift_height = self.bdi_lift_height action.lift_height = max(action.lift_height, 0.01) # A lift height of 0 is ignored by the API, so we'll replace it with a very small but nonzero value (1cm). action.toe_off = self.bdi_toe_off action.knee_nominal = self.bdi_knee_nominal action.max_body_accel = self.bdi_max_body_accel action.max_foot_vel = self.bdi_max_foot_vel action.sway_end_dist = self.bdi_sway_end_dist action.step_end_dist = self.bdi_step_end_dist return action
def to_step_action(self): action = atlas.behavior_step_action_t() action.swing_height = self.step_height action.step_duration = self.bdi_step_duration action.sway_duration = self.bdi_sway_duration if self.terrain_pts.shape[1] >= 2: max_step_height = max(self.terrain_pts[1, 0], self.terrain_pts[1, -1]) action.lift_height = max(self.terrain_pts[ 1, :]) - max_step_height + self.bdi_lift_height action.lift_height = min(action.lift_height, MAX_LIFT_HEIGHT) else: action.lift_height = self.bdi_lift_height action.lift_height = max( action.lift_height, 0.01 ) # A lift height of 0 is ignored by the API, so we'll replace it with a very small but nonzero value (1cm). action.toe_off = self.bdi_toe_off action.knee_nominal = self.bdi_knee_nominal action.max_body_accel = self.bdi_max_body_accel action.max_foot_vel = self.bdi_max_foot_vel action.sway_end_dist = self.bdi_sway_end_dist action.step_end_dist = self.bdi_step_end_dist return action
def blank_step_spec(): msg = atlas.behavior_step_spec_t() msg.foot = atlas.behavior_foot_data_t() msg.action = atlas.behavior_step_action_t() return msg