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

Detect Delay


Can I delay robot.detect()? At the moment, my robot trying to detect a block in front of it, but as I understand, it does this before it moves. So it detects nothing, this causes bug. Is there any way to delay detecting so it can detect after it moves?

Here is code btw:

Thanks in advance.

Share this post

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
7 hours ago, Molinko said:

robot.detect is synchronous. meaning it is executed in the order you call() it. Your code prob just has a bug.

I believe it is, but strangely it doesn't work like that. I might made a mistake, but at the moment I can't see it.  Can you configure and check it?



This is an example configuration. It moves forward when below block is same with the 1st slot, moves right when it is same with the 2nd. Normally it shouldn't move when it detects any block in front. But strangely, it doesn't see the block then moves to the right. That's why I thought it happens before moving is complete. It might be synchronous, but I'm not sure about does it wait for the movement to finish.


Okay, I got it fixed. I break the loop after checking the block below, so it doesn't overlap anymore. Thanks!

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.

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.


  • Create New...

Important Information

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