diff --git a/compose-files/ur-demo/README.md b/compose-files/ur-demo/README.md new file mode 100644 index 00000000..73c311cf --- /dev/null +++ b/compose-files/ur-demo/README.md @@ -0,0 +1,13 @@ +# UR Demo + +To use with simulator, run: + +```bash +docker compose -f docker-compose.yml -f docker-compose.sim.yml up +``` + +For the real robot, use the following command: + +```bash +docker compose -f docker-compose.yml -f docker-compose.lab.yml up +``` \ No newline at end of file diff --git a/compose-files/ur-demo/docker-compose.lab.yml b/compose-files/ur-demo/docker-compose.lab.yml index 35d6ad92..180f1389 100644 --- a/compose-files/ur-demo/docker-compose.lab.yml +++ b/compose-files/ur-demo/docker-compose.lab.yml @@ -1,6 +1,7 @@ services: ur-demo-robot-api: - ports: - - "50002:50002" # robot connects to this port environment: - - ROBOT_CONTAINER_NAME=ur-20245500974 \ No newline at end of file + - ROBOT_IP=192.168.104.149 + volumes: + - ./robot_calibration.yaml:/root/robot_calibration.yaml + network_mode: host # ObjectType has to connect to localhost:5012 \ No newline at end of file diff --git a/compose-files/ur-demo/docker-compose.sim.yml b/compose-files/ur-demo/docker-compose.sim.yml new file mode 100644 index 00000000..b89feeb9 --- /dev/null +++ b/compose-files/ur-demo/docker-compose.sim.yml @@ -0,0 +1,32 @@ +services: + ur-demo-ursim: + image: universalrobots/ursim_e-series:5.17.2 + container_name: ur-demo-ursim + ports: # network_mode: host can't be (easily) used as ursim starts its own X server + - "5900:5900" # VNC port + - "6080:6080" # web VNC +# - "30001:30001" +# - "30002:30002" +# - "30004:30004" +# - "29999:29999" + networks: + - ur-demo-network + environment: + - ROBOT_MODEL=UR5 + volumes: + - ursim-gui-cache:/ursim/GUI + - urcap-build-cache:/ursim/.urcaps + - ursim-programs:/ursim/programs + ur-demo-robot-api: + environment: + - ROBOT_IP=ur-demo-ursim + - SLEEP=10 + networks: + - ur-demo-network # ObjectType has to connect to ur-demo-ursim:5012 + +volumes: + ursim-gui-cache: + urcap-build-cache: + ursim-programs: + ur-demo-asset: + ur-demo-execution: \ No newline at end of file diff --git a/compose-files/ur-demo/docker-compose.yml b/compose-files/ur-demo/docker-compose.yml index 83ccb4dc..b8de9f80 100644 --- a/compose-files/ur-demo/docker-compose.yml +++ b/compose-files/ur-demo/docker-compose.yml @@ -1,27 +1,11 @@ services: - ur-demo-ursim: - image: universalrobots/ursim_e-series:5.17.2 - container_name: ur-demo-ursim - ports: - - "5900:5900" # VNC port - - "6080:6080" # web VNC - networks: - - ur-demo-network - environment: - - ROBOT_MODEL=UR5 - volumes: - - ursim-gui-cache:/ursim/GUI - - urcap-build-cache:/ursim/.urcaps - - ursim-programs:/ursim/programs ur-demo-robot-api: - image: arcor2/arcor2_ur:1.2.1 + image: arcor2/arcor2_ur:1.3.0 container_name: ur-demo-robot-api ports: - "5012:5012" # environment: # - ARCOR2_UR_DEBUG=1 - networks: # TODO use network_mode: "host" for the real robot - - ur-demo-network restart: always # the service tends to crash when calling PUT /state/stop cap_add: - SYS_NICE @@ -162,7 +146,7 @@ services: - ur-demo-asset ur-demo-upload-object-types: - image: arcor2/arcor2_ur_ot:1.2.1 + image: arcor2/arcor2_ur_ot:1.3.0 container_name: "ur-demo-upload-object-types" depends_on: ur-demo-project: @@ -190,9 +174,6 @@ services: - ARCOR2_ASSET_SERVICE_URL=http://ur-demo-asset:10040 volumes: - ursim-gui-cache: - urcap-build-cache: - ursim-programs: ur-demo-asset: ur-demo-execution: diff --git a/compose-files/ur-demo/robot_calibration.yaml b/compose-files/ur-demo/robot_calibration.yaml new file mode 100644 index 00000000..df3831fa --- /dev/null +++ b/compose-files/ur-demo/robot_calibration.yaml @@ -0,0 +1,44 @@ +kinematics: + shoulder: + x: 0 + y: 0 + z: 0.16253268591029907 + roll: -0 + pitch: 0 + yaw: -3.9706105474032749e-07 + upper_arm: + x: 5.9721945474714789e-05 + y: 0 + z: 0 + roll: 1.5694161246097016 + pitch: 0 + yaw: 3.8856764585994165e-07 + forearm: + x: -0.42536553582483921 + y: 0 + z: 0 + roll: 3.1411247028186096 + pitch: 3.1406202190734502 + yaw: 3.141591474472873 + wrist_1: + x: -0.39236572259516306 + y: -0.00038526533421009263 + z: 0.13417899372885142 + roll: 0.0028712711637521563 + pitch: 3.3546609413013983e-05 + yaw: 1.2608447936119974e-06 + wrist_2: + x: 5.7243914837099386e-05 + y: -0.099710274078176342 + z: 5.5554929734187943e-05 + roll: 1.5702391633079928 + pitch: 0 + yaw: 4.5241975821577735e-07 + wrist_3: + x: 9.4768738018291456e-05 + y: 0.099660684607093819 + z: 3.0152958512421488e-05 + roll: 1.5710988829905641 + pitch: 3.1415926535897931 + yaw: 3.1415926477648899 + hash: calib_15111234226826911485 \ No newline at end of file diff --git a/src/docker/arcor2_ur/BUILD b/src/docker/arcor2_ur/BUILD index cc7cd9fe..448aa4ee 100644 --- a/src/docker/arcor2_ur/BUILD +++ b/src/docker/arcor2_ur/BUILD @@ -1,2 +1,2 @@ shell_source(name="start.sh", source="start.sh") -docker_image(name="arcor2_ur", repository="arcor2/arcor2_ur", dependencies=[":start.sh", "build-support:install_ur_dependencies.sh"], image_tags=["1.2.1"]) +docker_image(name="arcor2_ur", repository="arcor2/arcor2_ur", dependencies=[":start.sh", "build-support:install_ur_dependencies.sh"], image_tags=["1.3.0"]) diff --git a/src/docker/arcor2_ur/start.sh b/src/docker/arcor2_ur/start.sh index d43d589a..695a5fb9 100755 --- a/src/docker/arcor2_ur/start.sh +++ b/src/docker/arcor2_ur/start.sh @@ -1,15 +1,20 @@ #!/bin/bash +set -e + # shellcheck source=/dev/null source /opt/ros/jazzy/setup.bash : "${UR_TYPE:=ur5e}" -: "${ROBOT_CONTAINER_NAME:=ur-demo-ursim}" -ROBOT_CONTAINER_IP=$(getent hosts "$ROBOT_CONTAINER_NAME" | awk '{ print $1 }') +# simulator needs some time to get running... +if [[ -n "$SLEEP" && "$SLEEP" =~ ^[0-9]+$ ]]; then + echo "Waiting for $SLEEP seconds..." + sleep "$SLEEP" +fi -sleep 10s # TODO find a way how to detect that the robot is up and running (test if some port is opened?) +cp --update=none "$(ros2 pkg prefix --share ur_description)/config/$UR_TYPE/default_kinematics.yaml" /root/robot_calibration.yaml -ros2 launch ur_robot_driver ur_control.launch.py ur_type:="$UR_TYPE" robot_ip:="$ROBOT_CONTAINER_IP" launch_rviz:=false & +ros2 launch ur_robot_driver ur_control.launch.py ur_type:="$UR_TYPE" robot_ip:="$ROBOT_IP" launch_rviz:=false kinematics_params_file:="/root/robot_calibration.yaml" & PEX_EXTRA_SYS_PATH=/opt/ros/jazzy/lib/python3.12/site-packages PYTHONOPTIMIZE=1 /bin/app/pex diff --git a/src/docker/arcor2_ur_ot/BUILD b/src/docker/arcor2_ur_ot/BUILD index 7d190288..c6ef0b8b 100644 --- a/src/docker/arcor2_ur_ot/BUILD +++ b/src/docker/arcor2_ur_ot/BUILD @@ -1 +1 @@ -docker_image(name="arcor2_ur_ot", repository="arcor2/arcor2_ur_ot", image_tags=["1.2.1"]) +docker_image(name="arcor2_ur_ot", repository="arcor2/arcor2_ur_ot", image_tags=["1.3.0"]) diff --git a/src/python/arcor2_ur/CHANGELOG.md b/src/python/arcor2_ur/CHANGELOG.md index 7e1a62de..207c061a 100644 --- a/src/python/arcor2_ur/CHANGELOG.md +++ b/src/python/arcor2_ur/CHANGELOG.md @@ -2,6 +2,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +## [1.3.0] - 2024-10-01 + +### Changed + +- Docker image now checks for a robot calibration file at `/root/robot_calibration.yaml`. If not given, a default one is used. +- `ROBOT_CONTAINER_IP` was changed to `ROBOT_IP`. + ## [1.2.1] - 2024-09-30 ### Fixed diff --git a/src/python/arcor2_ur/VERSION b/src/python/arcor2_ur/VERSION index cb174d58..589268e6 100644 --- a/src/python/arcor2_ur/VERSION +++ b/src/python/arcor2_ur/VERSION @@ -1 +1 @@ -1.2.1 \ No newline at end of file +1.3.0 \ No newline at end of file