I am new to EZ and am wondering if I can have the Ultrasonic sensor detect distances while the EZ is moving, not in between movement. So far the closest thing I am able to do is move then sense, but sometimes during the movement I go past my desired sensor value.
Upgrade to ARC Pro
Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!
Each control in ARC is a separate thread. The software was developed with that in mind - to enable each behavior to run asynchronous my of each other. Communication between controls is done with the ControlCommand() in Ez-script.
Do not confuse behavior with actions. An action is the final result of what a robot is doing (i.e. Moving, talking, etc). The skill controls produce actions.
So, in short... Every control is a separate thread which means you can have separate actions and scripts running at the same time.
That script does lots of things at the same time, without issue.
I guess I should explain my scenario. I am currently teaching a grade 11 robotics course and we have set up a maze for the robots to solve (we have the educational 3 pack).
In short, we are having the six robot:
- detect a color on the wall using the camera,
- turn left or right depending on the color,
- Walk forward until i reaches the next color post using the ultrasonic for distance
- repeat until finished
As usual, my students are better at this stuff than me, so I have shown them this thread and they already have some new ideas. One of them is especially excited by Rich's response, so thanks you!
I guess this leads me to another question: Does anyone have a link to, or know of good project idea/challenges I could give my class to complete?
Here's an idea....
1) Teach the robot each color using Multi Color
2) Enable Multi Color tracking
3) Write a script like this... In the example below, the robot starts to move forward. It checks the distance sensor in the loop. If the distance is less than the specified distance (i.e. reaches a wall) then check the color. The color is pre-configured as a Multi Color. If the color is Red, turn right. If the color is green, right left. The turning happens for 3 seconds (3000 milliseconds). Finally, start walking again.
Here is a recommendation. There is a variable to see if the color is being detected, it's $CameraIsTracking. Anyway, i would check that variable when as well in the distance condition. This way, if the variable is not set that means it isn't detecting a color. Do something, such as start turning until there is nothing in front of it -or- start turning until it sees a color.
Here is a video example of one of the exercises - the robot is modified to "pick up cotton balls" and place them into their respective matching colored bowls. The robot is controlled by a joystick - but can also be autonomous.
It is possible to program the robot to automatically pick up a color and place it in the respective bowl - one step at a time