Resolved by Rich!

## Technical Specs

Hi Folks, I am currently working on a thesis which i will need to demonstrate to my lecturers. I am currently using the previous version of the EZ kits. I need the technical specification of the kits which i will need to state but i cannot find it here. Can someone help by giving me the technical specs of the previous version of the EZ-robot kits? Thank you

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

#2

That's awesome , my little brother did a report and project on ez robot and 3d printing. He said the school was blown away.

#3

Thanks Richy, That was very helpful. I think i am bit outdated. I am still using the EZ B and most of the information i need can not be found here. I am so much grateful Rich.

#4

One more help Richy, I want to program the EZ B together with the servos and the ultrasonic sensor to avoid obstacle. This will be in a constant loop in motion so that when the sensor senses any obstacle in a predefined range lets say 70cm, 47cm, 20cm and 10cm. when there's no obstacle the speed of the servo will be 100. When an obstacle is detected 70cm when the speed is 100 it should slow down to let us say 80. When the speed is at 80 and it senses an obstacle within a range of 47cm the speed should be reduced to 50. At 50 and still approaching an obstacle with range 20 cm it should reduce the speed to 30. And completely stop when it is less than 10cm. This is some kind of anti collision system. Can you help me with the EZ-Scripting. I will be very much grateful.

United Kingdom
#5

That sounds simple to achieve.

The first thing you will want to do is work out the distance based on the ping reading. The GetPing() command will return a value from 0 to 255, the higher the value the further away the object is. I believe the sensor which come with the EZ-B Complete Kit (V3) was a 1:1 ratio if measuring in inches.

Once you have worked that out you need to have the script check each value in the correct order. It's no use checking for an object at 100cm or less away before checking if there is one at 20cm as it'll say yes and ignore the 20cm code.

So, with some calculations I figure that, if 255 on the ping sensor is 255 inches then; 70cm = 27.6 (or rounded to 28) 47cm = 18.5 (or rounded to 19) 20cm = 7.9 (or rounded to 8) 10cm = 3.9 (or rounded to 4)

A slight deviation from the topic but at this point (before I forget to mention it) I would suggest using a shorter range sensor to increase accuracy.

Now we have the values we need to script it to do something with those values. I like to make things easy to edit so I'll throw those distances in to variables;

``````# Distances
\$very_far = 28
\$far = 19
\$near = 8
\$very_near = 4
``````

This makes it easier to adjust in the future or if you share it with others who need different distances.

Next we need to make the script get the distance and store that as a variable also;

``````# Distances
\$very_far = 28
\$far = 19
\$near = 8
\$very_near = 4

# Get the distance
\$distance = GetPing(D6,D7)
``````

This assumes the sensor is on D6 and D7

Next we do the IFs so that it'll run the correct code under the specific conditions;

``````# Distances
\$very_far = 28
\$far = 19
\$near = 8
\$very_near = 4

# Get the distance
\$distance = GetPing(D6,D7)

# Check the distance
IF(\$distance &lt;= \$very_near)
# Code for very near
ELSEIF(\$distance &lt;= \$near)
# Code for near
ELSEIF(\$distance &lt;= \$far)
# Code for far
ELSEIF(\$distance &lt;= \$very_far)
# Code for very far
ELSE
# Code for no detection (if required)
ENDIF
``````

We then make that loop constantly by adding a label, a sleep and a goto;

``````# Distances
\$very_far = 28
\$far = 19
\$near = 8
\$very_near = 4

# Looping label
:loop

# Get the distance
\$distance = GetPing(D6,D7)

# Check the distance
IF(\$distance &lt;= \$very_near)
# Code for very near
ELSEIF(\$distance &lt;= \$near)
# Code for near
ELSEIF(\$distance &lt;= \$far)
# Code for far
ELSEIF(\$distance &lt;= \$very_far)
# Code for very far
ELSE
# Code for no detection (if required)
ENDIF

# Sleep to reduce load on EZ-B and PC (adjust to suit, lower = more accurate, higher = less demand)
SLEEP(100)

# Loop back to the begining
GOTO(loop)

``````

And that's the main part of the script done. There is an alternative method where you could use Ping_Wait() however if you are using four different distances then this wouldn't work well (for one distance Ping_Wait() is ideal, as seen in my latest Ping Roam script in the intelligent turning scripting).

Now it's just a case of filling in the code for the specific conditions/distances.

There are various commands which can do this and they do depend on what is being used to move the robot. Since I like to make people work a little I'll leave it for you to find the script command to change the ServoSpeed() of a modified servo or PWM() of a H-Bridge. (Although if you get stuck again just ask and I'll jump back on it).

#6

Oh! Thanks Richy. You are the don.

#7

Richie can you please help me with one string of code to move the servo motor. It seems i am not able to make it work.

United Kingdom
#8

Move it how?

Servo(DigitalPort, Position) is probably the command you require but it depends on what you are doing.

#9

I did that but it couldn't respond.# Distances \$very_far = 28 \$far = 19 \$near = 8 \$very_near = 0

:loop

# Get the distance

\$distance = GetPing(D0,D1)

# Check the distance

IF(\$distance <= \$very_far) Servo(D2, 28)

ELSEIF(\$distance <= \$far) Servo(D2, 19)

ELSEIF(\$distance <= \$near) Servo(D2, 8)

# Code for near

ELSEIF(\$distance <= \$very_near) ServoSpeed (D2, 4)

# Code for very near

ELSE Servo(D2, 100)

ENDIF

SLEEP(100)

# Loop back to the begining

GOTO(loop)

United Kingdom
#10

Which port is the servo connected to? What position do you need it to move to?

The Servo() command should work, if it doesn't check the servo actually works and is connected correctly to the correct port. Also check your script to make sure it is processing the command. If you post your project I'll gladly check over the script.

#11

If you are using constant rotation serves you would use the command Move (servoPort, forward/stop/reverse)... so Move (D1, forward) is one example on driving a constant rotation servo on D1 forward..... Otherwise use Rich's example to move a regular servo...