108640 Views
83860 Views
59555 Views
48723 Views
48311 Views
47806 Views
Build a laser-cut robot
Robots and Lasers
Arduino Plug and Make Kit Review
Pi to Pico W Bluetooth Communication
Two-Way Bluetooth Communication Between Raspberry Pi Picos
Gamepad 2
Introduction to the Linux Command Line on Raspberry Pi OS
How to install MicroPython
Wall Drawing Robot Tutorial
BrachioGraph Tutorial
Intermediate level MicroPython
Introduction to FreeCAD for Beginners
KevsRobots Learning Platform
72% Percent Complete
By Kevin McAleer, 2 Minutes
Page last updated August 02, 2024
To accurately move the gondola and draw on the wall, the robot needs to calculate the position of the gondola using the lengths of the strings attached to the motors. This involves simple trigonometry and math.
The wall drawing robot operates in a 2D plane. Each stepper motor controls one side of the gondola. By adjusting the lengths of the strings, we can move the gondola to any position (X, Y) on the wall.
Consider the following setup:
We can use the Pythagorean theorem to relate these lengths to the position of the gondola.
# Calculate the length of string from Motor 1 (L1) L1 = math.sqrt(X**2 + Y**2) # Calculate the length of string from Motor 2 (L2) L2 = math.sqrt((W - X)**2 + Y**2)
These formulas allow us to calculate the lengths of the strings based on the desired position of the gondola.
To move the gondola to a specific position (X, Y), we can use the calculated lengths (L1 and L2) to determine the steps needed for each stepper motor.
Here’s an example of how to implement this in Python:
import math def calculate_lengths(x, y, w): L1 = math.sqrt(x**2 + y**2) L2 = math.sqrt((w - x)**2 + y**2) return L1, L2 # Example usage: W = 100 # Width of the drawing area in centimeters X = 50 # Desired X position Y = 50 # Desired Y position L1, L2 = calculate_lengths(X, Y, W) print(f"Length of string from Motor 1: {L1} cm") print(f"Length of string from Motor 2: {L2} cm")
< Previous Next >