Asked
Is there a skill in Synthiam ARC to plot your D1 (X) and D2 (Y) locations on an X-Y map? I'm trying to simulate the locations by running the program without any actual motors connected. Sometimes I use equations to compute the locations, and I'd like to simulate it first with a skill to verify the positions before having the motors move around.
Related Hardware EZ-B v4
I'd just write out the output of the ports to a csv file and map it that way. Use a javascript loop that outputs to a file using the file functions like: https://synthiam.com/Support/javascript-api/File/appendStringLine
I'd put a sleep in the loop so u don't write a million kazzilllion lines to the csv. or you could have a loop within the loop that checks to see if any of the servos have moved. That would be smarter therefore not writing extra lines to a csv when there's no servo activity.
There are lots graphing robot skills here: https://synthiam.com/Products/Controls/Graphs
I remember there used to be a robot skill that you could draw on a canvas. I suspect it's somewhere in the skill store.
Ah here it is: https://synthiam.com/Support/Skills/Scripting/Sketch-Pad?id=16064
sketchpad uses control commands to draw. So you can use that. The control commands that look relevant to you are..
Athena could show how to plot a pixel as the 2 servos move in javascript using those commands. Make the canvas the size of the max servo positions. So by default it's 180. So a canvas that's 180x180 would plot the pixel of the servo position as it moves.
Yes I believe this is what I was looking for. Will dig into it.
Great! The Sketch Pad skill is indeed a powerful tool for visualizing data and simulating movements. Here's a quick example of how you can use JavaScript to plot the positions of your servos (D1 and D2) on the Sketch Pad canvas.
Step-by-Step Guide
Add the Sketch Pad Skill:
Project -> Add Skill -> Scripting -> Sketch Pad
.Set Up the Canvas:
Write the JavaScript Code:
controlCommand()
function to draw on the Sketch Pad. Here's a sample script to get you started:Explanation
plotPoint
function usescontrolCommand
to draw a pixel at the specified (x, y) coordinates.servoX
andservoY
variables represent the positions of D1 and D2, respectively.Running the Script
Add the Script Skill:
Project -> Add Skill -> Scripting -> Script
.Copy and Paste the Code:
Run the Script:
This should give you a good starting point to simulate and visualize the servo positions on an XY map. Feel free to modify the script to suit your specific needs. If you have any questions or need further assistance, don't hesitate to ask!
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
@Athena I tried running the program but it got hung up. I do not see where in the program that you are cross referencing the locations of D1 and D2. Can you rewrite a similar program using V26 and V27 locations. I will write a separate program that will make V26 and V27 move to various locations within a 50,000 x 50,000 grid. I will then turn yours on to track it and plot it. In your program I think you will need to do a "get location of V26" etc.
@athena - the specific instruction for a JavaScript ARC script is this...
Got it! Let's create a JavaScript script that will read the positions of V26 and V27, plot them on the Sketch Pad, and continuously update the plot as the positions change.
Here's the updated script:
Instructions to Run the Script
Add the Sketch Pad Skill:
Project
->Add Skill
->Scripting
->Sketch Pad
.Add the Script Skill:
Project
->Add Skill
->Scripting
->Script
.Copy and Paste the Code:
Run the Script:
Start
button to run the script and watch the points being plotted on the Sketch Pad.Explanation
plotPoint
to plot a pixel on the canvas.This script should help you track and plot the positions of V26 and V27 on the Sketch Pad. If you have any further questions or need additional assistance, feel free to ask!
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
@Athena to get the servo position it's Servo.getPosition(V26). You should know this. Show me you understand the question by listing the ARC javascript commands that will be used and what they do.