Skip to content

Commit

Permalink
Python API v1.6.8 ready for final testing
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-giguere committed Sep 27, 2019
1 parent 8d16676 commit 2353263
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 27 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ If you require more information about how to setup you controller to communicate
## API Documentation

[Application Programming Interface: Python v1.6.8](__documentation/api/machine_motion_python_api--v1.6.8.md)

## Release Notes
[Release Notes: Python v1.6.8](release-notes.md)
122 changes: 120 additions & 2 deletions __documentation/api/machine_motion_python_api--v1.6.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ sys.exit(0)
---
### emitAbsoluteMove(axis, position)

Configures the travel acceleration. Travel acceleration applies to combined axis moves and single axis moves.
> Sends an absolute move command to the MachineMotion controller
#### axis {AXIS_NUMBER}
> Axis to move to home location
Expand All @@ -556,7 +556,8 @@ Configures the travel acceleration. Travel acceleration applies to combined axis
#### return value
> none
#### Example
#### Reference Example
> example--emitAbsoluteMove.py
```python
from _MachineMotion_1_6_8 import *
Expand Down Expand Up @@ -598,6 +599,63 @@ time.sleep(1)
sys.exit(0)
```

---
### emitCombinedAbsoluteMove(axes, positions)

> Send an absolute move command to the MachineMotion controller. Moves multiple axis simultaneously.
#### axes {array of numbers}
> Axes to move
#### positions {array of numbers}
> Position to move the axes to
#### return value
> none
#### Reference Example
> example--emitCombinedAbsoluteMove.py
```python
from _MachineMotion_1_6_8 import *

# Define a callback to process controller gCode responses if desired. This is mostly used for debugging purposes.
def debug(data):
pass

print ("Application Message: MachineMotion Program Starting \n")

mm = MachineMotion(debug, DEFAULT_IP_ADDRESS.usb_windows)
print ("Application Message: MachineMotion Controller Connected \n")

# Configure the axis number 1, 8 uSteps and 150 mm / turn for a timing belt
mm.configAxis(1, MICRO_STEPS.ustep_8, MECH_GAIN.timing_belt_150mm_turn)
print ("Application Message: MachineMotion Axis 1 Configured \n")

# Configuring the travel speed to 10000 mm / min
mm.emitSpeed(10000)
print ("Application Message: Speed configured \n")

# Configuring the travel speed to 1000 mm / second^2
mm.emitAcceleration(1000)
print ("Application Message: Acceleration configured \n")

# Homing axis 1
mm.emitHome(1)
print ("Application Message: Axis 1 is at home \n")

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

mm.waitForMotionCompletion()
print ("Application Message: Motion completed \n")

print ("Application Message: Program terminating ... \n")
time.sleep(1)
sys.exit(0)
```

---
### emitRelativeMove (axis, direction, distance)

Expand Down Expand Up @@ -657,6 +715,66 @@ time.sleep(1)
sys.exit(0)
```

---
### emitCombinedAxisRelativeMove(axes, directions, distances)

> Send a relative move command to the MachineMotion controller. Moves multiple axis simultaneously.
#### axes {array of numbers}
> Axes to move
#### directions {list of strings of value equal to "positive" or "negative"}
> Motion direction for each axis
#### distances {array of numbers}
> Distances to move for each axis
#### return value
> none
#### Reference Example
> example--emitCombinedRelativeMove.py
```python
from _MachineMotion_1_6_8 import *

# Define a callback to process controller gCode responses if desired. This is mostly used for debugging purposes.
def debug(data):
pass

print ("Application Message: MachineMotion Program Starting \n")

mm = MachineMotion(debug, DEFAULT_IP_ADDRESS.usb_windows)
print ("Application Message: MachineMotion Controller Connected \n")

# Configure the axis number 1, 8 uSteps and 150 mm / turn for a timing belt
mm.configAxis(1, MICRO_STEPS.ustep_8, MECH_GAIN.timing_belt_150mm_turn)
print ("Application Message: MachineMotion Axis 1 Configured \n")

# Configuring the travel speed to 10000 mm / min
mm.emitSpeed(10000)
print ("Application Message: Speed configured \n")

# Configuring the travel speed to 1000 mm / second^2
mm.emitAcceleration(1000)
print ("Application Message: Acceleration configured \n")

# Homing axis 1
mm.emitHome(1)
print ("Application Message: Axis 1 at home \n")

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

mm.waitForMotionCompletion()
print ("Application Message: Motion completed \n")

print ("Application Message: Program terminating ... \n")
time.sleep(1)
sys.exit(0)
```

---
### emitgCode(gCode)

Expand Down
48 changes: 48 additions & 0 deletions examples/example--emitCombinedAbsoluteMove.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
##################################################
## Combined Absolute Move
##################################################
## Author: Francois Giguere
## Version: 1.6.8
## Email: info@vention.cc
## Status: ready to test
##################################################

from _MachineMotion_1_6_8 import *

# Define a callback to process controller gCode responses if desired. This is mostly used for debugging purposes.
def debug(data):
pass

print ("Application Message: MachineMotion Program Starting \n")

mm = MachineMotion(debug, DEFAULT_IP_ADDRESS.usb_windows)
print ("Application Message: MachineMotion Controller Connected \n")

# Configure the axis number 1, 8 uSteps and 150 mm / turn for a timing belt
mm.configAxis(1, MICRO_STEPS.ustep_8, MECH_GAIN.timing_belt_150mm_turn)
print ("Application Message: MachineMotion Axis 1 Configured \n")

# Configuring the travel speed to 10000 mm / min
mm.emitSpeed(10000)
print ("Application Message: Speed configured \n")

# Configuring the travel speed to 1000 mm / second^2
mm.emitAcceleration(1000)
print ("Application Message: Acceleration configured \n")

# Homing axis 1
mm.emitHome(1)
print ("Application Message: Axis 1 is at home \n")

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

mm.waitForMotionCompletion()
print ("Application Message: Motion completed \n")

print ("Application Message: Program terminating ... \n")
time.sleep(1)
sys.exit(0)


46 changes: 46 additions & 0 deletions examples/example--emitCombinedRelativeMove.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
##################################################
## Combined Relative Move
##################################################
## Author: Francois Giguere
## Version: 1.6.8
## Email: info@vention.cc
## Status: ready to test
##################################################

from _MachineMotion_1_6_8 import *

# Define a callback to process controller gCode responses if desired. This is mostly used for debugging purposes.
def debug(data):
pass

print ("Application Message: MachineMotion Program Starting \n")

mm = MachineMotion(debug, DEFAULT_IP_ADDRESS.usb_windows)
print ("Application Message: MachineMotion Controller Connected \n")

# Configure the axis number 1, 8 uSteps and 150 mm / turn for a timing belt
mm.configAxis(1, MICRO_STEPS.ustep_8, MECH_GAIN.timing_belt_150mm_turn)
print ("Application Message: MachineMotion Axis 1 Configured \n")

# Configuring the travel speed to 10000 mm / min
mm.emitSpeed(10000)
print ("Application Message: Speed configured \n")

# Configuring the travel speed to 1000 mm / second^2
mm.emitAcceleration(1000)
print ("Application Message: Acceleration configured \n")

# Homing axis 1
mm.emitHome(1)
print ("Application Message: Axis 1 at home \n")

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

mm.waitForMotionCompletion()
print ("Application Message: Motion completed \n")

print ("Application Message: Program terminating ... \n")
time.sleep(1)
sys.exit(0)
26 changes: 1 addition & 25 deletions examples/example--setPosition.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@



##################################################
## Set Position
##################################################
Expand Down Expand Up @@ -37,25 +34,4 @@ def debug(data):

print ("Application Message: Program terminating ... \n")
time.sleep(1)
sys.exit(0)
















// REGISTER 42: im_set_controller_pos_axis_2
if(data.search("SET im_set_controller_pos_axis_2") != -1) {
var userIntendedPositon = parseFloat(data.substring("SET im_set_controller_pos_axis_2".length + 1, data.length -1)) / 1000;
motion_controller.serialPortSendPacket("G92 Y" + userIntendedPositon);
socketSafeWrite(urSocket, "Ack");
sys.exit(0)

0 comments on commit 2353263

Please sign in to comment.