m_carmunk.py 文件源码

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

项目:Multi-Agent_SelfDriving 作者: MLJejuCamp2017 项目源码 文件源码
def __init__(self, r, x, y, space, width, height, goal, goal2, car_radius=25, agentId=0, color=0):
        self.color = color # 0:green, 1:red
        self.agentId = agentId
        self.car_radius = car_radius
        self.space = space
        self.width = width
        self.height = height
        self.vmax = 200
        self.redGoal = goal[0]
        self.greenGoal = goal[1]
        self.eRedGoal = goal2[0]
        self.eGreenGoal = goal2[1]

        mass = 1
        inertia = pymunk.moment_for_circle(mass, 0, 14, (0, 0))
        self.car_body = pymunk.Body(mass, inertia)
        self.car_body.position = x, y
        self.car_shape = pymunk.Circle(self.car_body, car_radius)
        if self.color == 0:
            self.car_shape.color = THECOLORS["green"]
        else:
            self.car_shape.color = THECOLORS["red"]
        self.space.add(self.car_body, self.car_shape)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号