Thumbnail

Sketch Pad

How to add the Sketch Pad robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Scripting category tab.
  5. Press the Sketch Pad icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Sketch Pad robot skill.


How to use the Sketch Pad robot skill

There are so many ways to present visual feedback with this skill. The Sketch Pad allows you to draw with controlCommand() from a script. You can create scripts that draw object locations in a room or display information from the path the robot has driven. You can also display custom face emotions using simple graphic shapes of circles, squares, and rectangles. Use your creativity to visualize robot data!

*Note: For usage information, reference ARC's example folder for a SketchPad project.

Main Window



1. Sketch Display
This displays the graphics that are executed in code.

2. Script
This skill executes scripts that can draw graphics to the Sketch display.

How to use Sketch Pad


1) Add the Sketch Pad skill to your ARC project (Project -> Add Skill -> Scripting -> Sketch Pad).

2) Add the Script skill to your ARC project (Project -> Add Skill -> Scripting -> Script).

3) Write a script in the script skill to draw a graphic. Javascript Example: controlCommand("Sketch Pad", "CanvasDrawCircle", 3, 50, 50, 50, 50, "purple");

4) Run the script and watch as the graphic is drawn in the Main Window of the Sketch pad.

Control Commands

Several control commands can be used to draw on the canvas for the sketch pad. Here is the list of control commands for the sketch pad...

  • ControlCommand("Sketch Pad", "FullScreen")
  • ControlCommand("Sketch Pad", "RestoreScreen")
  • ControlCommand("Sketch Pad", "FullScreenToggle")
  • ControlCommand("Sketch Pad", "CanvasDrawCircle", [Thickness], [X1], [Y1], [X2], [Y2], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawCircle", [Thickness], [X1], [Y1], [X2], [Y2], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawCircle", [Thickness], [X1], [Y1], [X2], [Y2], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawCircleFill", [X], [Y], [Width], [Height], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawCircleFill", [X], [Y], [Width], [Height], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawCircleFill", [X], [Y], [Width], [Height], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawLine", [Thickness], [X1], [Y1], [X2], [Y2], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawLine", [Thickness], [X1], [Y1], [X2], [Y2], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawLine", [Thickness], [X1], [Y1], [X2], [Y2], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawPixel", [X], [Y], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawPixel", [X], [Y], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawPixel", [X], [Y], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawRectangle", [Thickness], [X], [Y], [Width], [Height], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawRectangle", [Thickness], [X], [Y], [Width], [Height], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawRectangle", [Thickness], [X], [Y], [Width], [Height], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawRectangleFill", [X], [Y], [Width], [Height], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawRectangleFill", [X], [Y], [Width], [Height], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawRectangleFill", [X], [Y], [Width], [Height], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawString", [X], [Y], [Size], [Text], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasDrawString", [X], [Y], [Size], [Text], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasDrawString", [X], [Y], [Size], [Text], [Alpha], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasClear")
  • ControlCommand("Sketch Pad", "CanvasClear", "[Color]")
  • ControlCommand("Sketch Pad", "CanvasClear", [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasSize", [Width], [Height])
  • ControlCommand("Sketch Pad", "CanvasSize", [Width], [Height], "[Color]")
  • ControlCommand("Sketch Pad", "CanvasSize", [Width], [Height], [Red], [Green], [Blue])
  • ControlCommand("Sketch Pad", "CanvasUndo")

ARC Pro

Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

#1  

@Athena Is there a way that we can add or modify the script in Sketchpad to make the line that it is drawing wider? This comes into play with the StepperServo skill whereas you tell it a certain destination and the Arduino takes over. What you end up with in sketch pad is a single dot pixel that gets colored in. Is there a way to add an area around the singular pixel to be filled in with color also. This could be user defined as a 1/4 circle. If you defined 5 destinations with x and y locations you would end up with 5  1/4" circles located on the sketch. If it were traveling with typical servos there would be a 1/4" line to each destination.

PRO
Canada
#2  

Yes, you can modify the script in the Sketch Pad to make the line it is drawing wider. You can achieve this by drawing multiple lines or shapes around the main line to create the appearance of a thicker line. For example, you can draw circles or rectangles around each point to simulate a thicker line.

Here's an example of how you can draw a thicker line by drawing circles around each point:

JavaScript Example

// Function to draw a thicker line by drawing circles around each point
function drawThickLine(x1, y1, x2, y2, thickness, color) {
    // Calculate the number of steps based on the distance between points
    var steps = Math.max(Math.abs(x2 - x1), Math.abs(y2 - y1));
    var dx = (x2 - x1) / steps;
    var dy = (y2 - y1) / steps;

    // Draw circles around each point to create a thicker line
    for (var i = 0; i <= steps; i++) {
        var x = x1 + i * dx;
        var y = y1 + i * dy;
        controlCommand("Sketch Pad", "CanvasDrawCircle", 3, x, y, thickness, thickness, color);
    }
}

// Example usage
var startX = 50;
var startY = 50;
var endX = 200;
var endY = 200;
var lineThickness = 10; // Adjust the thickness as needed
var lineColor = "purple";

drawThickLine(startX, startY, endX, endY, lineThickness, lineColor);

Explanation

  1. drawThickLine Function: This function takes the start and end coordinates of the line, the desired thickness, and the color. It calculates the number of steps needed to draw the line based on the distance between the points.
  2. Drawing Circles: It then draws circles around each point along the line to create the appearance of a thicker line. The CanvasDrawCircle command is used to draw the circles.
  3. Example Usage: The example usage demonstrates how to call the drawThickLine function with specific coordinates, thickness, and color.

Drawing Multiple Circles at Destinations

If you want to draw multiple circles at specific destinations, you can modify the script to draw circles at each destination point:

// Function to draw a circle at a specific point
function drawCircleAtPoint(x, y, radius, color) {
    controlCommand("Sketch Pad", "CanvasDrawCircle", 3, x, y, radius, radius, color);
}

// Example destinations
var destinations = [
    { x: 50, y: 50 },
    { x: 100, y: 100 },
    { x: 150, y: 150 },
    { x: 200, y: 200 },
    { x: 250, y: 250 }
];

var circleRadius = 10; // Adjust the radius as needed
var circleColor = "blue";

// Draw circles at each destination
for (var i = 0; i < destinations.length; i++) {
    drawCircleAtPoint(destinations[i].x, destinations[i].y, circleRadius, circleColor);
}

Explanation

  1. drawCircleAtPoint Function: This function takes the coordinates, radius, and color to draw a circle at a specific point.
  2. Example Destinations: An array of destination points is defined.
  3. Drawing Circles: The script iterates through the array of destinations and draws a circle at each point using the drawCircleAtPoint function.

By using these scripts, you can create thicker lines and draw circles at specific destinations on the Sketch Pad. Adjust the parameters as needed to achieve the desired visual effect.


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.
PRO
Canada
#4  

You're welcome! I'm glad I could help. If you have any more questions or need further assistance with Synthiam ARC or any other robot programming tasks, feel free to ask. Happy robot building!


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.
PRO
Synthiam
#5  

@athena and @automation, there's also several control commands that can do that without needing extra code. Scroll up in the manual to see how you can provide parameters to the ControlCommand() for line width and such.

#6  

Yes I see it now, thanks. This will keep things clean and organized without the need for extra coding.

PRO
Canada
#7  

Great catch!Using the built-in control commands for line width and other parameters will indeed keep your code cleaner and more organized.Here's a quick example of how you can use the control commands to draw a thicker line directly:

JavaScript Example

// Draw a thicker line using the built-in control command
var thickness = 10; // Adjust the thickness as needed
var startX = 50;
var startY = 50;
var endX = 200;
var endY = 200;
var lineColor = "purple"; // You can also use RGB values

controlCommand("Sketch Pad", "CanvasDrawLine", thickness, startX, startY, endX, endY, lineColor);

Explanation

  1. Thickness: Set the desired thickness for the line.
  2. Coordinates: Define the start and end coordinates for the line.
  3. Color: Specify the color of the line.
  4. Control Command: Use the CanvasDrawLine ControlCommand() with the specified parameters to draw the line.

This approach leverages the built-in capabilities of the Sketch Pad skill, making your code more concise and easier to manage.

If you have any more questions or need further 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.