Israel
Asked — Edited

A Circle Script?

Hello there!

I have 2 servos: One for X axis and another for Y axis.

I am trying to build a script that will make the arm move in a perfect circle form, but having trouble with transforming a circle formula into the EZ script syntax.

Can you please help me?

Thanks, Roi


ARC Pro

Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

#1  

I've been running this through my head and I'm not sure you can create a perfect circle with two servos and EZ-Script. It would look more like a diamond. Someone with more experience can correct me on this, but I believe you can only move one servo at a time.

Your problem made me think of the old Etch A Sketch toy. Drawing a circle on the Etch A Sketch was nearly impossible without moving both wheels at the same time.

You could get close, though. I think you need a script that increments each servo by one step, then switches the direction based on the apex of each quadrant. A simple idea on this would be to tell the servos: Up, Left, Up, Left, Up, Left, Up, Up, Right, Up, Right, Up, Right, Up, Right, Up, Right, Right, Down, Right, Down, etc. You'd have to work out the pattern, but that's the gist of it.

You could use parameters to gauge when to switch the direction of the servo. I'd think you'd need two parameters for servo direction (one for X, the other for Y) and a parameter to count the completed steps in each quadrant. Then you'd probably have four code loops. The first loop would run for a certain number of steps, reset the count parameter and update one of the direction parameters, then it would go to the next loop. The second and third loop would do the same. The fourth loop would just stop after the final step is counted.

I really wish I had an Etch A Sketch to attach two servos to so I could help test this with you. Its late, so my brain is turning to mush. I'll try to put a sample code together in the next day or so, if my rambling isn't clear enough.:)

#2  

Thanks Mc, Will be waiting to see what you come up with.

Wouldn't using a circles formula (with Sqrt and Power functions and loops and all) + using the Round function, get us closer to a sort of pixelated circle, rather than a diamond shape?

United Kingdom
#3  

I don't have time at the moment to do much but maybe this website could be of some use to you...

#4  

I assume you are using a standard pan/tilt bracket for a shoulder joint?

PRO
Synthiam
#5  

Try this...

EZScript-Functions-SINCOS.EZB


# This is the starting degree (must be less than end degree)
$degStart = 0

# This is the ending degrees (must be greater than start degree)
$degEnd = 360

# This is the circle diameter
$diameter = 20

:loop

$deg = ($degStart / (180 / $pi))

$xPos = 50 + (Cos($deg) * $diameter)
$xPos = Round($xPos, 0)

$yPos = 50 + (Sin($deg) * $diameter)
$yPos = Round($yPos, 0)

Servo(d0, $xPos)
Servo(d1, $yPos)

sleep(100)

IF ($degStart = $degEnd)
  halt()
ENDIF 

$degStart++
  
goto(Loop)

#6  

Thursday, 11 April 2013

Good Morning EZ-Robot Mouseketeers !

This is a Perfect Example of the EZ-Robot Kindergarten that I have been hoping for !

The Beauty of ARC is almost INSTANT PRODUCTIVITY ! @Rich and @DJ have recently posted several Beginners Handouts and EZ-Scripts. Thank You !

In short, I have become OBSESSED with EZ-Robot.com's Website as a learning tool for High School Students whose school districts do not have a Robotics Program, or Money for one.

Think about it, in only a few short weeks watching the EZ-Robot Videos, and buying just the $69 EZ-B Controller, and a used $40 Roomba Vacuum, a student learns enough Electronics to wire the interface, learns Ohms Law and the Use of a $4 Multimeter from Harbor Freight Tools, and exposure to THREE or more Software Languages; The GUI ARC, C# (C-Sharp), Visual Basic, and JAVA.

This past month, both Ed Robot-Doc and I purchased Microsoft® Visual C#® 2012 Step John Sharp, downloaded and installed Trial Versions of Microsoft Visual Studio 2012, and became OVERWHELMED with the Learning Curve, just to change a few Parameters in EZ-B's Excellent Roomba Custom  Movement Panel !

I have attached Hacking Roomba.pdf, which explains how the authors compiled RoombaView using several different versions of JAVA.

    1- The Command Line Version is INSANE !

    2- PROCESSING for JAVA is the only one I barely understand, and runs without ALMOST any error messages. It complains about my location of the RoombaComm Libraries, but everything else is SOLID ! http://processing.org/download/ , http://processing.org/learning/gettingstarted/ .

    3- ECLIPSE for JAVA was supposed to show How to use the RoombaCommTest to Control the iRobot Create.pdf, but I became LOST when they began their Drag-&-Drop of the RoombaComm Libraries, and it looks like the Java Version of Microsoft Visual Studio.

RoombaCommTest & RoombaView

Thank You Again & Best Wishes From Phoenix,

DougPope@cox.net, 602-246-1246(H)

Hacking Roomba Full DOWNLOAD

#7  

Thanks a lot for all these great responses and for the script!