113270 Views
93709 Views
85773 Views
53388 Views
50571 Views
48758 Views
Operation Pico
Raspberry Pi Home Hub
Hacky Temperature and Humidity Sensor
Robot Makers Almanac
High Five Bot
Making a Custom PCB for BurgerBot
Using the Raspberry Pi Pico's Built-in Temperature Sensor
Getting Started with SQL
Introduction to the Linux Command Line on Raspberry Pi OS
How to install MicroPython
Wall Drawing Robot Tutorial
BrachioGraph Tutorial
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 >