Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

A Few More Questions Please.

So, i'm seeing a few autonomous projects floating around and I've got some ideas masked as questions masked as ideas.

What my ultimate goal is, is to have a robot that roams around 24/7 with the following causes.
I'd like it to roam around for 10 minutes then stop or even sleep (but stop would do) for 20 min the roam again for 10. Unless a sensor is triggered or its given a direct command,

Here's where the twist and questions come, I'm assuming that if it goes into sleep then the sensors would also sleep. So just stopping is acceptable but I'd ideally like to conserve as much power as possible. Does anyone have any input on this?

My 2nd question is, is there a time function or property you could use in a loop do facilitate the conditions.
I'm hoping to get an ez-b kit within a weeks time so I'm not super familiar with ezbuilders syntax yet but here's what I'm seeing in my head.

I imaging I can write a general roam and stop/sleep functions that I can pass a time to (either with a get time or milliseconds I don't really care how I have to do it) and just have to write little loops like this:

LOOP
roam for 10 min
10 min expires
goto stop/sleep loop
END LOOP

LOOP sleep/stop for 20 minutes unless tripped by sensor
roam for 30 seconds then
continue to sleep for rest of 20 min cycle or sleep for 10 min (just depends on what my options are)
20 min expires
goto roam for 10 loop
END LOOP


That's about as simple as I can make it. I'm aware the code itself will be much more in depth this is just an overview.
Next Question, if ARC doesn't have a way to do this, could I use c#'s time functions and write my code in c# instead of ezb's language?

I'm hoping to get an ezb within a weeks time. 2 tops and I want to be as prepared as possible to get my first project up and running asap so I can start thinking of more elaborate or specific useful function for my 2nd project,

Thanks in advance.

AI Support Bot
Related Content
Synthiam
United Kingdom
#1  
I've not yet had my morning coffee so this is going to be brief...

Time functions, they sure are there:) There are a bunch of global variables at your disposal, $time, $date, $day, $month, $year, $hour, $minute, $second are all there. So you could use those to check how long the process has been running...

A very quick and basic example, I'm sure it can be simplified or done better too but until my brain kicks in this is the best you'll get:)

Code:


$starttime = $minute
$endtime = $starttime + 10
If($endtime >= 60)
$endtime = $endtime - 60
EndIf

:loop
If($minute != $endtime)
# Roam
Else
# Just wait with sensors active
EndIf
Goto(loop)
United Kingdom
#2  
Right then, I'm awake properly now so let's see...

First, does it want to be exactly 10 minutes? A varied length will add to the illusion of life. Like my blink script I run on Melvin, the time between blinks is between x and y ms, the time the eyes are closed is also between x and y ms. It's a minor detail but they're what I like:)

Depending on how you script it will determine if the sensors turn off on "sleeping". Personally how I would tackle this is to have a script or routine for the sensors and the reactions when triggered, that script is called when it goes to sleep. Also another script which is the roaming script, which is called when it's time to roam. When one starts the other stops.

Strangely enough, the code isn't going to be as complex as you may think. It will basically be the loops and conditions. You could make it all one script, have a master loop at the start which checks the time and loops around the first routine for 10 minutes, then loops around the other routine for 20 minutes, then back to the first and so on. In that master loop you call the other scripts such as the roaming or the sensor checking.

Your code will basically be;

Code:


:roaming

# Get the current time
$starthour = $hour
$startminute = $minute

# Work out the end time
$endhour = $starthour
$endminute = $startminute + 10

# Make sure end minute doesn't exceed 59, if it does increase the hour by 1 and subtract 60 from the minute
If($endminute > 59)
$endminute = $endminute-60
$endhour = $endhour + 1
EndIf

:roamtimeloop
If($hour <= $endhour and $minute < $endminute)
# Ten minutes have not expired yet so carry on
Goto(roam)
# Set a return label if required
:roamreturn
Else
# Ten minutes have expired so sleep
Goto(sleeping)
EndIf
Goto(roamtimeloop)

:sleeping
# Get the current time
$starthour = $hour
$startminute = $minute

# Work out the end time
$endhour = $starthour
$endminute = $startminute + 20

# Make sure end minute doesn't exceed 59, if it does increase the hour by 1 and subtract 60 from the minute
If($endminute > 59)
$endminute = $endminute-60
$endhour = $endhour + 1
EndIf

:sleeptimeloop
If($hour <= $endhour and $minute < $endminute)
# Twenty minutes have not expired yet so carry on
Goto(sleep)
# Set a return label if required
:sleepreturn
Else
# Twenty minutes have expired so sleep
Goto(roaming)
EndIf
Goto(sleeptimeloop)

:roam
# Code for roaming
Goto(roamreturn)

:sleep
# Code for sleeping
Goto(sleepreturn)


Something like that. You may not need the labels and gotos for returning, Return() may work depending on your code, I have made it a habit to use this method now though since my problems on my ping roam code.
#3  
Thanks Rich, that's what I was hoping to hear. I'm a fan of modular programming concepts so the roaming and sensor loops are the way I'll probably go. 10 min was more of a reference point. Depending how I code it, it will either except a time in the function call or I'll define some variables to facilitate that part. Until I get my ezb and start getting my hands dirty all I can really do is theoreticals. I just want to be as prepared as possible for when the time comes.

Some one thought it wise to to bestow a credit card upon me this weekend so I should have it soon. I've found a few in stock in the US at the same price as listed on here so, that's why I'm thinking about a weeks time. Sorry DJ I know you guys have been swamped lately so I'm gonna get one that's already sitting on a shelf. I'm looking forward to getting your product in my hands ASAP. It's hard to explain but I have particular mail order formula in my head that considers cost+shipping , location and delivery time, then finally personal desire. So sometimes I'm looking for the best deal and sometimes I'm looking to get what I want as soon as possible. Except for insane shipping like over night and air mail and ect... I don't see the need for spending twice the shipping to get something a day or two early. The longest I'd ever waited for anything was 2 weeks from China and that was because I ordered during Winterfest but he was the only person who had what I wanted at a price I wanted to pay. I knew in advance that I'd be waiting 2 weeks at least. I honestly got it before I expected. I do personally prefer to purchase from the US just because of possible customs delays. Transformers collecting has granted me quite a bit of experience when it come to what we used to just call "Mail Ordering."

Now that I know, for the most part anyway, what I want my first robot to do, I'm eyeing up possible body parts now. I have a small erector set that's been in a box for years. We bought it for a nephew who had no interest in it so I'm thinking after 2 years or so it's safe to adopt him. I'll have to glue some cardboard or something to some of the plates just to avoid any metal on metal action with the ezboard itself. Another matter of, once I have it in my hands, it'll fall together on its own. I also have an, either V1 or V2 robosapien, I believe it's V1. My first step is to build the basic ez like in the tutorial vids just to have something to play with. I think programming the ezb is going to be fairly strait forward from what I've seen so far. I think I'll be contemplating body parts this week.

I've come up with alot of ideas from reading the threads and looking at alot of people's projects. I'm thinking I want to go to a tread/tank style base in the future but for starters I'm going to build the ez-tutorial bot then go from there. I've got tons of ideas. 1 is to use more of a rack and pinion type of steering with one servo (and gears) spinning the axel and another servo (with gears and rods to make up the rest of the mechanism) acting as, for lack of a better word, steering column. But I'll probably go treads/tank on my first redesign because......

Another idea I came up with was for climbing. I'm not sure how different robots handle the task but I was looking at Boris 2 and was wondering what if he comes up to something too tall for the treads to tackle, so I've envisioned a sort of pole vault system. Just a post/flag pole that is as centered as possible along the width axsis but slightly toward the front of the length axsis so it wont tip backward upon elevation. The theory is to keep pushing forward while the post lowers through the body to the ground to raise the front of the robot in the hopes that it will elevate the front enough to catch the edge of an obstacle and pull itself up and over. I'll have to do some testing to fine tune the speed of the post as it lowers and raises. I don't want it to catch on anything so I'm not sure if a slow decent with a fast assent will work or if I want it to 'pop' up the front end. Once again I'm just gonna have to wait till I can get my hands dirty.

Thanks again Rich, and everyone else for that matter. I can't wait to get my kit so I can communicate tech details with all of you better. I can not wait to see what the future brings us. I may just have to build a robot to stop Rich's Skynet ;-)
United Kingdom
#4  
You're OK, none of my robots have arms at the moment...

Modular programming is the best way, especially with the EZ-B since chances are you will make upgrades in the future and need to add in a function or action here or there. Plus I find it much easier to write the scripts and follow them that way.
PRO
Synthiam
#5  
I think there is a WaitUntilTime() function?

So with that you could also start and stop specific script controls based on the time.
#6  
Awesome, thanks alot guys. I appreciate all of the info. :-)