Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Gorzoid

Members
  • Content Count

    111
  • Joined

  • Last visited

  • Days Won

    22

Posts posted by Gorzoid

  1. So my school has a webfilter to stop people beating the snake during class(cus that always happens), I decided to look at what was on the forums when this popped up in my face...

    42ff742e22dacb6308c7c35b169b7613.png

    does this website some history that I don't know about?

  2. I am not a OpenComputers programmer i just like to play around with open computers and opencomputers programs so can you please tell me how i can get this working?

     Ehh this is quite old, not sure if it works, but I think you need to download the file at https://gist.github.com/fnuecke/6bcbd66910b946b54ec7 and use the flash command to flash that file onto an eeprom (you can see how on the drones tutorial here https://www.youtube.com/watch?v=W5JTRKdup7s) then download this and save to client.lua

    make sure a wireless card is on the drone and the computer and u also need a motion sensor on the computer.

    once you have done that you should be able to turn on the drone and then run the program, be sure to edit the client.lua to set the positions of the motion sensor and drone otherwise it will not move to u properly

  3. I am already playing on a survival minecraft server with Open Computers, but I am wondering if anyone is hosting a creative server for people who just want to make cool creations with OC. If there is post here please, or if it's private tell me how I could join.

  4. Changed it up, it now uses navigation upgrade instead of motion sensor so you can now walk anywhere and drone will follow as long as you are close enough to both it and a labled waypoint. Sadly though it is alot laggier because of the delay in navigation.findWaypoints() I could implement code to use it less frequently by translating positions of waypoints after moving but for now this is fine.

    Code:

     

    EEPROM:

    --Follow Script EEPROM
    
    local PORT_FOLLOW = 0xbf01
    local MAX_DIST = 100
    
    local drone = component.proxy(component.list("drone")())
    local modem = component.proxy(component.list("modem")())
    local nav = component.proxy(component.list("navigation")())
    
    modem.open(PORT_FOLLOW)
    
    local function findClient()
    	while true do
    		local evt,_,sender,port,dist,msg = computer.pullSignal()
    		if evt == "modem_message" and port == PORT_FOLLOW and dist < MAX_DIST and msg == "FOLLOW_REQUEST_LINK" then
    			drone.setStatusText("Linked: "..sender:sub(1,3))
    			modem.send(sender,port,"FOLLOW_LINK")
    			return sender
    		end
    	end
    end
    
    local function getNearbyNodes(justLabels)
    	local waypoints = nav.findWaypoints(MAX_DIST)
    	local nodes = {}
    	for i = 1,waypoints.n do
    		if justLabels then
    			nodes[i] = waypoints[i].label
    		else
    			local wp = waypoints[i]
    			nodes[wp.label] = wp.position
    		end
    	end
    	return nodes
    end
    
    local client,nodes,noResponse = findClient(),getNearbyNodes()
    local timeout = computer.uptime() + 10
    
    while true do
    	local evt,_,sender,port,dist,msg,label,ox,oy,oz = computer.pullSignal(timeout - computer.uptime())
    	if moving and drone.getOffset() < 0.5 then
    		moving = false
    		nodes = getNearbyNodes()
    	end
    	if not evt then
    		if noResponse then
    			return
    		end
    		noResponse = true;
    		modem.send(client,PORT_FOLLOW,"HEARTBEAT_REQUEST")
    		timeout = timeout + 1
    	elseif evt == "modem_message" and sender == client and port == PORT_FOLLOW and dist < MAX_DIST then
    		if msg == "HEARTBEAT_RESPONSE" then
    			noResponse = false
    		elseif msg == "HEARTBEAT_REQUEST" then
    			modem.send(sender,port,"HEARTBEAT_RESPONSE")
    		elseif msg == "POS_UPDATE" and not moving then
    			local node = nodes[label]
    			if not node then
    				modem.send(sender,port,"UPDATE_NODES",label,table.unpack(getNearbyNodes(true)))
    			else
    				drone.move(node[1] - ox, node[2] - oy, node[3] - oz)
    				moving = true
    				modem.send(sender,port,"OK")
    			end
    		end
    		timeout = computer.uptime() + 10
    	end
    end
    

    Client

    --Follow Script Client
    
    local PORT_FOLLOW = 0xbf01
    
    local component = require("component")
    local event = require("event")
    local os = require("os")
    
    local modem = component.modem
    local nav = component.navigation
    
    modem.open(PORT_FOLLOW)
    
    local function findDrone()
    	modem.broadcast(PORT_FOLLOW,"FOLLOW_REQUEST_LINK")
    	local _,_,sender,port,_,msg = event.pull("modem_message",nil,nil,PORT_FOLLOW,nil,"FOLLOW_LINK")
    	return sender
    end
    
    local drone = findDrone()
    
    local function heartbeatHook(_,_,sender,port,_,msg)
    	if sender == drone and port == PORT_FOLLOW and msg == "HEARTBEAT_REQUEST" then
    		modem.send(sender,port,"HEARTBEAT_RESPONSE")
    	end
    end
    
    
    event.listen("modem_message",heartbeatHook)
    
    modem.send(drone,PORT_FOLLOW,"POS_UPDATE")
    local nodes = {select(7,event.pull("modem_message",nil,drone,PORT_FOLLOW,nil,"UPDATE_NODES"))}
    
    local function getNode()
    	local tbl = nav.findWaypoints(100)
    	for i=1,tbl.n do
    		local label = tbl[i].label
    		for i2=1,#nodes do
    			if label == nodes[i2] then
    				return label,table.unpack(tbl[i].position)
    			end
    		end
    	end
    end
    
    while true do
            local label,x,y,z = getNode()
            print(label,x,y,z)
    	modem.send(drone,PORT_FOLLOW,"POS_UPDATE",label,x,y,z)
    	local args = {select(6,event.pull("modem_message",nil,drone,PORT_FOLLOW,nil))}
    	if table.remove(args,1) == "UPDATE_NODES" then
    		nodes = args
    	end
    	os.sleep(0.1)
    end
    

     

     

    Instructions for install:

    1. Insert an empty eeprom into your computer
    2. edit /dev/eeprom
    3. Paste the eeprom code and save.
    4. Paste the client code into either /usr/ or your mounted disk drive if you are using floppy disk of openos.
    5. Create a drone with navigation upgrade and wireless network card and the eeprom you made. (If you already have drone put it in crafting grid with your eeprom)

    Instructions for use:

    1. Start drone first
    2. Then open client
    3. Done. (You gotta use Ctrl+Alt+C to escape because I am lazy)

     

    Tell me what you guys would prefer?

    • Motion sensors with limited range and portability but good accuracy and good speed.
    • Navigation getPosition with very good range, medium portability and good speed.
    • Navigation waypoints with good range, very high portability, and bad speed.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.