Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@

# uArmProPython
uArm Swift Pro robot arm Python library and example code snippets. Based on a fork from Richar Gasthaagen's repository.

Note 1: The svgo and convert binaries are external to Python. Meaning, you need to install imagemagick and node.js on your system (e.g., sudo apt-get install imagemagick npm) and the svgo command for node.js (npg install -g svgo). These functionalities were tested on Kubuntu Linux 16.04. Installation instructions for Windows can be found in the file uArmLaser_windows_guide.txt.

Please, be careful with the laser. Don't blind yourself or burn your house down :)

If you create something cool with these functions, please show me too :) Primarily I'm just curious, and also seeing other people's work might give ideas on how to improve the code. So, don't hesitate to drop me an email: ossi.lehtinen@gmail.com









The original readme:

# uArmProPython
Python Library for the uArm swift Pro robot arm

Expand Down
24 changes: 24 additions & 0 deletions bird.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions bitmap_draw_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import uArmLaserRobot

mode = 1

#Configure Serial port
#serialport = "com3" # for windows
serialport = "/dev/ttyACM0" # for linux like system

# Connect to uArm
myRobot = uArmLaserRobot.laserRobot(serialport)
myRobot.debug = True # Enable / Disable debug output on screen, by default disabled
myRobot.connect()
myRobot.mode(mode) # Set mode to Normal



x_offset = 170
height = 150
draw_speed = 6000
targetWidth = 25
lineSpacing = .5


myRobot.drawBitmap('skull.jpg', targetWidth, lineSpacing, x_offset, height, draw_speed)



# Dock the arm before exit
myRobot.goto(225, 0, 150, 6000)
myRobot.goto(130, 0, 90, 6000)
myRobot.goto(97, 0, 30, 6000)
48 changes: 48 additions & 0 deletions grid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Script for drawing a grid with the laser for calibration purposes

# Please, don't leave the arm unattended while operating the laser.

import uArmLaserRobot

mode = 1

#Configure Serial port
#serialport = "com3" # for windows
serialport = "/dev/ttyACM0" # for linux like system

# Connect to uArm
myRobot = uArmLaserRobot.laserRobot(serialport)
myRobot.debug = True # Enable / Disable debug output on screen, by default disabled
myRobot.connect()
myRobot.mode(mode) # Set mode to Normal



# Larger grid
#gridSizeX = 120
#gridSizeY = 200
#gridOffsetX = 140

# Smaller test grid
gridSizeX = 40
gridSizeY = 40
gridOffsetX = 180


workingHeight = 150
drawSpeed = 1000

# Horizontal lines
for i in range(int(gridOffsetX/10), int((gridOffsetX+gridSizeX)/10+1)):
print(i*10)
myRobot.goto(i*10, -gridSizeY/2, workingHeight, 6000)
myRobot.goto_laser(i*10, gridSizeY/2, workingHeight, drawSpeed)
myRobot.goto(i*10, gridSizeY/2, workingHeight, 6000) # Switch the laser off

# Vertical lines
for i in range(int(-gridSizeY/20), int(gridSizeY/20+1)):
print(i*10)
myRobot.goto(gridOffsetX+gridSizeX, i*10, workingHeight, 6000)
myRobot.goto_laser(gridOffsetX, i*10, workingHeight, drawSpeed)
myRobot.goto(gridOffsetX, i*10, workingHeight, 6000) # Switch the laser off

33 changes: 33 additions & 0 deletions laser_draw_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import uArmLaserRobot

mode = 1

steps_per_seg = 10
x_offset = 170
height = 150
draw_speed = 100
targetWidth = 20
lineSpacing = 1.0

#Configure Serial port
#serialport = "com3" # for windows
serialport = "/dev/ttyACM0" # for linux like system

# Connect to uArm
myRobot = uArmLaserRobot.laserRobot(serialport)
myRobot.debug = True # Enable / Disable debug output on screen, by default disabled
myRobot.connect()
myRobot.mode(mode) # Set mode to Normal

coords = myRobot.parseSVG('bird.svg', targetWidth, x_offset, steps_per_seg)

myRobot.set_path_start(coords, height, mode)

myRobot.drawPath(coords, draw_speed, height, mode)
#myRobot.fillSVG('bird.svg', targetWidth, lineSpacing, x_offset, height, draw_speed, mode) # The bird svg doesn't have fill atm, so this is a bit silly...
myRobot.loff()

# Dock the arm before exit
myRobot.goto(225, 0, 150, 6000)
myRobot.goto(130, 0, 90, 6000)
myRobot.goto(97, 0, 30, 6000)
1 change: 1 addition & 0 deletions protocol_swiftpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
READY = "@1"
OK = "OK"
SET_POSITION = "G0 X{} Y{} Z{} F{}"
SET_POSITION_LASER = "G1 X{} Y{} Z{} F{}"
SET_POSITION_RELATIVE = "G2204 X{} Y{} Z{} F{}"
SIMULATION = "M2222 X{} Y{} Z{} P0"
GET_FIRMWARE_VERSION = "P2203"
Expand Down
175 changes: 0 additions & 175 deletions svg_example.py

This file was deleted.

Loading