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

Issues involving autorun

Question

Hi there,

I've been messing around with some basic robots and autorun.lua.

My aim was to be able to plug a floppy disk into a robot, start the robot up and have the robot copy the program that would be stored on the floppy disk.

Once the file was on the internal drive, the robot would run it.

The idea was that I'd be able to set the robot's functionality by hotswapping floppy disks.

 

Trouble is, the robot autorun hasn't really been behaving.

When I run the program in the shell, it works every time. However, when the robot starts up it works... sometimes.

The program I told it to run just tells it to turn left - but it only does that every second boot or so (not in a regular pattern)

I've been trying to figure out why this is happening for a while now and I still don't understand it!

 

I sent the program to sleep for a few seconds to see what goes on during initialisation and found this

https://imgur.com/a/WA7SK

SpoooOOoky!

 

My best guess at the moment for why it's acting up is the usage of os.execute()

Although it still isn't particularly consistent with other parts of the program

 

https://pastebin.com/9DeP5fng

Here's some source code so you can have a clue what I'm on about!

Oh and the robot is a collection of tier one parts with a floppy drive.

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 1
  • Solution

AFAIK, the autorun stuff in OC is somewhat finicky and is likely to be redone in the future. I would recommend using the RC system (writing a service) that listens for component change events for the floppy drive and then copies the file and executes it when one occurs. That would also allow you to use the robot without a floppy by entering code into the lua console on it, as RC services don't block execution. There are a few services here (like this OpenPrinters print server) that you can use as an example.

Link to post
Share on other sites
  • 0
On 2/25/2018 at 2:38 AM, BrisingrAerowing said:

AFAIK, the autorun stuff in OC is somewhat finicky and is likely to be redone in the future. I would recommend using the RC system (writing a service) that listens for component change events for the floppy drive and then copies the file and executes it when one occurs. That would also allow you to use the robot without a floppy by entering code into the lua console on it, as RC services don't block execution. There are a few services here (like this OpenPrinters print server) that you can use as an example.

Apologies for the (very) late response - got caught up in irl things somewhat!

Although it saddens me that autorun isn't behaving the way it's meant to, it's certainly going to stop me tearing my hair out trying to figure out what I did wrong :)

I'll try to figure out how to write the service as you describe and see how I can progress from there - thank you very much for your help!

Link to post
Share on other sites
  • 0
On 3/7/2018 at 5:39 AM, BrisingrAerowing said:

They aren't all that difficult. They need 'start' and 'stop' methods at a minimum. Any event handler should be registered using event.listen to keep it nonblocking.

Seeing as documentation is rather hard to come by for RC, I had a lengthy and highly enjoyable Easter egg hunt trying to figure out how it works - getting so far as to successfully replace autorun with it :D

Thank you for all the help!

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
Answer this question...

×   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.