Skip to content

Commit 2ac644a

Browse files
Final changes before releasing v1.6.8
1 parent 2353263 commit 2ac644a

11 files changed

+141
-29
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ To set up the MachineMotion Python Library on your computer, follow the steps be
1111

1212
- Download the version of the library that you require on [GitHub](https://github.com/VentionCo/mm-python-api/releases)
1313

14+
15+
- Controllers with software v1.2.11 and earlier are compatible with the Python API v1.6.8 and earlier
16+
- Controllers with software v1.12.0+ are compatible with the Python API v2.0+
17+
1418
- Install Python on your computer. The MachineMotion library supports both Python 2.7 and Python 3.6.
1519

1620
- If installing on Windows, make sure to add Python.exe to the PATH environment variable as shown in *Figure 2* and *Figure 3*.

__documentation/api/machine_motion_python_api--v1.6.8.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ sys.exit(0)
600600
```
601601

602602
---
603-
### emitCombinedAbsoluteMove(axes, positions)
603+
### emitCombinedAxesAbsoluteMove(axes, positions)
604604

605605
> Send an absolute move command to the MachineMotion controller. Moves multiple axis simultaneously.
606606
@@ -614,7 +614,7 @@ sys.exit(0)
614614
> none
615615
616616
#### Reference Example
617-
> example--emitCombinedAbsoluteMove.py
617+
> example--emitCombinedAxesAbsoluteMove.py
618618
619619
```python
620620
from _MachineMotion_1_6_8 import *
@@ -641,11 +641,11 @@ mm.emitAcceleration(1000)
641641
print ("Application Message: Acceleration configured \n")
642642

643643
# Homing axis 1
644-
mm.emitHome(1)
645-
print ("Application Message: Axis 1 is at home \n")
644+
mm.emitHomeAll()
645+
print ("Application Message: Axes at home \n")
646646

647647
# Move the axis 1 to position 100 mm
648-
mm.emitCombinedAbsoluteMove([1, 2, 3], [100, 200, 100])
648+
mm.emitCombinedAxesAbsoluteMove([1, 2, 3], [50, 100, 50])
649649
print ("Application Message: Motion on-going ... \n")
650650

651651
mm.waitForMotionCompletion()
@@ -699,13 +699,13 @@ print ("Application Message: Speed configured \n")
699699
mm.emitAcceleration(1000)
700700
print ("Application Message: Acceleration configured \n")
701701

702-
# Homing axis 1
703-
mm.emitHome(1)
704-
print ("Application Message: Axis 1 at home \n")
702+
# Homing all axes
703+
mm.emitHomeAll()
704+
print ("Application Message: Axes at home \n")
705705

706706
# Move the axis one to position 100 mm
707-
mm.emitRelativeMove(1, "positive", 100)
708-
print ("Application Message: Move on-going ... \n")
707+
mm.emitCombinedAxisRelativeMove([1, 2, 3], ["positive", "positive", "positive"], [100, 200, 300])
708+
print ("Application Message: Multi-axis move on-going ... \n")
709709

710710
mm.waitForMotionCompletion()
711711
print ("Application Message: Motion completed \n")
@@ -716,7 +716,7 @@ sys.exit(0)
716716
```
717717

718718
---
719-
### emitCombinedAxisRelativeMove(axes, directions, distances)
719+
### emitCombinedAxesRelativeMove(axes, directions, distances)
720720

721721
> Send a relative move command to the MachineMotion controller. Moves multiple axis simultaneously.
722722
@@ -733,7 +733,7 @@ sys.exit(0)
733733
> none
734734
735735
#### Reference Example
736-
> example--emitCombinedRelativeMove.py
736+
> example--emitCombinedAxesRelativeMove.py
737737
738738
```python
739739
from _MachineMotion_1_6_8 import *

examples/_MachineMotion_1_6_8.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def emitAbsoluteMove(self, axis, position):
532532
#
533533
def emitCombinedAxesAbsoluteMove(self, axes, positions):
534534
if (not isinstance(axes, list) or not isinstance(positions, list)):
535-
raise TypeError("Axes and Postions must be lists")
535+
raise TypeError("All parameters must be lists")
536536

537537
global motion_completed
538538

@@ -580,8 +580,8 @@ def emitRelativeMove(self, axis, direction, distance):
580580
# @status
581581
#
582582
def emitCombinedAxisRelativeMove(self, axes, directions, distances):
583-
if (not isinstance(axes, list) or not isinstance(directions, list) or isinstance(distances, list)):
584-
raise TypeError("Axes and Postions must be lists")
583+
if (not isinstance(axes, list) or not isinstance(directions, list) or not isinstance(distances, list)):
584+
raise TypeError("All parameters must be lists")
585585

586586
global motion_completed
587587

@@ -691,6 +691,38 @@ def configAxis(self, axis, _u_step, _mech_gain):
691691
else:
692692
pass
693693
# print "Argument error, {configAxis(self, axis, u_step, mech_gain)}, {u_step} argument is invalid"
694+
695+
#
696+
# Function to reverse the positive direction of an axis, also reverse the home and end-of-travel sensor port
697+
# @param axis --- Description: Axis on which the setting applies --- Type: string or number.
698+
# @param data --- Description: normal or reverse axis direction --- Type: dictionary.
699+
# @status
700+
#
701+
def emitSetAxisDirection(self, axis, direction):
702+
703+
# Checking input parameters
704+
if (direction != "normal" and direction != "reverse"):
705+
raise ValueError('direction parameter must be either "normal" or "reversed"')
706+
707+
if (axis != 1 and axis != 2 and axis !=3):
708+
raise ValueError('axis must either be 1, 2 or 3')
709+
710+
if(axis == 1):
711+
if(direction == "normal"):
712+
self.myGCode.__emit__("M92 " + self.myGCode.__getTrueAxis__(axis) + str(self.myAxis1_steps_mm))
713+
elif (direction == "reverse"):
714+
self.myGCode.__emit__("M92 " + self.myGCode.__getTrueAxis__(axis) + "-" + str(self.myAxis1_steps_mm))
715+
elif(axis == 2):
716+
if(direction == "normal"):
717+
self.myGCode.__emit__("M92 " + self.myGCode.__getTrueAxis__(axis) + str(self.myAxis2_steps_mm))
718+
elif (direction == "reverse"):
719+
self.myGCode.__emit__("M92 " + self.myGCode.__getTrueAxis__(axis) + "-" + str(self.myAxis2_steps_mm))
720+
elif(axis == 3):
721+
if(direction == "normal"):
722+
self.myGCode.__emit__("M92 " + self.myGCode.__getTrueAxis__(axis) + str(self.myAxis3_steps_mm))
723+
elif (direction == "reverse"):
724+
self.myGCode.__emit__("M92 " + self.myGCode.__getTrueAxis__(axis) + "-" + str(self.myAxis3_steps_mm))
725+
694726
#
695727
# Function to save/persist data in the MachineMotion Controller (key - data pair)
696728
# @param key --- Description: key is a string that identifies the data to save for future retrieval. --- Type: string or number.

examples/_MachineMotion_1_6_8.pyc

27.3 KB
Binary file not shown.

examples/example--emitAbsoluteMove.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ def debug(data):
4141
mm.waitForMotionCompletion()
4242
print ("Application Message: Motion completed \n")
4343

44+
mm.setAxisDirection(1, "reverse")
45+
print ("Application Message: Axis 1 direction reverse \n")
46+
47+
# Homing axis 1
48+
mm.emitHome(1)
49+
print ("Application Message: Axis 1 is at home \n")
50+
51+
# Move the axis 1 to position 100 mm
52+
mm.emitAbsoluteMove(1, 100)
53+
print ("Application Message: Motion on-going ... \n")
54+
55+
4456
print ("Application Message: Program terminating ... \n")
4557
time.sleep(1)
4658
sys.exit(0)

examples/example--emitCombinedAbsoluteMove.py renamed to examples/example--emitCombinedAxesAbsoluteMove.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author: Francois Giguere
55
## Version: 1.6.8
66
## Email: info@vention.cc
7-
## Status: ready to test
7+
## Status: tested
88
##################################################
99

1010
from _MachineMotion_1_6_8 import *
@@ -31,11 +31,11 @@ def debug(data):
3131
print ("Application Message: Acceleration configured \n")
3232

3333
# Homing axis 1
34-
mm.emitHome(1)
35-
print ("Application Message: Axis 1 is at home \n")
34+
mm.emitHomeAll()
35+
print ("Application Message: Axes at home \n")
3636

3737
# Move the axis 1 to position 100 mm
38-
mm.emitCombinedAbsoluteMove([1, 2, 3], [100, 200, 100])
38+
mm.emitCombinedAxesAbsoluteMove([1, 2, 3], [50, 100, 50])
3939
print ("Application Message: Motion on-going ... \n")
4040

4141
mm.waitForMotionCompletion()

examples/example--emitCombinedRelativeMove.py renamed to examples/example--emitCombinedAxesRelativeMove.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author: Francois Giguere
55
## Version: 1.6.8
66
## Email: info@vention.cc
7-
## Status: ready to test
7+
## Status: tested
88
##################################################
99

1010
from _MachineMotion_1_6_8 import *
@@ -30,12 +30,12 @@ def debug(data):
3030
mm.emitAcceleration(1000)
3131
print ("Application Message: Acceleration configured \n")
3232

33-
# Homing axis 1
34-
mm.emitHome(1)
35-
print ("Application Message: Axis 1 at home \n")
33+
# Homing all axes
34+
mm.emitHomeAll()
35+
print ("Application Message: Axes at home \n")
3636

3737
# Move the axis one to position 100 mm
38-
mm.emitCombinedRelativeMove([1,2,3], ["positive","positive","positive"], [100, 200, 300])
38+
mm.emitCombinedAxisRelativeMove([1, 2, 3], ["positive", "positive", "positive"], [100, 200, 300])
3939
print ("Application Message: Multi-axis move on-going ... \n")
4040

4141
mm.waitForMotionCompletion()
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
##################################################
2+
## Axis Direction
3+
##################################################
4+
## Author: Francois Giguere
5+
## Version: 1.6.8
6+
## Email: info@vention.cc
7+
## Status: tested
8+
##################################################
9+
10+
from _MachineMotion_1_6_8 import *
11+
12+
# Define a callback to process controller gCode responses if desired. This is mostly used for debugging purposes.
13+
def debug(data):
14+
pass
15+
16+
print ("Application Message: MachineMotion Program Starting \n")
17+
18+
mm = MachineMotion(debug, DEFAULT_IP_ADDRESS.usb_windows)
19+
print ("Application Message: MachineMotion Controller Connected \n")
20+
21+
# Configure the axis number 1, 8 uSteps and 150 mm / turn for a timing belt
22+
mm.configAxis(1, MICRO_STEPS.ustep_8, MECH_GAIN.timing_belt_150mm_turn)
23+
print ("Application Message: MachineMotion Axis 1 Configured \n")
24+
25+
# Configuring the travel speed to 10000 mm / min
26+
mm.emitSpeed(10000)
27+
print ("Application Message: Speed configured \n")
28+
29+
# Configuring the travel speed to 1000 mm / second^2
30+
mm.emitAcceleration(1000)
31+
print ("Application Message: Acceleration configured \n")
32+
33+
# Homing axis 1
34+
mm.emitHome(1)
35+
print ("Application Message: Axis 1 is at home \n")
36+
37+
# Move the axis 1 to position 100 mm
38+
mm.emitAbsoluteMove(1, 100)
39+
print ("Application Message: Motion on-going ... \n")
40+
41+
mm.waitForMotionCompletion()
42+
print ("Application Message: Motion completed \n")
43+
44+
45+
mm.emitSetAxisDirection(1, "reverse")
46+
print ("Application Message: Axis direction set for axis 1 \n")
47+
48+
# Homing axis 1
49+
mm.emitHome(1)
50+
print ("Application Message: Axis 1 is at home \n")
51+
52+
# Move the axis 1 to position 100 mm
53+
mm.emitAbsoluteMove(1, 100)
54+
print ("Application Message: Motion on-going ... \n")
55+
56+
mm.waitForMotionCompletion()
57+
print ("Application Message: Motion completed \n")
58+
59+
print ("Application Message: Program terminating ... \n")
60+
time.sleep(1)
61+
sys.exit(0)
62+
63+

examples/example--saveData_getData.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author: Francois Giguere
55
## Version: 1.6.8
66
## Email: info@vention.cc
7-
## Status: released
7+
## Status: tested
88
##################################################
99

1010
from _MachineMotion_1_6_8 import *

examples/example--setPosition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author: Francois Giguere
55
## Version: 1.6.8
66
## Email: info@vention.cc
7-
## Status: rdy for test
7+
## Status: tested
88
##################################################
99

1010
from _MachineMotion_1_6_8 import *
@@ -26,7 +26,7 @@ def debug(data):
2626
mm.setPosition(1, 100)
2727
print ("Application Message: Position set to 100 mm on axis 1\n")
2828

29-
mm.moveRelative(1, "negative", 50)
29+
mm.emitRelativeMove(1, "negative", 50)
3030
print ("Application Message: Moving in the negative direction ... \n")
3131

3232
mm.waitForMotionCompletion()

0 commit comments

Comments
 (0)