Commit 75e832ddc992958102d487495aa4a190fb328a59

Fine tuning the joystick ui
Joystick-UI.hs
(7 / 7)
  
3030 port_handle <- attach "/dev/ttyS0"
3131 geometry <- loadArmConfig "AL5A.config"
3232
33 let move x = Robot.move port_handle (positionToServoMove geometry x 0.3)
33 let move x = Robot.move port_handle (positionToServoMove geometry x 0.15)
3434
3535 let initPos = Pos 150 100 0 (pi/2) 0.5 0
3636 loop pos@Pos{..} = do
3737 buttons <- mapM (getButton stick . fromIntegral) [0..buttonsAvailable stick-1]
3838 axes <- mapM (getAxis stick . fromIntegral) [0..axesAvailable stick-1]
3939 >>= return.map ((/32768) . fromIntegral)
40 let newPos = pos{posX=posX+(axes !! 1)*(-20)
41 ,posY=posY+(axes !! 3)*(-20)
42 ,posAngle=posAngle+(axes !! 0)*(-pi/20)
43 ,wrist=wrist + (axes !! 2)*(pi/20)
40 let newPos = pos{posX=posX+(axes !! 1)*(-7)
41 ,posY=posY+(axes !! 3)*(-7)
42 ,posAngle=posAngle+(axes !! 0)*(-pi/60)
43 ,wrist=wrist + (axes !! 2)*(pi/60)
4444 ,posWristAngle = posWristAngle + if buttons !! 4
45 then (pi/20)
45 then (pi/60)
4646 else 0
4747 + if buttons !! 6
48 then (-pi/20)
48 then (-pi/60)
4949 else 0
5050 ,gripper=if buttons !! 5 then 0.3 else 0.8}
5151 print newPos