joystick.py 文件源码

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

项目:joysix 作者: niberger 项目源码 文件源码
def __init__(self):
        self.ser = serial.Serial('/dev/ttyACM0', 9600)

        #geometrical calibration
        self.rs = [50, 50, 50]
        self.ls = [95, 130, 95]
        self.pot_rad_per_unit = 1./3000.*math.pi
        angles = [2./3.*math.pi, 0., -2./3.*math.pi]

        #placements of the 3 joysticks
        self.placements = []
        #attach point on the ball
        self.attach_ps = []
        for r,l,a in zip(self.rs, self.ls, angles):
            p_init = pose.exp(col([0, 0, 0, 0, 0, -(r+l)]))
            p_rot = pose.exp(col([0, a, 0, 0, 0, 0]))
            placement = p_rot * p_init
            self.placements.append(placement)
            attach_p = placement * col([0, 0, l])
            self.attach_ps.append(attach_p)

        #last calculated pose in logarithmic coordinates
        self.last_x = col([0, 0, 0, 0, 0, 0])
        #definition of the numerical solver
        f = lambda x: self.getValuesFromPose(pose.exp(x))
        self.solver = solver.Solver(f)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号