-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from norkator/MOVJ
MOVJ support
- Loading branch information
Showing
7 changed files
with
185 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
Commander class for joint moves | ||
""" | ||
|
||
from nx100_remote_control.module import Commands, Utils | ||
import time | ||
|
||
|
||
class JointMove(object): | ||
|
||
# Class constructor | ||
def __init__(self): | ||
self.stopped = False | ||
|
||
def go(self, move_j, wait=True, poll_limit_seconds=30): | ||
""" | ||
commands robot to move into position linear way | ||
:param move_j: MoveJ object describing target position and move settings | ||
:param wait: wait for move to complete or not | ||
:param poll_limit_seconds: functions as a timeout of wait is enabled | ||
:return: boolean | ||
""" | ||
self.stopped = False | ||
Commands.write_hold('0') # disable hold if currently enabled | ||
Commands.write_joint_motion_move(move_j=move_j) # execute wanted move command | ||
current = 0 | ||
if not wait: | ||
return True | ||
for x in range(poll_limit_seconds): | ||
if self.stopped: | ||
return False | ||
time.sleep(1) | ||
cp = Commands.read_current_specified_coordinate_system_position( # returns CurrentPos object | ||
str(move_j.get_coordinate_specification), '0' | ||
) | ||
if Utils.is_in_position(move_j, cp): | ||
return True | ||
else: | ||
current = current + 1 | ||
if current == poll_limit_seconds: | ||
return False | ||
|
||
def stop(self): | ||
""" | ||
stop upper go function | ||
""" | ||
self.stopped = True | ||
Commands.write_hold('1') # only way to stop robot from executing move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
class MoveJ(object): | ||
|
||
""" | ||
!!! WARNING !!! | ||
!!! motion_speed_percentage 100% could be dangerous !!! | ||
!!! robot can do very quick movements !!! | ||
""" | ||
|
||
# coordinate_specification options | ||
coordinate_specification_base_coordinate = 0 # base coordinate option | ||
coordinate_specification_robot_coordinate = 1 # robot coordinate option | ||
coordinate_specification_user_1_coordinate = 2 # user 1 coordinate option | ||
|
||
# Class constructor | ||
def __init__(self, motion_speed_percentage, coordinate_specification, | ||
x, y, z, tx, ty, tz, d_10, d_11=0, d_12=0, d_13=0, d_14=0, d_15=0, d_16=0, d_17=0): | ||
self.motion_speed_percentage = motion_speed_percentage | ||
self.coordinate_specification = coordinate_specification | ||
self.x = x | ||
self.y = y | ||
self.z = z | ||
self.tx = tx | ||
self.ty = ty | ||
self.tz = tz | ||
self.d_10 = d_10 | ||
self.d_11 = d_11 | ||
self.d_12 = d_12 | ||
self.d_13 = d_13 | ||
self.d_14 = d_14 | ||
self.d_15 = d_15 | ||
self.d_16 = d_16 | ||
self.d_17 = d_17 | ||
|
||
def get_command(self): | ||
separator = ', ' | ||
return separator.join([ | ||
str(self.motion_speed_percentage), | ||
str(self.coordinate_specification), | ||
str(self.x), | ||
str(self.y), | ||
str(self.z), | ||
str(self.tx), | ||
str(self.ty), | ||
str(self.tz), | ||
str(self.d_10), | ||
str(self.d_11), | ||
str(self.d_12), | ||
str(self.d_13), | ||
str(self.d_14), | ||
str(self.d_15), | ||
str(self.d_16), | ||
str(self.d_17) | ||
]) | ||
|
||
def get_coordinate_specification(self): | ||
return self.coordinate_specification | ||
|
||
def get_x(self): | ||
return self.x | ||
|
||
def get_y(self): | ||
return self.y | ||
|
||
def get_z(self): | ||
return self.z | ||
|
||
def get_tx(self): | ||
return self.tx | ||
|
||
def get_ty(self): | ||
return self.ty | ||
|
||
def get_tz(self): | ||
return self.tz |