Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for use in a UR arm with 3.2+ firmware #4

Open
wants to merge 1 commit into
base: indigo_fix_deserialize_v32
Choose a base branch
from
Open
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
24 changes: 22 additions & 2 deletions ur_driver/src/ur_driver/deserialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def unpack(buf):
return RobotModeData_V18.unpack(buf)
elif plen == 38:
return RobotModeData_V30.unpack(buf)
elif plen == 46:
return RobotModeData_V32.unpack(buf)
else:
print "RobotModeData has wrong length: " + str(plen)
return rmd
Expand All @@ -121,7 +123,7 @@ def unpack(buf):
rmd.speed_fraction) = struct.unpack_from("!IBQ???????Bd", buf)
return rmd

#this parses RobotModeData for versions >=3.0 (i.e. 3.0)
#this parses RobotModeData for versions >=3.0 (i.e. 3.0, 3.1)
class RobotModeData_V30(object):
__slots__ = ['timestamp', 'robot_connected', 'real_robot_enabled',
'power_on_robot', 'emergency_stopped',
Expand All @@ -138,6 +140,24 @@ def unpack(buf):
rmd.target_speed_fraction, rmd.speed_scaling) = struct.unpack_from("!IBQ???????BBdd", buf)
return rmd

#this parses RobotModeData for versions >=3.2 (i.e. 3.2)
class RobotModeData_V32(object):
__slots__ = ['timestamp', 'robot_connected', 'real_robot_enabled',
'power_on_robot', 'emergency_stopped',
'security_stopped', 'program_running', 'program_paused',
'robot_mode', 'control_mode', 'target_speed_fraction',
'speed_scaling', 'targetSpeedFractionLimit']
@staticmethod
def unpack(buf):
rmd = RobotModeData_V32()
(_, _,
rmd.timestamp, rmd.robot_connected, rmd.real_robot_enabled,
rmd.power_on_robot, rmd.emergency_stopped, rmd.security_stopped,
rmd.program_running, rmd.program_paused, rmd.robot_mode, rmd.control_mode,
rmd.target_speed_fraction, rmd.speed_scaling,
rmd.targetSpeedFractionLimit) = struct.unpack_from("!IBQ???????BBddd", buf)
return rmd

#this parses JointData for all versions (i.e. 1.6, 1.7, 1.8, 3.0)
class JointData(object):
__slots__ = ['q_actual', 'q_target', 'qd_actual',
Expand Down Expand Up @@ -302,7 +322,7 @@ def unpack(buf):
(plen, ptype) = struct.unpack_from("!IB", buf)
if plen == 10:
return AdditionalInfoOld.unpack(buf)
elif plen == 7:
elif plen == 7 or plen == 8:
return AdditionalInfoNew.unpack(buf)
else:
print "AdditionalInfo has wrong length: " + str(plen)
Expand Down