Guest User

Body

a guest
Aug 24th, 2025
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. peripheral.find("modem", rednet.open)
  2. print(os.getComputerID())
  3.  
  4. local id1 = 6 --MAIN ROTOR ID
  5. local id2 = 7 --TAIL ROTOR ID
  6.  
  7. local monitor = peripheral.find("monitor")
  8. if monitor then
  9. print("Monitor connected")
  10. else
  11. print("Monitor NOT connected")
  12. end
  13.  
  14. local con = peripheral.find("tweaked_controller")
  15.  
  16. while true do
  17. local XAxis = con.getAxis(3)
  18. local YAxis = con.getAxis(4)
  19. local rYAxis = con.getAxis(2)
  20. local LTri = con.getAxis(5)
  21. local RTri = con.getAxis(6)
  22.  
  23. local q = ship.getQuaternion()
  24. local w, x, y, z = q.w, q.x, q.y, q.z
  25.  
  26. local siny_cosp = 2 * (w * y + x * z)
  27. local cosy_cosp = 1 - 2 * (y * y + z * z)
  28. local Cyaw = math.atan2(siny_cosp, cosy_cosp) * 180 / math.pi
  29.  
  30. if Cyaw < 0 then
  31. Cyaw = Cyaw + 360
  32. end
  33.  
  34. if rYAxis > 0 then
  35. XAxis = -XAxis
  36. YAxis = -YAxis
  37. end
  38.  
  39. rednet.send(id1, Cyaw)
  40. rednet.send(id1, XAxis * -15)
  41. rednet.send(id1, YAxis * -15)
  42. rednet.send(id1, rYAxis * 15)
  43. rednet.send(id2, LTri * 15)
  44. rednet.send(id2, RTri * 15)
  45.  
  46.  
  47. if monitor then
  48. monitor.clear()--monitor out
  49. monitor.setCursorPos(1,1)
  50. monitor.write("CYaw: " .. Cyaw)
  51.  
  52. monitor.setCursorPos(1,3)
  53. monitor.write("XAxis: " .. XAxis * 15)
  54. monitor.setCursorPos(1,4)
  55. monitor.write("YAxis: " .. YAxis * 15)
  56. monitor.setCursorPos(1,5)
  57. monitor.write("rYAxis: " .. rYAxis * 15)
  58.  
  59. local id1, Byaw = rednet.receive()
  60. monitor.setCursorPos(1,2)
  61. monitor.write("Byaw: " .. Byaw)
  62. end
  63.  
  64. sleep(0)
  65. end
  66.  
  67.  
Advertisement
Add Comment
Please, Sign In to add comment