diff --git a/.gitignore b/.gitignore index 3971e7b..cc0b46d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ # Don't track the content of these folders # ############################################ -rrrobot_src/lib/ -rrrobot_src/*/build -rrrobot_src/*/devel -rrrobot_src/*/install +rrrobot_ws/lib/ +rrrobot_ws/build +rrrobot_ws/devel +rrrobot_ws/install .* !.gitignore diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 6175db1..0000000 --- a/.gitmodules +++ /dev/null @@ -1,7 +0,0 @@ -[submodule "rrrobot_src/warehouse/src/ariac-gazebo_ros_pkgs"] - path = rrrobot_src/warehouse/src/ariac-gazebo_ros_pkgs - url = https://github.com/osrf/ariac-gazebo_ros_pkgs - branch = ariac-network-melodic -[submodule "rrrobot_src/warehouse/src/ariac"] - path = rrrobot_src/warehouse/src/ariac - url = https://bitbucket.org/osrf/ariac.git diff --git a/docker_env/docker-compose.yml b/docker_env/docker-compose.yml index b0a7726..0343d22 100644 --- a/docker_env/docker-compose.yml +++ b/docker_env/docker-compose.yml @@ -60,7 +60,7 @@ services: # Mount gazebo folder on host to app folder in container volumes: #- .docker_env/gazebo/.gazebo:/root/.gazebo - - ../rrrobot_src:/app/rrrobot_src + - ../rrrobot_ws:/app/rrrobot_ws # Set DISPLAY variable and network mode for GUIs environment: - DISPLAY=${IP_ADDRESS}:0.0 @@ -71,18 +71,18 @@ services: networks: - ros - # Warehouse Production Service - warehouse: - # Use Dockerfile in warehouse folder - build: ./warehouse - # Mount warehouse folder on host to app folder in container + # GEAR Production Service + gear: + # Use Dockerfile in gear folder + build: ./gear + # Mount gear folder on host to app folder in container volumes: - - ../rrrobot_src:/app/rrrobot_src + - ../rrrobot_ws:/app/rrrobot_ws # Set DISPLAY variable and network mode for GUIs environment: - DISPLAY=${IP_ADDRESS}:0.0 # Set working directory in container to app folder - # working_dir: /home/rrrobot + working_dir: /app/rrrobot_ws hostname: "rrrobot-env" networks: - ros diff --git a/docker_env/warehouse/Dockerfile b/docker_env/gear/Dockerfile similarity index 98% rename from docker_env/warehouse/Dockerfile rename to docker_env/gear/Dockerfile index 472258a..3002dac 100644 --- a/docker_env/warehouse/Dockerfile +++ b/docker_env/gear/Dockerfile @@ -1,4 +1,4 @@ -# Warehouse Dockerfile +# GEAR Dockerfile # Use official image for Gazebo 9.x FROM gazebo:gzserver9 diff --git a/docs/gear.md b/docs/gear.md new file mode 100644 index 0000000..cd8974e --- /dev/null +++ b/docs/gear.md @@ -0,0 +1,85 @@ +# GEAR Simulation + +## Running GEAR Container + +1. Go to `docker_env` folder + - `cd /PATH/TO/RRRobot/docker_env` +2. Start GEAR docker container + - `docker-compose run --rm gear` + +## Building & Running Sample Environment + +1. Source ROS Setup + - `source /opt/ros/melodic/setup.bash` + +2. Run sample environment + - `roslaunch osrf_gear sample_environment.launch` + +## Controlling Sample Environment + +While sample environment is running, open a new terminal (see tips & tricks section of [home](./home.md)) on the running docker container. The following sections provide a brief overview of the commands that can be used to control various aspects of the simulation. For a full list, check out the [ARIAC 2019 Wiki](https://bitbucket.org/osrf/ariac/wiki/2019/tutorials/gear_interface). + +[sample_run.sh](../rrrobot_ws/src/gear/sample_run.sh) moves arm 1 over the gasket part, picks it up, moves it to AGV1's tray, drops it, and moves back to the starting position. + +### Start Competition + +`rosservice call /ariac/start_competition` + +### Controlling Arms + +#### Gripper + +- Turn gripper suction on + - `rosservice call /ariac/arm1/gripper/control "enable: true"` +- Turn gripper suction off + - `rosservice call /ariac/arm1/gripper/control "enable: false"` + +#### Joints + +Move `arm1` over a gasket part + +``` +rostopic pub /ariac/arm1/arm/command trajectory_msgs/JointTrajectory "{joint_names: \ + ['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], \ + points: [ \ +{time_from_start: {secs: 2}, \ + positions: [0.15, 3.14, -1.570, 2.14, 3.1, -1.59, 0.126]}, \ +{time_from_start: {secs: 4}, \ + positions: [-0.35, 3.14, -0.6, 2.3, 3.0, -1.59, 0.126]}, \ +{time_from_start: {secs: 6}, \ + positions: [-0.35, 3.14, -0.5, 2.3, 3.05, -1.59, 0.126]}, \ +]}" -1 +``` + +Move part to `AGV1`'s tray + +``` +rostopic pub /ariac/arm1/arm/command trajectory_msgs/JointTrajectory "{joint_names: \ + ['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], \ + points: [ \ +{time_from_start: {secs: 2}, \ + positions: [0.0, 3.14, -1.570, 2.14, 3.27, -1.51, 0.0]}, \ +{time_from_start: {secs: 5}, \ + positions: [1.0, 1.85, 0, -0.38, 1.57, -1.51, 0.00]}, \ +{time_from_start: {secs: 7}, \ + positions: [1.0, 1.507, 0, -0.38, 0.38, -1.51, 0.00]}, \ +{time_from_start: {secs: 10}, \ + positions: [1.18, 1.507, 0.38, -0.38, 1.55, 1.75, 0.127]}, \ +]}" -1 +``` + +Return to starting position + +``` +rostopic pub /ariac/arm1/arm/command trajectory_msgs/JointTrajectory "{joint_names: \ + ['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], \ + points: [ \ +{time_from_start: {secs: 5}, \ + positions: [0.0, 3.14, -1.570, 2.14, 3.27, -1.51, 0.0]}, \ +]}" -1 +``` diff --git a/docs/home.md b/docs/home.md index 24fc341..fe3991b 100644 --- a/docs/home.md +++ b/docs/home.md @@ -8,8 +8,9 @@ - [Docker Compose Services](#docker-compose-services) - [GUI Support](#gui-support) - [Running Docker Containers](#running-docker-containers) - - [Warehouse Simulation](#warehouse-simulation) - [Gazebo Grasping Simulation](#gazebo-grasping-simulation) + - [GEAR Simulation](#gear-simulation) + - [Tips & Tricks](#tips--tricks) ## Contributors @@ -30,6 +31,7 @@ 1. [Project Poster](1.%20Project%20Poster.pdf) 2. [Project Proposal](2.%20Project%20Proposal.pdf) +3. [Final Project - Overleaf (Read-Only)](https://www.overleaf.com/read/ncvksrzpvbmr) ## Introduction @@ -59,6 +61,10 @@ ros is the production container for all ROS nodes we create. This is meant to ru Similarly to ros, gazebo is the production container for gazebo. This is meant to run our final simulation. +#### gear + +The GEAR container includes the Gazebo Environment for Agile Robotics from the Agile Robotics for Industrial Automation Competition 2019. + ### GUI Support If using VcXsrv for Windows to enable GUI applications, run XLaunch using [config.xlaunch](utils/config.xlaunch). This will enable the following settings: @@ -100,23 +106,6 @@ Additionally, be sure to update the `IP_ADDRESS` variable in [.env](src/.env) wi 4. Use Docker Compose to run a service (refer to [docker-compose.yml](src/docker-compose.yml) or [Docker Compose Services](#docker-compose-services)) - `docker-compose run --rm ` -### Warehouse Simulation - -1. Go to `docker_env` folder - - `cd /PATH/TO/RRRobot/docker_env` -2. Start gazebo docker container - - `docker-compose run --rm warehouse` -3. Source ROS Setup - - `source /opt/ros/melodic/setup.bash` -4. Go to warehouse folder in container - - `cd /app/rrrobot_src/warehouse` -5. Build package - - `catkin_make clean` - - `catkin_make` - - `catkin_make install` -6. Run sample environment - - `roslaunch osrf_gear sample_environment.launch` - ### Gazebo Grasping Simulation 1. Source ROS Setup @@ -129,3 +118,16 @@ Additionally, be sure to update the `IP_ADDRESS` variable in [.env](src/.env) wi 4. Run the gazebo simulator - this will bring up gazebo with a robotic arm - `gazebo /app/rrrobot_src/world/rrrobot.world` 5. Run control and perception programs + +### GEAR Simulation + +Instructions for working in the GEAR Simulation can be found on the [GEAR](gear.md) page. + +### Tips & Tricks + +- Clear space on docker machine + - `docker system prune --volumes` +- See running containers + - `docker ps` +- Attach a new terminal to a running container + - `docker exec -it bash` diff --git a/rrrobot_src/src/simulation_env/include/simulation_env/.keep b/rrrobot_src/src/simulation_env/include/simulation_env/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/rrrobot_src/warehouse/src/CMakeLists.txt b/rrrobot_src/warehouse/src/CMakeLists.txt deleted file mode 100644 index e5cafb2..0000000 --- a/rrrobot_src/warehouse/src/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -# toplevel CMakeLists.txt for a catkin workspace -# catkin/cmake/toplevel.cmake - -cmake_minimum_required(VERSION 3.0.2) - -set(CATKIN_TOPLEVEL TRUE) - -# search for catkin within the workspace -set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") -execute_process(COMMAND ${_cmd} - RESULT_VARIABLE _res - OUTPUT_VARIABLE _out - ERROR_VARIABLE _err - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE -) -if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) - # searching fot catkin resulted in an error - string(REPLACE ";" " " _cmd_str "${_cmd}") - message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") -endif() - -# include catkin from workspace or via find_package() -if(_res EQUAL 0) - set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") - # include all.cmake without add_subdirectory to let it operate in same scope - include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) - add_subdirectory("${_out}") - -else() - # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument - # or CMAKE_PREFIX_PATH from the environment - if(NOT DEFINED CMAKE_PREFIX_PATH) - if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") - if(NOT WIN32) - string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) - else() - set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) - endif() - endif() - endif() - - # list of catkin workspaces - set(catkin_search_path "") - foreach(path ${CMAKE_PREFIX_PATH}) - if(EXISTS "${path}/.catkin") - list(FIND catkin_search_path ${path} _index) - if(_index EQUAL -1) - list(APPEND catkin_search_path ${path}) - endif() - endif() - endforeach() - - # search for catkin in all workspaces - set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) - find_package(catkin QUIET - NO_POLICY_SCOPE - PATHS ${catkin_search_path} - NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - unset(CATKIN_TOPLEVEL_FIND_PACKAGE) - - if(NOT catkin_FOUND) - message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.") - endif() -endif() - -catkin_workspace() diff --git a/rrrobot_src/warehouse/src/ariac b/rrrobot_src/warehouse/src/ariac deleted file mode 160000 index 0fb5984..0000000 --- a/rrrobot_src/warehouse/src/ariac +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0fb5984fb2e7f75606c29b4a3a412a8283e933a5 diff --git a/rrrobot_src/warehouse/src/ariac-gazebo_ros_pkgs b/rrrobot_src/warehouse/src/ariac-gazebo_ros_pkgs deleted file mode 160000 index 2b4816a..0000000 --- a/rrrobot_src/warehouse/src/ariac-gazebo_ros_pkgs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2b4816ac70353ed981ef06a6627b0265da7b1fbe diff --git a/rrrobot_src/build.sh b/rrrobot_ws/build.sh old mode 100755 new mode 100644 similarity index 100% rename from rrrobot_src/build.sh rename to rrrobot_ws/build.sh diff --git a/rrrobot_src/src/CMakeLists.txt b/rrrobot_ws/src/CMakeLists.txt similarity index 100% rename from rrrobot_src/src/CMakeLists.txt rename to rrrobot_ws/src/CMakeLists.txt diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/arm_joint_and_link_definitions.jpg b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/arm_joint_and_link_definitions.jpg similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/arm_joint_and_link_definitions.jpg rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/arm_joint_and_link_definitions.jpg diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_1.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_1.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_1.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_1.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_2.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_2.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_2.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_2.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_3.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_3.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_3.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_3.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_4.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_4.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_4.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_4.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_5.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_5.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_5.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_5.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_6.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_6.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_6.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/arm_link_6.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/base_link.STL b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/base_link.STL similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/meshes/base_link.STL rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/meshes/base_link.STL diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/model.config b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/model.config similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/model.config rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/model.config diff --git a/rrrobot_src/src/gazebo_models/fanuc_robotic_arm/model.sdf b/rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/model.sdf similarity index 100% rename from rrrobot_src/src/gazebo_models/fanuc_robotic_arm/model.sdf rename to rrrobot_ws/src/gazebo_models/fanuc_robotic_arm/model.sdf diff --git a/rrrobot_ws/src/gear/sample_run.sh b/rrrobot_ws/src/gear/sample_run.sh new file mode 100644 index 0000000..d1516ae --- /dev/null +++ b/rrrobot_ws/src/gear/sample_run.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Start Competition +rosservice call /ariac/start_competition + +# Wait +sleep 2 + +# Move arm1 over a gasket part +rostopic pub /ariac/arm1/arm/command trajectory_msgs/JointTrajectory "{joint_names: \ + ['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], \ + points: [ \ +{time_from_start: {secs: 2}, \ + positions: [0.15, 3.14, -1.570, 2.14, 3.1, -1.59, 0.126]}, \ +{time_from_start: {secs: 4}, \ + positions: [-0.35, 3.14, -0.6, 2.3, 3.0, -1.59, 0.126]}, \ +{time_from_start: {secs: 6}, \ + positions: [-0.35, 3.14, -0.5, 2.3, 3.05, -1.59, 0.126]}, \ +]}" -1 + +# Wait for arm to move +sleep 8 + +# Turn gripper suction on +rosservice call /ariac/arm1/gripper/control "enable: true" + +# Wait for suction +sleep 2 + +# Move part to AGV1's tray +rostopic pub /ariac/arm1/arm/command trajectory_msgs/JointTrajectory "{joint_names: \ + ['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], \ + points: [ \ +{time_from_start: {secs: 2}, \ + positions: [0.0, 3.14, -1.570, 2.14, 3.27, -1.51, 0.0]}, \ +{time_from_start: {secs: 5}, \ + positions: [1.0, 1.85, 0, -0.38, 1.57, -1.51, 0.00]}, \ +{time_from_start: {secs: 7}, \ + positions: [1.0, 1.507, 0, -0.38, 0.38, -1.51, 0.00]}, \ +{time_from_start: {secs: 10}, \ + positions: [1.18, 1.507, 0.38, -0.38, 1.55, 1.75, 0.127]}, \ +]}" -1 + +# Wait for arm to move +sleep 12 + +# Turn gripper suction off +rosservice call /ariac/arm1/gripper/control "enable: false" + +# Wait for suction +sleep 2 + +# Return to starting position +rostopic pub /ariac/arm1/arm/command trajectory_msgs/JointTrajectory "{joint_names: \ + ['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], \ + points: [ \ +{time_from_start: {secs: 5}, \ + positions: [0.0, 3.14, -1.570, 2.14, 3.27, -1.51, 0.0]}, \ +]}" -1 + +# Wait for arm to move +sleep 7 diff --git a/rrrobot_src/src/simulation_env/CMakeLists.txt b/rrrobot_ws/src/simulation_env/CMakeLists.txt similarity index 100% rename from rrrobot_src/src/simulation_env/CMakeLists.txt rename to rrrobot_ws/src/simulation_env/CMakeLists.txt diff --git a/rrrobot_src/src/simulation_env/msg/arm_angles.msg b/rrrobot_ws/src/simulation_env/msg/arm_angles.msg similarity index 100% rename from rrrobot_src/src/simulation_env/msg/arm_angles.msg rename to rrrobot_ws/src/simulation_env/msg/arm_angles.msg diff --git a/rrrobot_src/src/simulation_env/msg/arm_command.msg b/rrrobot_ws/src/simulation_env/msg/arm_command.msg similarity index 100% rename from rrrobot_src/src/simulation_env/msg/arm_command.msg rename to rrrobot_ws/src/simulation_env/msg/arm_command.msg diff --git a/rrrobot_src/src/simulation_env/package.xml b/rrrobot_ws/src/simulation_env/package.xml similarity index 100% rename from rrrobot_src/src/simulation_env/package.xml rename to rrrobot_ws/src/simulation_env/package.xml diff --git a/rrrobot_src/src/simulation_env/src/arm_angle_sensor_plugin.cpp b/rrrobot_ws/src/simulation_env/src/arm_angle_sensor_plugin.cpp similarity index 100% rename from rrrobot_src/src/simulation_env/src/arm_angle_sensor_plugin.cpp rename to rrrobot_ws/src/simulation_env/src/arm_angle_sensor_plugin.cpp diff --git a/rrrobot_src/src/simulation_env/src/arm_motors.cpp b/rrrobot_ws/src/simulation_env/src/arm_motors.cpp similarity index 100% rename from rrrobot_src/src/simulation_env/src/arm_motors.cpp rename to rrrobot_ws/src/simulation_env/src/arm_motors.cpp diff --git a/rrrobot_src/src/simulation_env/test/move_arm.cpp b/rrrobot_ws/src/simulation_env/test/move_arm.cpp similarity index 100% rename from rrrobot_src/src/simulation_env/test/move_arm.cpp rename to rrrobot_ws/src/simulation_env/test/move_arm.cpp diff --git a/rrrobot_src/world/rrrobot.world b/rrrobot_ws/world/rrrobot.world similarity index 100% rename from rrrobot_src/world/rrrobot.world rename to rrrobot_ws/world/rrrobot.world