<aside> 💡 조립은 잘 완료하셨나요?! 😕 조립 등 실제 로봇에서 발생되는 여러 문제점들은 22강에서 다시 한 번 다뤄질 예정이니 너무 스트레스받지 않으셔도 좋습니다. 😇

</aside>

끝나지 않은 Calibration 🧐

로봇 조립을 완료한 이후, 해당 코드를 실행시킨 뒤 수평을 잡아주세요!!

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/253e0e8d-41f0-4b6a-9f5a-a644c0b05e37/Untitled.png

servo_controller.py

# [0]~[2] : 왼쪽 앞 다리 // [3]~[5] : 오른쪽 앞 다리 // [6]~[8] : 왼쪽 뒷 다리 // [9]~[11] : 오른쪽 뒷 다리
# centered position perpendicular to the ground
self._servo_offsets = [170, 85, 90, 1, 95, 90, 172, 90, 90, 1, 90, 95]

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/30e1fde0-58f8-4241-9d18-1f91d36dac62/Untitled.png

제자리 보행

def main(id, command_status):
    jointAngles = []
    while True:
        xr = 0.0
        yr = 0.0
    
        ir=xr/(math.pi/180)
        
        d=time.time()-rtime

        # robot height
        height = 40

        # calculate robot step command from keyboard inputs
        result_dict = command_status.get()
        print(result_dict)
        command_status.put(result_dict)

        # wait 3 seconds to start
        if result_dict['StartStepping']:
            currentLp = trotting.positions(d-3, result_dict)
            robot.feetPosition(currentLp)
        else:
            robot.feetPosition(Lp)
        roll=0
        robot.bodyRotation((roll,math.pi/180*((joy_x)-128)/3,-(1/256*joy_y-0.5)))
        bodyX=50+yr*10
        robot.bodyPosition((bodyX, 40+height, -ir))

        # Get current Angles for each motor
        jointAngles = robot.getAngle()
        print(jointAngles)
        
        # First Step doesn't contains jointAngles
        if len(jointAngles):
            # Real Actuators
            controller.servoRotate(jointAngles)
            
            # # Plot Robot Pose into Matplotlib for Debugging
            # TODO: Matplotplib animation
            # kn.initFK(jointAngles)
            # kn.plotKinematics()

        robot.step()
        consoleClear()

이전에 실습했던 t값들이 있다면 다시 한 번 실제 로봇을 가지고 실습해보세요!!!