We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D maze in browser controlled by Small Basic
#51
I am always ready to help in any good deed.  Angel

Here's the graph I got today on my Microsoft Surface Pro tablet:
   
I think this means we won't be able to use step-by-step technology to control a robot.
Most likely, the absolute error in making one 90 degree turn will be less than the total error from nine 10 degree turns.  Undecided

What do you feel about it?
Reply
#52
You are right, we will not be able to achieve exact rotation at all, the best will be to within maybe around 10 degrees, similar for forwards movement.  So the little step-by-step approach is that we rotate or move in the smallest possible step in the direction we want to head, and incrementally update this and go slowly where we want.  This is what I did in the code I shared.  Note that after each small step I update where we actually are (or how much rotated) and work out how to turn or move from where I am, so the errors are not compounde, I just keeep updating, which is why I put a good sized delay after each small step to ensure all movement is finished before I reassess how to move next.

However, you have found that the tollerance is roughly constant and therefore we can move or rotate a larger a amount in a single step (with similar accuracy) rather than using lots of small steps as I did.  This would make the robot faster than I had it.
Reply
#53
Added https://litdev.uk/apps/maze3D/settings.html which can be used to create your own maze
[-] The following 3 users Like litdev's post:
  • AbsoluteBeginner, stevantosic, z-s
Reply
#54
In that case, let's move on.  Wink
Reply
#55
I have one technical question.  Undecided

If Timer sends "get" requests to the server in a parallel thread, then we cannot send our "set" requests from the user interface thread.
Otherwise, if two threads send their requests to the server at the same time, this may lead to errors.

Do I understand all of this correctly?  Blush
Reply
#56
Yes partly, but different users could also be sending to the server at the same time and the browser window(s) are also sending and receiving continuously to the server.

The change I mentioned in the post #41 was to with this - what it does is queue up server requests and handles them one a time in the order they appear at the server, so you are OK to send requests from any thread.

So there is no issue from the server's point of view, but if you use Timer threads you cannot be sure of the order of requests with respect to calls made on the UI thread, so my later examples moved away from using the Timer thread and uses the logic I mentioned in post #44.
Reply
#57
Thank you very much.  Smile

I like this.
Reply
#58
Updated so that if 2 or more users are present at the same time they can be seen.  This should also work using the 'name' feature in settings running with 2 different browsers.  This is a precursor towards some environment where AI SB controlled robots can interact or compete in some way - once they can move reasonably of course.
[-] The following 1 user Likes litdev's post:
  • AbsoluteBeginner
Reply
#59
This will be very great!  Cool
Reply
#60
Tinkering again Smile , added control variables (rotate and forward), they take change in angle (degrees) and forwards distance (in current direction).  There are a lot of controls with the interaction stuff I was working on I did a full set of tests and I think fixed a couple issues recently introduced may all be OK now.

The following is example using the new controls.

Code:
  LDNetwork.SendWebRequest(urlSet+"&animate="+dir) 'Valid values of dir are 0, 90, 180 & 270

'New methods - note we can rotate by other angles and longer distances

  LDNetwork.SendWebRequest(urlSet+"&rotate="+(dir-data["angle"])) 'dir is new absolute angle
  Program.Delay(1000)
  LDNetwork.SendWebRequest(urlSet+"&forward=1")
[-] The following 2 users Like litdev's post:
  • AbsoluteBeginner, stevantosic
Reply


Forum Jump:


Users browsing this thread: 36 Guest(s)