-
Notifications
You must be signed in to change notification settings - Fork 0
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
Copy stuff #1
base: master
Are you sure you want to change the base?
Copy stuff #1
Conversation
# Save calibration point and observed checkerboard center | ||
observed_pts.append([checkerboard_x,checkerboard_y,checkerboard_z]) | ||
# tool_position[2] += checkerboard_offset_from_tool | ||
tool_position = tool_position + checkerboard_offset_from_tool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is tool_position, or more specifically, what is the tool they are referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the tool_position is referring to the gripper. The code sets the tool_position to 'calib_grid_pts' that does calibration of the camera/gripper. Part of the paper: " The camera is localized with respect to the robot base by an automatic calibration procedure, during which the camera tracks the location of a checkerboard pattern taped onto the gripper. The calibration optimizes for extrinsics as the robot moves the gripper over a grid of 3D locations (predefined with respect to robot coordinates) within the camera field of view"
|
||
# Repeatedly grasp at middle of workspace | ||
grasp_position = np.sum(workspace_limits, axis=1)/2 | ||
grasp_position[2] = -0.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 22-25, where did they get these numbers from/what are these numbers for with respect to what?
executed_action_log = executed_action_log[0:max_iteration,:] | ||
reward_value_log = np.loadtxt(os.path.join(transitions_directory, 'reward-value.log.txt'), delimiter=' ') | ||
reward_value_log = reward_value_log[0:max_iteration] | ||
clearance_log = np.loadtxt(os.path.join(transitions_directory, 'clearance.log.txt'), delimiter=' ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we copy over the clearance.log.txt file? What did they put in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the log files would be generated during testing/training?
grasp_to_push_ratio[trial_idx-1] = float(len(tmp_grasp_attempt_ind))/float(len(tmp_executed_action_log)) | ||
|
||
# Count number of times grasp attempts were successful | ||
if method == 'reactive': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was mentioned in the paper: the different point values for reactive and reinforcement.
force_cpu = args.force_cpu | ||
|
||
# ------------- Algorithm options ------------- | ||
method = args.method # 'reactive' (supervised learning) or 'reinforcement' (reinforcement learning ie Q-learning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is where they mention the difference between reactive and reinforcement learning algorithms
depth_diff[depth_diff > 0.3] = 0 | ||
depth_diff[depth_diff < 0.01] = 0 | ||
depth_diff[depth_diff > 0] = 1 | ||
change_threshold = 300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did they arrive at the 300 value for change_threshold? What does this value mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trial and error.
trainer.preload(logger.transitions_directory) | ||
|
||
# Initialize variables for heuristic bootstrapping and exploration probability | ||
no_change_count = [2, 2] if not is_testing else [0, 0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is no_change_count = [2,2], what do the 2's represent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the comment below "If heuristic bootstrapping is enabled: if change has not been detected more than 2 times, execute heuristic algorithm to detect grasps/pushes".
The count is how many times it has changed, so I guess they want to use the heuristic algorithm instead of exploring different states with exploration probability.
return cam_pts, rgb_pts | ||
|
||
|
||
def get_heightmap(color_img, depth_img, cam_intrinsics, cam_pose, workspace_limits, heightmap_resolution): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function to get heightmap from camera
return vis | ||
|
||
|
||
def get_difference(color_heightmap, color_space, bg_color_heightmap): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get difference between two heightmaps
|
||
|
||
|
||
# DEPRECATED CAMERA CLASS FOR REALSENSE WITH ROS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ROS for the camera (commented out code)
|
||
time.sleep(0.01) | ||
action_thread = threading.Thread(target=process_actions) | ||
action_thread.daemon = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A daemon thread does not block the main thread from exiting and continues to run in the background.
self.output_prob = [] | ||
|
||
|
||
def forward(self, input_color_data, input_depth_data, is_volatile=False, specific_rotation=-1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between is_volatile being True or False in this function besides the fact that the variables if is_volatile is True are local while if it's False, the variables are a part of the class?
nonlocal_variables['executing_action'] = False | ||
|
||
time.sleep(0.01) | ||
action_thread = threading.Thread(target=process_actions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the training/testing loop always runs. The thread is running in the background and if nonlocal_variables['executing_action'] == True
then execute the command and add the result to the training dataset.
|
||
# Default home joint configuration | ||
# self.home_joint_config = [-np.pi, -np.pi/2, np.pi/2, -np.pi/2, -np.pi/2, 0] | ||
self.home_joint_config = [-(180.0/360.0)*2*np.pi, -(84.2/360.0)*2*np.pi, (112.8/360.0)*2*np.pi, -(119.7/360.0)*2*np.pi, -(90.0/360.0)*2*np.pi, 0.0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did they get some of these ratios?
('push-conv0', nn.Conv2d(2048, 64, kernel_size=1, stride=1, bias=False)), | ||
('push-norm1', nn.BatchNorm2d(64)), | ||
('push-relu1', nn.ReLU(inplace=True)), | ||
('push-conv1', nn.Conv2d(64, 1, kernel_size=1, stride=1, bias=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.pushnet and self.graspnet nn.conv2d(64,1) for reinforcement and (64,3) for reactive
if best_push_conf > best_grasp_conf: | ||
nonlocal_variables['primitive_action'] = 'push' | ||
explore_actions = np.random.uniform() < explore_prob | ||
if explore_actions: # Exploitation (do best action) vs exploration (do other action) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exploit/ Explore strategy
# Adjust exploration probability | ||
if not is_testing: | ||
explore_prob = max(0.5 * np.power(0.9998, trainer.iteration),0.1) if explore_rate_decay else 0.5 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Experience replay
# Construct 3D calibration grid across workspace | ||
gridspace_x = np.linspace(workspace_limits[0][0], workspace_limits[0][1], 1 + (workspace_limits[0][1] - workspace_limits[0][0])/calib_grid_step) | ||
gridspace_y = np.linspace(workspace_limits[1][0], workspace_limits[1][1], 1 + (workspace_limits[1][1] - workspace_limits[1][0])/calib_grid_step) | ||
gridspace_z = np.linspace(workspace_limits[2][0], workspace_limits[2][1], 1 + (workspace_limits[2][1] - workspace_limits[2][0])/calib_grid_step) | ||
calib_grid_x, calib_grid_y, calib_grid_z = np.meshgrid(gridspace_x, gridspace_y, gridspace_z) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part in the paper that links to the code:
"the location of a checkerboard pattern taped onto the gripper. The calibration optimizes for extrinsics as the robot moves the gripper over a grid of 3D locations (predefined with respect to robot coordinates) within the camera field of view"
No description provided.