Skip to content

Commit 9abbe0d

Browse files
Deployed 2109ee9 to 0.3 with MkDocs 1.6.1 and mike 2.1.3
1 parent d8e83b5 commit 9abbe0d

18 files changed

+325
-152
lines changed

0.3/search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0.3/sitemap.xml

Lines changed: 106 additions & 106 deletions
Large diffs are not rendered by default.

0.3/sitemap.xml.gz

0 Bytes
Binary file not shown.

0.3/stretch-body/body/stretch_body/dynamixel_X_chain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ def is_trajectory_active(self):
129129
return True
130130
return False
131131

132-
def follow_trajectory(self, v_r=None, a_r=None, req_calibration=False, move_to_start_point=True):
132+
def follow_trajectory(self, v_r=None, a_r=None, move_to_start_point=True):
133133
success = True
134134
for motor in self.motors:
135-
success = success and self.motors[motor].follow_trajectory(v_r, a_r, req_calibration, move_to_start_point)
135+
success = success and self.motors[motor].follow_trajectory(v_r, a_r, move_to_start_point)
136136
return success
137137

138138
def update_trajectory(self):

0.3/stretch-body/body/stretch_body/dynamixel_hello_XL430.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ def get_trajectory_time_remaining(self):
914914
else:
915915
return max(0,self.trajectory.waypoints[-1].time - self.get_trajectory_ts())
916916

917-
def follow_trajectory(self, v_r=None, a_r=None, req_calibration=True, move_to_start_point=True):
917+
def follow_trajectory(self, v_r=None, a_r=None, move_to_start_point=True):
918918
"""Starts executing a waypoint trajectory
919919
920920
`self.trajectory` must be populated with a valid trajectory before calling
@@ -926,8 +926,6 @@ def follow_trajectory(self, v_r=None, a_r=None, req_calibration=True, move_to_st
926926
velocity limit for trajectory in radians per second
927927
a_r : float
928928
acceleration limit for trajectory in radians per second squared
929-
req_calibration : bool
930-
whether to allow motion prior to homing
931929
move_to_start_point : bool
932930
whether to move to the trajectory's start to avoid a jump, this
933931
time to move doesn't count against the trajectory's timeline
@@ -936,10 +934,9 @@ def follow_trajectory(self, v_r=None, a_r=None, req_calibration=True, move_to_st
936934
if not self.hw_valid:
937935
self.logger.warning('Dynamixel connection to hardware not valid')
938936
return False
939-
if req_calibration:
940-
if not self.is_calibrated:
941-
self.logger.warning('Dynamixel not homed')
942-
return False
937+
if self.params['req_calibration'] and not self.is_calibrated:
938+
self.logger.warning('Dynamixel not homed')
939+
return False
943940
if self._waypoint_ts is not None:
944941
self.logger.error('Dynamixel waypoint trajectory already active')
945942
return False
@@ -973,6 +970,10 @@ def follow_trajectory(self, v_r=None, a_r=None, req_calibration=True, move_to_st
973970
if not self.wait_until_at_setpoint():
974971
self.logger.warning('Dynamixel unable to reach starting point')
975972
return False
973+
else:
974+
if not np.isclose(self.trajectory[0].position, self.status['pos'], atol=self.params['distance_tol']):
975+
self.logger.warning("Can't start joint traj: first waypoint doesn't match current position")
976+
return False
976977

977978
# start trajectory
978979
self._waypoint_ts = time.time()

0.3/stretch-body/body/stretch_body/prismatic_joint.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import stretch_body.hello_utils as hu
66
import time
77
import sys
8+
import numpy as np
89

910

1011
class PrismaticJoint(Device):
@@ -480,8 +481,10 @@ def follow_trajectory(self, v_m=None, a_m=None, stiffness=None, contact_thresh_p
480481
if prev_sync_mode:
481482
self.motor.enable_sync_mode()
482483
self.push_command()
483-
#print('WAIT')
484-
#time.sleep(2.0)
484+
else:
485+
if not np.isclose(self.trajectory[0].position, self.status['pos'], atol=self.params['distance_tol']):
486+
self.logger.warning("Can't start joint traj: first waypoint doesn't match current position")
487+
return False
485488

486489
self.traj_guarded_event=self.motor.status['guarded_event']
487490
# start trajectory

0.3/stretch-body/body/stretch_body/robot.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,10 @@ def is_trajectory_active(self):
490490
self.head.is_trajectory_active()
491491

492492

493-
def follow_trajectory(self):
493+
def follow_trajectory(self, move_to_start_point=False):
494494
success = True
495-
success = success and self.arm.follow_trajectory(move_to_start_point=False)
496-
success = success and self.lift.follow_trajectory(move_to_start_point=False)
495+
success = success and self.arm.follow_trajectory(move_to_start_point=move_to_start_point)
496+
success = success and self.lift.follow_trajectory(move_to_start_point=move_to_start_point)
497497
success = success and self.base.follow_trajectory()
498498

499499
# Check if need to do a motor sync by looking at if there's been a pimu sync signal sent
@@ -506,8 +506,17 @@ def follow_trajectory(self):
506506
if self.pimu.ts_last_motor_sync is None or sync_required:
507507
self.pimu.trigger_motor_sync()
508508

509-
success = success and self.end_of_arm.follow_trajectory(move_to_start_point=False)
510-
success = success and self.head.follow_trajectory(move_to_start_point=False)
509+
success = success and self.end_of_arm.follow_trajectory(move_to_start_point=move_to_start_point)
510+
success = success and self.head.follow_trajectory(move_to_start_point=move_to_start_point)
511+
512+
# TODO: HACK! We need a way to queue waypoint trajectories to
513+
# joints before starting execution. Currently, each joint's
514+
# `follow_trajectory` does both. If arm's traj is valid and
515+
# starts executing, but lift's traj isn't, the arm doesn't
516+
# know that the lift didn't start and keeps going.
517+
if not success:
518+
self.stop_trajectory()
519+
511520
return success
512521

513522
def stop_trajectory(self):

0.3/stretch-body/body/stretch_body/robot_params.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ class RobotParams:
5757
4. stretch_configuration_params.yaml | Robot specific data (eg, serial numbers and calibrations). Calibration tools may update these.
5858
5. stretch_user_params.yaml | User specific data (eg, contact thresholds, controller tunings, etc)
5959
"""
60-
user_params_fn = hello_utils.get_fleet_directory()+'stretch_user_params.yaml'
61-
config_params_fn = hello_utils.get_fleet_directory()+'stretch_configuration_params.yaml'
60+
calibration_dir = hello_utils.get_fleet_directory()
61+
if not exists(calibration_dir):
62+
_valid_params=False
63+
print('Calibration directory missing. Please contact Hello Robot Support')
64+
sys.exit(1)
65+
user_params_fn = calibration_dir+'stretch_user_params.yaml'
66+
config_params_fn = calibration_dir+'stretch_configuration_params.yaml'
6267
if not hello_utils.check_file_exists(user_params_fn) or not hello_utils.check_file_exists(config_params_fn):
6368
_valid_params=False
6469
print('Please run tool RE1_migrate_params.py or verify if Stretch configuration YAML files are present before continuing.\nFor more details, see https://forum.hello-robot.com/t/425')

0.3/stretch-body/body/stretch_body/robot_params_RE1V0.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@
131131
'retry_on_comm_failure': 1,
132132
'baud': 115200,
133133
'enable_runstop': 1,
134-
'disable_torque_on_stop': 1}
134+
'disable_torque_on_stop': 1,
135+
'distance_tol': 0.015}
135136

136137
RE1V0_wrist_yaw={
137138
'device_info': "Standard wrist yaw shipped with original RE1",
@@ -177,7 +178,8 @@
177178
'baud': 115200,
178179
'enable_runstop': 1,
179180
'disable_torque_on_stop': 1,
180-
'range_pad_t': [100.0, -100.0]}
181+
'range_pad_t': [100.0, -100.0],
182+
'distance_tol': 0.015}
181183

182184
#Brought in from tool_share for DexWrist "2"
183185
RE1V0_wrist_pitch_DW2={
@@ -218,7 +220,8 @@
218220
'disable_torque_on_stop': 0,
219221
'float_on_stop': 1,
220222
'current_float_A': -0.13,
221-
'current_limit_A': 2.5
223+
'current_limit_A': 2.5,
224+
'distance_tol': 0.03
222225
}
223226

224227
RE1V0_wrist_roll_DW2={
@@ -259,7 +262,8 @@
259262
'disable_torque_on_stop': 0,
260263
'float_on_stop': 1,
261264
'current_float_A': 0.04,
262-
'current_limit_A': 1.0
265+
'current_limit_A': 1.0,
266+
'distance_tol': 0.015
263267
}
264268

265269
# ######### EndOfArm Defn ##############
@@ -397,7 +401,8 @@
397401
'vel_m': 0.3,
398402
'accel_m': 0.5},
399403
'vel_brakezone_factor': 0.03},
400-
'set_safe_velocity': 1},
404+
'set_safe_velocity': 1,
405+
'distance_tol': 0.008},
401406
'base':{
402407
'usb_name_left_wheel': '/dev/hello-motor-left-wheel',
403408
'usb_name_right_wheel': '/dev/hello-motor-right-wheel',
@@ -496,7 +501,8 @@
496501
'stall_max_effort': 20.0,
497502
'stall_backoff': 0.017,
498503
'stall_max_time': 1.0,
499-
'stall_min_vel': 0.1},
504+
'stall_min_vel': 0.1,
505+
'distance_tol': 0.15},
500506
'head_tilt':{
501507
'range_pad_t': [50.0, -50.0],
502508
'flip_encoder_polarity': 1,
@@ -542,7 +548,8 @@
542548
'stall_backoff': 0.017,
543549
'stall_max_effort': 20.0,
544550
'stall_max_time': 1.0,
545-
'stall_min_vel': 0.1},
551+
'stall_min_vel': 0.1,
552+
'distance_tol': 0.52},
546553
'hello-motor-arm':{
547554
'gains':{
548555
'effort_LPF': 10.0,
@@ -719,7 +726,8 @@
719726
'accel_m': 0.3},
720727
'vel_brakezone_factor': 0.02},
721728
'set_safe_velocity': 1,
722-
'pinion_t': 12},
729+
'pinion_t': 12,
730+
'distance_tol': 0.015},
723731
'pimu':{
724732
'usb_name': '/dev/hello-pimu',
725733
'base_fan_off': 70,

0.3/stretch-body/body/stretch_body/robot_params_RE2V0.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@
127127
'enable_runstop': 1,
128128
'disable_torque_on_stop': 1,
129129
'range_t': [0, 8022],
130-
'zero_t': 5212}
130+
'zero_t': 5212,
131+
'distance_tol': 0.015}
131132

132133
RE2V0_wrist_yaw={
133134
'device_info': "Standard wrist yaw shipped with original RE2",
@@ -175,7 +176,8 @@
175176
'disable_torque_on_stop': 1,
176177
'range_pad_t': [100.0, -100.0],
177178
'range_t': [0,9340],
178-
'zero_t': 7005}
179+
'zero_t': 7005,
180+
'distance_tol': 0.015}
179181

180182
#Brought in from tool_share for DexWrist "2"
181183
RE2V0_wrist_pitch_DW2={
@@ -216,7 +218,8 @@
216218
'disable_torque_on_stop': 0,
217219
'float_on_stop': 1,
218220
'current_float_A': -0.13,
219-
'current_limit_A': 2.5
221+
'current_limit_A': 2.5,
222+
'distance_tol': 0.03
220223
}
221224

222225
RE2V0_wrist_roll_DW2={
@@ -257,7 +260,8 @@
257260
'disable_torque_on_stop': 0,
258261
'float_on_stop': 1,
259262
'current_float_A': 0.04,
260-
'current_limit_A': 1.0
263+
'current_limit_A': 1.0,
264+
'distance_tol': 0.015
261265
}
262266

263267
# ######### EndOfArm Defn ##############
@@ -397,7 +401,8 @@
397401
'vel_m': 0.4,
398402
'accel_m': 0.4},
399403
'vel_brakezone_factor': 0.03},
400-
'set_safe_velocity': 1},
404+
'set_safe_velocity': 1,
405+
'distance_tol': 0.008},
401406
'base':{
402407
'usb_name_left_wheel': '/dev/hello-motor-left-wheel',
403408
'usb_name_right_wheel': '/dev/hello-motor-right-wheel',
@@ -498,7 +503,8 @@
498503
'stall_min_vel': 0.1,
499504
'range_pad_t':[50.0,-50.0],
500505
'range_t': [0, 3827],
501-
'zero_t': 1250},
506+
'zero_t': 1250,
507+
'distance_tol': 0.15},
502508
'head_tilt':{
503509
'flip_encoder_polarity': 1,
504510
'gr': 1.0,
@@ -546,7 +552,8 @@
546552
'stall_min_vel': 0.1,
547553
'range_pad_t': [50.0, -50.0],
548554
'range_t': [1775,3150],
549-
'zero_t': 2048},
555+
'zero_t': 2048,
556+
'distance_tol': 0.52},
550557
'hello-motor-arm':{
551558
'gains':{
552559
'effort_LPF': 10.0,
@@ -723,7 +730,8 @@
723730
'vel_m': 0.15},
724731
'vel_brakezone_factor': 0.01},
725732
'set_safe_velocity': 1,
726-
'pinion_t': 12},
733+
'pinion_t': 12,
734+
'distance_tol': 0.015},
727735
'pimu':{
728736
'usb_name': '/dev/hello-pimu',
729737
'base_fan_off': 70,

0 commit comments

Comments
 (0)