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

Drone Controll Bios

Recommended Posts

Ok!!! :D Hello! So... I was going along. Coding more for the OpenComputer RFTools Dialing Program when I found out about DRONES! I immediately went and checked them out, and found out there "Basically the microcontrollers of robots." Witch I was sorta sad that you cant have a hard drive on them and so forth, Plus you only have a limited space in the bios that the drone runs on. Anyway, I wanted to find a way to run all the stuff remotely so the drone wouldn't have to do any of the processing. Like a separate computer would tell the drone what to do over a wireless network, but because I wanted it to work at whatever distance I then just used linked cards. This is the bios I use to run the drone: 

local d = component.proxy(component.list("drone")())
local t = component.proxy(component.list("tunnel")())
while true do
  local evt,_,sender,_,_,name,cmd,a,b,c = computer.pullSignal()
  if evt == "modem_message" and name == d.name() then
    if cmd == "gst" then
      t.send(d.name(),"gst",d.getStatusText())
    end
    if cmd == "sst" then
      t.send(d.name(),"sst",d.setStatusText(a))
    end
    if cmd == "mov" then
      d.move(a,b,c)
    end
    if cmd == "gos" then
      t.send(d.name(),"gos",d.getOffset())
    end
    if cmd == "gve" then
      t.send(d.name(),"gv",d.getVelocity())
    end
    if cmd == "gmv" then
      t.send(d.name(),"gmv",d.getMaxVelocity())
    end
    if cmd == "gac" then
      t.send(d.name(),"ga",d.getAcceleration())
    end
    if cmd == "sac" then
      d.setAcceleration(a)
    end
    if cmd == "glc" then
      t.send(d.name(),"glc",d.getLightColor())
    end
    if cmd == "slc" then
      d.setLightColor(a)
    end
    if cmd == "dct" then
      local b, s = d.detect(a)
      t.send(d.name(),"dct",b,s)
    end
    if cmd == "cmp" then
      t.send(d.name(),"c",d.compare(a))
    end
  end
end

LINK TO PASTEBIN: https://pastebin.com/cfgsdmQJ

So you would run and create the programs on a separate computer or tablet. This made it much easier for me to code it plus I get to use all my APIs! Here is the start of a drone control program:

local t = require("component").tunnel --or modem if thats what you use
local event = require("event")
function doDrone(dronename,dronecommand,arg1,arg2,arg3)
  t.send(dronename,dronecommand,arg1,arg2,arg3)
  _, _, _, _, _, name, command, respond1, respond2 = event.pull("modem_message")
  return {name, command, respond1, respond2}
end
doDrone("DAVE","mov",0,3,0) --this would make it move up there blocks!

All the commands, like "mov", and what arguments they need, and how they respond are in the drone control bios above! (One above the one above, so like two above)

I plan on adding support for all the drop components like navigation and such, Or you could do that yourself! :D 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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