1
0
mirror of https://github.com/osmarks/random-stuff synced 2025-12-18 11:58:07 +00:00

add CC projects

This commit is contained in:
2023-11-13 19:37:05 +00:00
parent 94b4db7549
commit a507315ad2
114 changed files with 11478 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
local ni = peripheral.wrap "back"
package.path = "/?;/?.lua;" .. package.path
local gps_patch = require "gps_patch"
local estimated_position = vector.new(gps_patch.locate())
local function integrate_motion()
local lt = os.clock()
while true do
local meta = ni.getMetaOwner()
local v = vector.new(meta.deltaPosX, meta.deltaPosY, meta.deltaPosZ)
--if math.floor(os.clock()) == os.clock() then print("vel", v) end
local time = os.clock()
local dt = time - lt
estimated_position = estimated_position + v
--estimated_position = channelwise(round_to_frac, estimated_position, meta.withinBlock)
lt = time
end
end
local function compare_against_gps()
while true do
local pos = vector.new(gps_patch.locate())
print("delta", pos - estimated_position)
sleep(1)
end
end
parallel.waitForAll(integrate_motion, compare_against_gps)