Skip to content

Commit

Permalink
prototyping record hand data (#338)
Browse files Browse the repository at this point in the history
* prototyping record hand data

* prototyping record hand data

* testing

* move to more appropriate defaults

* testing

* testing

* testing

* testing

* testing

* testing

* testing

* testing

* testing

* move bagging to nuc

* move bag folder on nuc

* add rsync cron job

* become yes cron

* testing

* quote int

* rsync options

* testing

* remove files from source after successful transfer

* remove debug, set to false if not true

* how did that get there

* tidying

* testing

* testing

* tidying

* testing

* tidying

* add to all deployment options for testing

* Add remote bag configuration to simulation

* Inlcude remote bag recording in server tasks

* remove testing

* Update main.yml

* Update simulation.yml

* Update control_machine.yml

Co-authored-by: carebare47 <tom@shadowrobot.com>
Co-authored-by: Fotios Papadopoulos <fotios@shadowrobot.com>
Co-authored-by: mykolasjuraitis <75975027+mykolasjuraitis@users.noreply.github.com>
Co-authored-by: Build Tools <build.tools@example.com>
  • Loading branch information
5 people authored Apr 19, 2021
1 parent e64c298 commit 56adbf8
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ansible/inventory/teleop/group_vars/control_machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ arm_ip_left: "" # Specify the IP address of left arm
arm_ip_right: "" # Specify the IP address of right arm
ur_robot_type: "ur10e" # Specify ur robot type: ur10, ur10e, ur5, ur5e
biotacs: true # Whether the hands will have biotac fingertips
bag_all_data_from: ["shadowrobot_210312", "shadowrobot_210311"]
remote_bag_user: "shadowop"
remote_bag_storage_IP: "10.5.10.59"
remote_bag_storage_location: "/volume1/ros_bags"
pr_branches: "" # Space-separated list of PRs (https://github.com/shadow-robot/repo/pull/266) or branches (https://github.com/shadow-robot/repo/tree/custom_branch) to check out on NUC and catkin_make
ansible_become_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
Expand Down
4 changes: 4 additions & 0 deletions ansible/inventory/teleop/group_vars/simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ remote_teleop: false # Flag to enable/disable remote_teleop software install
ur_robot_type: "ur10e" # Specify ur robot type: ur10, ur10e, ur5, ur5e
arm_ip_left: "" # Specify the IP address of left arm
arm_ip_right: "" # Specify the IP address of right arm
bag_all_data_from: ["shadowrobot_210312", "shadowrobot_210311"]
remote_bag_user: "shadowop"
remote_bag_storage_IP: "10.5.10.59"
remote_bag_storage_location: "/volume1/ros_bags"
pr_branches: "" # Space-separated list in double quotes of PRs and branches like this "https://github.com/shadow-robot/repo/pull/266 https://github.com/shadow-robot/repo/tree/custom_branch" to check out on server and catkin_make
scene_file: "" # Allows the user to override the scene_file used in GUI launch e.g. scene_file="\$(find sr_description_common)/scenes/custom.scene" (if empty, default in Github will be used)
haptx_teleop_readthedocs_token: !vault |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ pr_branches: ""
product: ""
private_github_ssh_key_base64: ""
private_ssh_keys_path: "{{ user_folder }}/.ssh/id_rsa_private"
record_hand_data: "disabled"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
set_fact:
shared_volumes: "{{ common_shared_volumes + container_type_shared_volumes + custom_shared_volumes }}"

- name: Find out if we should record all data from these hands
set_fact:
record_hand_data: "enabled"
when: config_branch in bag_all_data_from

- name: Creating the container with no terminator and no setup
changed_when: false
community.docker.docker_container:
Expand All @@ -26,6 +31,7 @@
ROS_MASTER_URI: "http://{{ ros_master }}:11311"
arm_ips: "{{ arm_ip_right }}_{{ arm_ip_left }}"
XDG_RUNTIME_DIR: "/run/user/1000"
SR_RECORD_HAND_DATA: "{{ record_hand_data }}"
network_mode: "host"
pid_mode: "host"
privileged: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
ROS_MASTER_URI: "http://{{ ros_master }}:11311"
arm_ips: "{{ arm_ip_right }}_{{ arm_ip_left }}"
XDG_RUNTIME_DIR: "/run/user/1000"
SR_RECORD_HAND_DATA: "{{ record_hand_data }}"
network_mode: "host"
pid_mode: "host"
privileged: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
NVIDIA_DRIVER_CAPABILITIES: "all"
arm_ips: "{{ arm_ip_right }}_{{ arm_ip_left }}"
XDG_RUNTIME_DIR: "/run/user/1000"
SR_RECORD_HAND_DATA: "{{ record_hand_data }}"
network_mode: "host"
pid_mode: "host"
privileged: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
container_type_shared_volumes:
- "{{ user_folder }}/.Xauthority:/home/user/.Xauthority"

- name: Find out if we should record all data from these hands
set_fact:
record_hand_data: "enabled"
when: config_branch in bag_all_data_from

- name: Set shared volumes
set_fact:
shared_volumes: "{{ common_shared_volumes + container_type_shared_volumes + custom_shared_volumes }}"
Expand All @@ -26,6 +31,7 @@
ROS_MASTER_URI: "http://{{ ros_master }}:11311"
arm_ips: "{{ arm_ip_right }}_{{ arm_ip_left }}"
XDG_RUNTIME_DIR: "/run/user/1000"
SR_RECORD_HAND_DATA: "{{ record_hand_data }}"
network_mode: "host"
pid_mode: "host"
privileged: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
ROS_MASTER_URI: "http://{{ ros_master }}:11311"
arm_ips: "{{ arm_ip_right }}_{{ arm_ip_left }}"
XDG_RUNTIME_DIR: "/run/user/1000"
SR_RECORD_HAND_DATA: "{{ record_hand_data }}"
network_mode: "host"
pid_mode: "host"
privileged: yes
Expand All @@ -33,3 +34,4 @@
command: "terminator {{ term_args }} -T '{{ container_terminal_title }}' -x bash -c '[[ -e {{ setup_directory }}/{{ setup_script }} ]] && {{ setup_directory }}/{{ setup_script }} && bash || bash'"
container_default_behavior: compatibility
become: yes

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
bag_all_data_from: []
27 changes: 27 additions & 0 deletions ansible/roles/products/common/record-hand-data/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
- name: Custom shared volume for bag storage
block:
- name: Set shadow_bag_storage folder names
set_fact:
shadow_bag_storage_folder: "{{ user_folder }}/shadow_bag_storage"
shadow_bag_storage_inside_docker: "/home/user/shadow_bag_storage"

- name: Ensure {{ shadow_bag_storage_folder }} folder exists
file:
path: "{{ shadow_bag_storage_folder }}"
mode: '755'
state: directory

- name: Set custom shared volumes for docker container
set_fact:
custom_shared_volumes:
- "{{ shadow_bag_storage_folder }}:{{ shadow_bag_storage_inside_docker }}"

# Creates a cron file under /etc/cron.d
- cron:
name: sync hand data to NAS
hour: "20"
user: user
job: "rsync -azP --remove-source-files --exclude '*active*' {{ shadow_bag_storage_folder }}/ {{ remote_bag_user }}@{{ remote_bag_storage_IP }}:{{ remote_bag_storage_location }} >> /home/user/hand_cron_log 2>&1"
cron_file: sr_sync_hand_data_to_nas
become: true
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
include_role:
name: installation/chrony-client

- name: Include products/common/record-hand-data role
include_role:
name: products/common/record-hand-data
when: config_branch in bag_all_data_from

- name: Include docker/docker-image role
include_role:
name: docker/docker-image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ haptx_teleop_readthedocs_token: ""
shadow_glove_teleop_readthedocs_token: ""
pr_branches: ""
polhemus_type: "viper"
bag_all_data_from: []
5 changes: 5 additions & 0 deletions ansible/roles/products/teleop/server/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
name: installation/chrony-server
when: groups['server'] is defined

- name: Include products/common/record-hand-data role
include_role:
name: products/common/record-hand-data
when: config_branch in bag_all_data_from

- name: Include installation/shadow_glove_driver role
include_role:
name: installation/shadow_glove_driver
Expand Down

0 comments on commit 56adbf8

Please sign in to comment.