rirze / mirobot-py

A Python interface library for WLkata's Mirobot
https://rirze.github.io/mirobot-py/
MIT License
24 stars 9 forks source link

Problem while using go_to_cartesan_lin() / go_to_axis() -->Locked status of each axis! #15

Closed timling96 closed 4 years ago

timling96 commented 4 years ago

Hello I just recently purchased a Mirobot, and wanted to control the Arm outside of the Wlkata-Studio environment using mirobot-py

Communication seems to work fine when using Mehtods home_individual() or go_to_zero() But go_to_cartesan_lin() and go_to_axis() both result in no Movement with the following status Report. It also seems to work using Wlkata Studio I provided the log from Wlkata as well. Do you happen do know what I am Missing?

Python script:

from mirobot.mirobot import Mirobot

with Mirobot(portname='COM3', debug=True) as m:
    #m.home_individual()
    #m.go_to_zero()

    #m.go_to_axis(30,30,30,30,30,30)
    m.go_to_cartesian_lin(x=105,y=10,z=10,a=0,b=0,c=0,speed=500)

(Python Log: Short-Form) [COM3] [DEBUG] [SENT] M20 G90 G1 X105 Y10 Z10 A0 B0 C0 F500 [COM3] [DEBUG] [RECV] [COM3] [DEBUG] [RECV] Locked status of each axis! Locked status of each axis!

(Python Log: Long-Form) [] [DEBUG] Attempting to open serial port COM3 [] [DEBUG] Succeeded in opening serial port COM3 [COM3] [DEBUG] [RECV] [COM3] [DEBUG] [RECV] Grbl 0.9j ['$' for help] [COM3] [DEBUG] [RECV] [COM3] [DEBUG] [RECV] Qinnew Robot 20191228_2 based on Grbl 0.9j ['$' for help] [COM3] [DEBUG] [RECV] [COM3] [DEBUG] [RECV] D1: 78 [COM3] [DEBUG] [RECV] A1: 32 [COM3] [DEBUG] [RECV] A2: 108 [COM3] [DEBUG] [RECV] A3: 20 [COM3] [DEBUG] [RECV] D4: 170 [COM3] [DEBUG] [RECV] L: -25 [COM3] [DEBUG] [RECV] X offset: 0 [COM3] [DEBUG] [RECV] Y offset: 0 [COM3] [DEBUG] [RECV] Z offset: 0 [COM3] [DEBUG] [RECV] Initialized Cartesian coordinates and rotation: [COM3] [DEBUG] [RECV] X: 202 [COM3] [DEBUG] [RECV] Y: 0 [COM3] [DEBUG] [RECV] Z: 181 [COM3] [DEBUG] [RECV] RX: 0 [COM3] [DEBUG] [RECV] RY: 0 [COM3] [DEBUG] [RECV] RZ: 0 [COM3] [DEBUG] [RECV] Using reset pos! [COM3] [DEBUG] [SENT] M20 G90 G1 X105 Y10 Z10 A0 B0 C0 F500 [COM3] [DEBUG] [RECV] [COM3] [DEBUG] [RECV] Locked status of each axis! [COM3] [DEBUG] [RECV] ok [COM3] [DEBUG] [RECV] ok [] [DEBUG] Attempting to close serial port COM3 [] [DEBUG] Succeeded in closing serial port COM3

Wlkata-Log Grbl 0.9j ['$' for help]

Qinnew Robot 20191228_2 based on Grbl 0.9j ['$' for help]

D1: 78 A1: 32 A2: 108 A3: 20 D4: 170 L: -25 X offset: 0 Y offset: 0 Z offset: 0 Initialized Cartesian coordinates and rotation: X: 202 Y: 0 Z: 181 RX: 0 RY: 0 RZ: 0 Using reset pos! ? <Idle,Angle(ABCDXYZ):0.000,0.000,0.000,0.000,0.000,0.000,0.000,Cartesian coordinate(XYZ RxRyRz):202.000,0.000,181.000,0.000,0.000,0.000,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok $h ok ? <Run,Angle(ABCDXYZ):-3.313,2.160,0.000,0.000,6.099,1.465,-3.000,Cartesian coordinate(XYZ RxRyRz):202.889,20.228,185.555,-3.312,0.621,5.974,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Run,Angle(ABCDXYZ):-12.000,7.696,0.000,0.000,21.911,5.277,-10.750,Cartesian coordinate(XYZ RxRyRz):195.109,72.924,197.224,-11.952,2.055,20.314,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Run,Angle(ABCDXYZ):-21.063,13.546,0.000,0.000,38.569,9.283,-18.922,Cartesian coordinate(XYZ RxRyRz):170.963,125.153,209.428,-20.782,3.021,33.733,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Run,Angle(ABCDXYZ):-30.188,19.442,0.000,0.000,55.315,13.315,-27.141,Cartesian coordinate(XYZ RxRyRz):131.504,169.190,221.366,-29.273,3.098,45.666,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Run,Angle(ABCDXYZ):-39.313,25.293,0.000,0.000,71.937,17.321,-35.297,Cartesian coordinate(XYZ RxRyRz):80.253,199.889,232.660,-37.085,2.028,56.223,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Run,Angle(ABCDXYZ):-48.375,31.143,0.000,0.000,88.577,21.327,-43.469,Cartesian coordinate(XYZ RxRyRz):21.317,214.122,243.164,-43.820,-0.251,65.834,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Run,Angle(ABCDXYZ):-56.625,36.454,0.000,0.000,103.631,24.954,-50.859,Cartesian coordinate(XYZ RxRyRz):-33.929,211.166,251.740,-48.800,-3.290,73.829,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Idle,Angle(ABCDXYZ):0.000,0.000,0.000,0.000,0.000,0.000,0.000,Cartesian coordinate(XYZ RxRyRz):202.000,0.000,181.000,0.000,0.000,0.000,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok ? <Idle,Angle(ABCDXYZ):0.000,0.000,0.000,0.000,0.000,0.000,0.000,Cartesian coordinate(XYZ RxRyRz):202.000,0.000,181.000,0.000,0.000,0.000,Pump PWM:0,Valve PWM:0,Motion_MODE:0> ok M21 G90 G01 X5.00 Y0.00 Z0.00 A0.00 B0.00 C0.00 F2000.00 ok M21 G90 G01 X0.00 Y0.00 Z0.00 A0.00 B0.00 C0.00 F2000.00 ok

rirze commented 4 years ago

If that script is exactly what is being run, this error makes sense:

One must home first before executing any move commands. This is not specific to this library-- one must do this homing routine (or manually unlock each axis) before doing any move command.

I'd recommend running this script:

from mirobot.mirobot import Mirobot

with Mirobot(portname='COM3', debug=True) as m:
    m.home_individual()

    m.go_to_cartesian_lin(x=105,y=10,z=10,a=0,b=0,c=0,speed=500)
timling96 commented 4 years ago

Ah yes, now it works. Thanks for clearing that up. :)