From d7015b655cffa005acf317d0cf579c84935efbf3 Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Sun, 26 Apr 2020 23:09:16 -0400 Subject: [PATCH 1/2] Trash vs Recycling Co-authored-by: dwitcpa - Combine pip3 install commands in Dockerfile - Add positions for trash and recycling bins - Classification is now just trash vs recycling - Remove extra bins, so we only have 2 - Increase default time limit to 10 minutes --- docker_env/gear/Dockerfile | 7 +++--- .../src/rrrobot/src/rrrobot_node.cpp | 24 ++++++++----------- src/rrrobot_ws/world/gear.py | 10 ++++---- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/docker_env/gear/Dockerfile b/docker_env/gear/Dockerfile index 7391995..47e828b 100644 --- a/docker_env/gear/Dockerfile +++ b/docker_env/gear/Dockerfile @@ -57,9 +57,8 @@ RUN pip3 install -U \ numpy \ torch \ torchvision \ - Pillow - -RUN pip3 install pyyaml -RUN pip3 install rospkg + Pillow \ + pyyaml \ + rospkg CMD ["/bin/bash"] diff --git a/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp b/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp index ecc9e1c..4a2931c 100644 --- a/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp +++ b/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp @@ -155,23 +155,19 @@ private: ros::ServiceClient conveyor_pub; ros::Publisher arm_destination_pub; + Position trash_bin = Position(-0.3, 0.383, 1); + Position recycle_bin = Position(-0.3, 1.15, 1); + Position destination(const std::string &type) const { Position pos; - float z = 1; - - if (type == "cardboard") - pos = Position(-0.3, -1.916, z); - else if (type == "glass") - pos = Position(-0.3, -1.15, z); - else if (type == "metal") - pos = Position(-0.3, -0.383, z); - else if (type == "paper") - pos = Position(-0.3, 0.383, z); - else if (type == "plastic") - pos = Position(-0.3, 1.15, z); - else if (type == "trash") - pos = Position(-0.3, 1.916, z); + + if(type == "trash") { + pos = trash_bin; + } + else { + pos = recycle_bin; + } return pos; } diff --git a/src/rrrobot_ws/world/gear.py b/src/rrrobot_ws/world/gear.py index bb4fcd6..29a73ce 100644 --- a/src/rrrobot_ws/world/gear.py +++ b/src/rrrobot_ws/world/gear.py @@ -113,12 +113,12 @@ bin_depth = 0.6 bin_height = 0.72 bin_angle = 0.0 default_bin_origins = { - 'bin1': [-0.3, -1.916, 0], - 'bin2': [-0.3, -1.15, 0], - 'bin3': [-0.3, -0.383, 0], + # 'bin1': [-0.3, -1.916, 0], + # 'bin2': [-0.3, -1.15, 0], + # 'bin3': [-0.3, -0.383, 0], 'bin4': [-0.3, 0.383, 0], 'bin5': [-0.3, 1.15, 0], - 'bin6': [-0.3, 1.916, 0], + # 'bin6': [-0.3, 1.916, 0], } configurable_options = { @@ -135,7 +135,7 @@ configurable_options = { 'visualize_sensor_views': False, 'visualize_drop_regions': False, } -default_time_limit = 500 # seconds +default_time_limit = 600 # seconds max_count_per_model = 30 # limit on the number of instances of each model type def initialize_model_id_mappings(random_seed=None): From 9404576a4f50a5ef02cf807d3734c98b224482ac Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Mon, 27 Apr 2020 00:47:10 -0400 Subject: [PATCH 2/2] Small Fixes - Add "/" to front of topic name in cv_model - Change default spawn point to be closer to depth camera - Fix desired grasp pose offset --- src/rrrobot_ws/src/rrrobot/config/rrrobot_sensors.yaml | 5 ----- src/rrrobot_ws/src/rrrobot/src/cv_model.py | 2 +- src/rrrobot_ws/src/rrrobot/src/object_spawner_node.cpp | 2 +- src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/rrrobot_ws/src/rrrobot/config/rrrobot_sensors.yaml b/src/rrrobot_ws/src/rrrobot/config/rrrobot_sensors.yaml index dbd3574..ca58aa4 100644 --- a/src/rrrobot_ws/src/rrrobot/config/rrrobot_sensors.yaml +++ b/src/rrrobot_ws/src/rrrobot/config/rrrobot_sensors.yaml @@ -1,9 +1,4 @@ sensors: - logical_camera_1: - type: logical_camera - pose: - xyz: [1.2, 3.5, 1.5] - rpy: [0, 1.5707, 0] depth_camera_1: type: depth_camera pose: diff --git a/src/rrrobot_ws/src/rrrobot/src/cv_model.py b/src/rrrobot_ws/src/rrrobot/src/cv_model.py index e9fd9ef..93d2d72 100644 --- a/src/rrrobot_ws/src/rrrobot/src/cv_model.py +++ b/src/rrrobot_ws/src/rrrobot/src/cv_model.py @@ -50,7 +50,7 @@ def call_back(filename): print('type: ', type_dict[predicted_label]) # publish a message, name of this node is 'cv_model' - pub = rospy.Publisher('cv_model', String, queue_size=10) + pub = rospy.Publisher('/cv_model', String, queue_size=10) # rospy.init_node('talker', anonymous=True) rate = rospy.Rate(10) # 10hz diff --git a/src/rrrobot_ws/src/rrrobot/src/object_spawner_node.cpp b/src/rrrobot_ws/src/rrrobot/src/object_spawner_node.cpp index 0b3a6fb..fd3c18b 100644 --- a/src/rrrobot_ws/src/rrrobot/src/object_spawner_node.cpp +++ b/src/rrrobot_ws/src/rrrobot/src/object_spawner_node.cpp @@ -20,7 +20,7 @@ class ObjectSpawner { public: ObjectSpawner(const std::string &model_file = "/app/rrrobot_ws/src/gazebo_models/model_mappings.txt") - : DEFAULT_SPAWN_POINT(1.21825, 5.474367, 0.937978), + : DEFAULT_SPAWN_POINT(1.21825, 4.0, 0.937978), CONVEYOR_WIDTH(0.391404) { // DEFAULT_SPAWN_POINT.x = 0.2516105; diff --git a/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp b/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp index fc8f275..4d5d38b 100644 --- a/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp +++ b/src/rrrobot_ws/src/rrrobot/src/rrrobot_node.cpp @@ -127,7 +127,7 @@ public: desired_grasp_pose = grasp_pose; // TODO: Tune z offset so end effector doesn't hit object - desired_grasp_pose.position.z -= 0.025; + desired_grasp_pose.position.z += 0.01; if (current_robot_state & RobotState::WAITING_FOR_CLASSIFICATION) {