walk.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:srcsim2017 作者: ZarjRobotics 项目源码 文件源码
def create_xy_steps(self, movement, start_foot, stride=DEFAULT_STRIDE):
        """ Create a series of xy direction footsteps. """
        footsteps = []
        current_step = Vector3(0, 0, 0)
        foot = start_foot

        while current_step.x != movement.x or current_step.y != movement.y:
            if foot == start_foot:
                full_step = False
                d_x = movement.x - current_step.x
                d_y = movement.y - current_step.y
                if abs(d_x) > stride:
                    d_x = sign(d_x) * stride
                    full_step = True
                if abs(d_y) > stride:
                    d_y = sign(d_y) * stride
                    full_step = True

                current_step.x += d_x
                current_step.y += d_y

                footsteps.append(
                    self.create_one_footstep(foot, [current_step.x,
                                                    current_step.y, 0.0],
                                             world=True))
                if not full_step:
                    break
            else:
                footsteps.append(
                    self.create_one_footstep(foot, [current_step.x,
                                                    current_step.y, 0.0],
                                             world=True))
            foot = invert_foot(foot)

        foot = invert_foot(foot)
        footsteps.append(self.create_one_footstep(foot, [current_step.x,
                                                         current_step.y, 0.0],
                                                  world=True))

        return footsteps
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号