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

Creating a Move library

Recommended Posts

Hi guys,

I started playing with OCC again and putting the videos on YouTube. I'd love to get some feedback from you guys and some pointers on what to do next. Check it out here:
 

 

Share this post


Link to post
Share on other sites

I love that you're posting OC videos on youtube! Definitely not enough content out there to enjoy . I would suggest a perhaps more simple handler for the list of movements though.

-- # The almighty lookup table
local actions = {
  f = robot.forward,
  b = robot.back,
  u = robot.up,
  d = robot.down,
  tl = robot.turnLeft,
  tr = robot.turnRight,
  ta = function() -- # turn around 
         local status, reason
         for i = 1, 2 do
           status, reason = robot.turnLeft()
           if not status then break end
         end
         return status, reason
       end,
  s = robot.swing,
  su = robot.swingUp,
  sd = robot.swingDown,
  ...
}

function move.act(act)
  if not actions[act] then return false, "Undefined act" end
  return actions[act]()
end

 

Share this post


Link to post
Share on other sites

Thanks! That looks so much better, I think as of the 3rd episode I have something like this:
 

actions['f'] = robot.forward
....

Any idea on projects to work on? Other than creating an army remotely controlled robot which I'll definitely do sooner or later.

Share this post


Link to post
Share on other sites

I think some form of navigation library and server would be great. Imagine a robot or drone wants to go somewhere in your base. You could write a server that calculates a path from point 'A' to point 'B' and serves a path string (like the one your library uses) back to the robot/drone. Maybe have the server update knowledge of the base layout with a robot / drone using a geolyzer so it can give clear paths to clients. It's a mouthful but could keep other programs very simple and would be very reusable.

Share this post


Link to post
Share on other sites

Hey!

Thanks for the tutorial. I learned a lot from it!

Unfortunately I had problems to access the library functions from the main program. This was because the name "move" for the lib doesn't work. I changed the libs name to "movebot" and now everything works fine.

My OC version is 1.7.4.153

Maybe this information helps others with the same problem.

gl&hf

Share this post


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.