Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- peripheral.find("modem", rednet.open)
- print(os.getComputerID())
- local id1 = 6 --MAIN ROTOR ID
- local id2 = 7 --TAIL ROTOR ID
- local monitor = peripheral.find("monitor")
- if monitor then
- print("Monitor connected")
- else
- print("Monitor NOT connected")
- end
- local con = peripheral.find("tweaked_controller")
- while true do
- local XAxis = con.getAxis(3)
- local YAxis = con.getAxis(4)
- local rYAxis = con.getAxis(2)
- local LTri = con.getAxis(5)
- local RTri = con.getAxis(6)
- local q = ship.getQuaternion()
- local w, x, y, z = q.w, q.x, q.y, q.z
- local siny_cosp = 2 * (w * y + x * z)
- local cosy_cosp = 1 - 2 * (y * y + z * z)
- local Cyaw = math.atan2(siny_cosp, cosy_cosp) * 180 / math.pi
- if Cyaw < 0 then
- Cyaw = Cyaw + 360
- end
- if rYAxis > 0 then
- XAxis = -XAxis
- YAxis = -YAxis
- end
- rednet.send(id1, Cyaw)
- rednet.send(id1, XAxis * -15)
- rednet.send(id1, YAxis * -15)
- rednet.send(id1, rYAxis * 15)
- rednet.send(id2, LTri * 15)
- rednet.send(id2, RTri * 15)
- if monitor then
- monitor.clear()--monitor out
- monitor.setCursorPos(1,1)
- monitor.write("CYaw: " .. Cyaw)
- monitor.setCursorPos(1,3)
- monitor.write("XAxis: " .. XAxis * 15)
- monitor.setCursorPos(1,4)
- monitor.write("YAxis: " .. YAxis * 15)
- monitor.setCursorPos(1,5)
- monitor.write("rYAxis: " .. rYAxis * 15)
- local id1, Byaw = rednet.receive()
- monitor.setCursorPos(1,2)
- monitor.write("Byaw: " .. Byaw)
- end
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment