Skip to content

Commit

Permalink
Src 5502 changing right ethercat variable (#305)
Browse files Browse the repository at this point in the history
* updating varible and fixing some errors

* fixing an error

* changing a missed ethercat_interface

* fixed molecule tests (#302)

* fixes (#303)

* fixes

* Delete main.yml

* fixes due to molecule (#304)

Co-authored-by: ToivoS <[email protected]>
  • Loading branch information
georgiablanco and ToivoS authored Nov 9, 2020
1 parent b89844b commit e344e0b
Show file tree
Hide file tree
Showing 49 changed files with 122 additions and 54 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ If no inventory name is provided, and if remote_teleop=true, then "production_re
Example for real robots with haptx bimanual teleop:

```bash
bash <(curl -Ls bit.ly/run-aurora) teleop_deploy --inventory production --read-input docker_username --read-secure docker_password ethercat_interface=enx000ec6bfe185 ethercat_left_hand=enx000ec6c042d5 config_branch=bimanual_demohands_B_D reinstall=true bimanual=true use_aws=true upgrade_check=true image="shadowrobot/teleop-haptx-binary" tag="melodic-v0.0.1" glove=haptx use_steamvr=false arm_ip_right="10.8.1.1" arm_ip_left="10.8.2.1" ethercat_right_arm=eno1 ethercat_left_arm=enx000ec6bfe175
bash <(curl -Ls bit.ly/run-aurora) teleop_deploy --inventory production --read-input docker_username --read-secure docker_password ethercat_right_hand=enx000ec6bfe185 ethercat_left_hand=enx000ec6c042d5 config_branch=bimanual_demohands_B_D reinstall=true bimanual=true use_aws=true upgrade_check=true image="shadowrobot/teleop-haptx-binary" tag="melodic-v0.0.1" glove=haptx use_steamvr=false arm_ip_right="10.8.1.1" arm_ip_left="10.8.2.1" ethercat_right_arm=eno1 ethercat_left_arm=enx000ec6bfe175
```

Example for simulated robots without a real vive system or real gloves:
Expand Down Expand Up @@ -136,7 +136,7 @@ bash <(curl -Ls bit.ly/run-aurora) server_and_nuc_deploy option1=value1 option2=
Example:

```bash
bash <(curl -Ls bit.ly/run-aurora) server_and_nuc_deploy product=hand_e ethercat_interface=enx5647929203 config_branch=demohand_C
bash <(curl -Ls bit.ly/run-aurora) server_and_nuc_deploy product=hand_e ethercat_right_hand=enx5647929203 config_branch=demohand_C
```

Options for server_and_nuc_deploy playbook are here for the following machines:
Expand Down Expand Up @@ -169,28 +169,28 @@ launches the hand.

**Ethercat interface**

Before running the docker_deploy playbook, the ethercat_interface parameter for the hand needs to be discovered. In order to do so, after plugging the hand’s ethernet cable into your machine and powering it up, please run
Before running the docker_deploy playbook, the ethercat_right_hand parameter for the hand needs to be discovered. In order to do so, after plugging the hand’s ethernet cable into your machine and powering it up, please run
```shell
sudo dmesg
```
command in the console. At the bottom, there will be information similar to the one below:
```shell
[490.757853] IPv6: ADDRCONF(NETDEV_CHANGE): enp0s25: link becomes ready
```
In the above example, ‘enp0s25’ is the ethercat_interface that is needed.
In the above example, ‘enp0s25’ is the ethercat_right_hand that is needed.

**How to run:**

Open a terminal with Ctrl+Alt+T and run:

```bash
bash <(curl -Ls bit.ly/run-aurora) docker_deploy ethercat_interface=enp0s25 option1=value1 option2=value2 option3=value3
bash <(curl -Ls bit.ly/run-aurora) docker_deploy ethercat_right_hand=enp0s25 option1=value1 option2=value2 option3=value3
```

Example:

```bash
bash <(curl -Ls bit.ly/run-aurora) docker_deploy product=hand_e ethercat_interface=enp0s25 config_branch=demohand_C
bash <(curl -Ls bit.ly/run-aurora) docker_deploy product=hand_e ethercat_right_hand=enp0s25 config_branch=demohand_C
```
Options for docker_deploy playbook are [here](ansible/inventory/local/group_vars/docker_deploy.yml)

Expand Down Expand Up @@ -294,6 +294,12 @@ Before executing any tests, it is very useful to make sure you have unlimited sc

Once you have written your code for aurora in your branch, test it locally with Molecule first before pushing to GitHub.

There are some molecule_docker tests which require connecting to AWS to download files (such as downloading the hand manual). For this reason, before running any Molecule tests, ask the system administrator for your AWS access key and secret access key. Then, in the docker container terminal, type:
```
export AWS_ACCESS_KEY=your_key
export AWS_SECRET_KEY=your_secret
```

1. In the docker container terminal execute the following command:

```
Expand Down Expand Up @@ -737,6 +743,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/local/group_vars
Expand Down
2 changes: 1 addition & 1 deletion ansible/inventory/local/group_vars/docker_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nvidia_docker: false # Define if nvidia docker 2 is used (default is false)
desktop_icon: true # Generates a desktop icon to launch the hand
cyberglove: "" # Specify the branch of sr_cyberglove_config for cyberglove configuration
use_aws: false # Flag to prompt for customer key for uploading files to AWS
ethercat_interface: "eth0" # Ethercat interface of the right hand
ethercat_right_hand: "eth0" # Ethercat interface of the right hand
ethercat_left_hand: "enx1" # Ethercat interface of the left hand
config_branch: "" # Specify the branch for the specific hand (Only for dexterous hand)
shortcut_name: "Shadow_Hand_Launcher" # Specify the name for the desktop icon (default: Shadow_Hand_Launcher)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tag: "melodic-release" # Tag of the exact Docker hub image to pull
product: '' # Name of the product (hand_e, arm_hand_e, hand_lite, arm_hand_lite, hand_extra_lite, arm_hand_extra_lite, hand_h)
reinstall: false # Flag to know if the docker container should be fully reinstalled
container_name: "dexterous_hand_real_hw" # Name of the docker container
ethercat_interface: "eth0" # Ethercat interface of the right hand
ethercat_right_hand: "eth0" # Ethercat interface of the right hand
ethercat_left_hand: "enx1" # Ethercat interface of the left hand
ethercat_right_arm: "enp3s0" # Ethercat interface of the right arm
ethercat_left_arm: "enx2" # Ethercat interface of the left arm
Expand Down
2 changes: 1 addition & 1 deletion ansible/inventory/teleop/group_vars/control_machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image: "shadowrobot/shadow-teleop-polhemus" # Docker image name
tag: "melodic-night-build" # Tag of the exact Docker hub image to pull
reinstall: false # Flag to know if the docker container should be fully reinstalled
container_name: "teleop" # Name of the docker container
ethercat_interface: "eth0" # Ethercat interface of the right hand
ethercat_right_hand: "eth0" # Ethercat interface of the right hand
bimanual: false # Determines if left arm and left hand should be set up
ethercat_left_hand: "enx1" # Ethercat interface of the left hand
ethercat_left_arm: "enx2" # Ethercat interface of the left arm
Expand Down
15 changes: 13 additions & 2 deletions ansible/playbooks/docker_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
pre_tasks:

- name: No product is defined
when: product != 'hand_e' and product != 'arm_hand_e' and product != 'hand_lite' and product != 'arm_hand_lite' and product != 'hand_extra_lite' and product != 'arm_hand_extra_lite' and product != 'hand_h'
when: (product != 'hand_e') and
(product != 'arm_hand_e') and
(product != 'hand_lite') and
(product != 'arm_hand_lite') and
(product != 'hand_extra_lite') and
(product != 'arm_hand_extra_lite') and
(product != 'hand_h')
meta: end_play

- name: check if customer_key is provided and not false
Expand All @@ -25,5 +31,10 @@
- {role: installation/docker}
- {role: installation/nvidia-docker, when: nvidia_docker | bool}
- {role: products/hand-h/deploy, when: product == 'hand_h'}
- {role: products/hand-e/deploy, when: product == 'hand_e' or product == 'arm_hand_e' or product == 'hand_lite' or product == 'arm_hand_lite' or product == 'hand_extra_lite' or product == 'arm_hand_extra_lite' }
- {role: products/hand-e/deploy, when: (product == 'hand_e') or
(product == 'arm_hand_e') or
(product == 'hand_lite') or
(product == 'arm_hand_lite') or
(product == 'hand_extra_lite') or
(product == 'arm_hand_extra_lite')}
- {role: docker/aws, when: use_aws|bool}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
- name: Docker deploy playbook for non existing product
import_playbook: ../../../docker_deploy.yml
product="non_existing_product"
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
allow_auto_reboot=true
skip_molecule_task=true
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/local/group_vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Docker deploy playbook for Hand E
import_playbook: ../../../docker_deploy.yml
product="hand_e"
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
container_name="test_hand_e_empty_machine_container"
allow_auto_reboot=true
skip_molecule_task=true
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
playbooks:
cleanup: cleanup.yml
inventory:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
skip_molecule_task=true
allow_auto_reboot=true
reinstall=true
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
ethercat_left_hand="enx1"
nvidia_docker=false
config_branch="demohand_A"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/server_and_nuc/group_vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_icons_in_docker(host):
'shadow_local_zero_force_mode_right_launcher',
'shadow_local_zero_force_mode_left_launcher',
'shadow_zero_force_mode_right',
'shadow_zero_force_mode_left'
'shadow_zero_force_mode_left'
)
for icon in icons:
assert host.file(desktop_path+icon+'.desktop').exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import_playbook: ../../../teleop_deploy.yml
reinstall=true
use_openvpn=false
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
image="shadowrobot/dexterous-hand"
tag="melodic-release"
nvidia_docker=false
allow_auto_reboot=true
remote_teleop=true
skip_molecule_task=true
ansible_become_password=ubuntu
ansible_ssh_pass=ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/teleop/group_vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
tag="melodic-release"
reinstall=true
use_openvpn=false
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
nvidia_docker=false
allow_auto_reboot=true
bimanual=true
Expand All @@ -14,3 +14,5 @@
ethercat_left_arm="enx0002"
config_branch="bimanual_demohands_B_D"
skip_molecule_task=true
ansible_become_password=ubuntu
ansible_ssh_pass=ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/teleop/group_vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import_playbook: ../../../teleop_deploy.yml
reinstall=true
use_openvpn=false
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
image="shadowrobot/dexterous-hand"
tag="melodic-release"
nvidia_docker=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/teleop/group_vars
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import testinfra.utils.ansible_runner
import docker

testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import_playbook: ../../../teleop_deploy.yml
reinstall=true
use_openvpn=false
ethercat_interface="enp0s25"
ethercat_right_hand="enp0s25"
image="shadowrobot/dexterous-hand"
tag="melodic-release"
nvidia_docker=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/teleop/group_vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_icons_in_docker(host):
'shadow_local_zero_force_mode_right_launcher',
'shadow_local_zero_force_mode_left_launcher',
'shadow_zero_force_mode_right',
'shadow_zero_force_mode_left'
'shadow_zero_force_mode_left'
)
for icon in icons:
assert host.file(desktop_path+icon+'.desktop').exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../roles
AWS_ACCESS_KEY: ${AWS_ACCESS_KEY}
AWS_SECRET_KEY: ${AWS_SECRET_KEY}
inventory:
links:
group_vars: ../../../../inventory/teleop/group_vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')


def test_icons_in_docker(host):
desktop_path = '/home/' + str(host.user().name) + '/Desktop/'
script_path = '/home/' + str(host.user().name) + \
Expand Down
30 changes: 26 additions & 4 deletions ansible/playbooks/server_and_nuc_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@
hosts: server
pre_tasks:
- name: No product is defined
when: product != 'hand_e' and product != 'arm_hand_e' and product != 'hand_lite' and product != 'arm_hand_lite' and product != 'hand_extra_lite' and product != 'arm_hand_extra_lite' and product != 'hand_h'
when: (product != 'hand_e') and
(product != 'arm_hand_e') and
(product != 'hand_lite') and
(product != 'arm_hand_lite') and
(product != 'hand_extra_lite') and
(product != 'arm_hand_extra_lite') and
(product != 'hand_h')
meta: end_play

- name: check if customer_key is provided and not false
Expand All @@ -65,13 +71,24 @@
become: yes

roles:
- { role: products/hand-e/server/deploy, when: product == 'hand_e' or product == 'arm_hand_e' or product == 'hand_lite' or product == 'arm_hand_lite' or product == 'hand_extra_lite' or product == 'arm_hand_extra_lite' }
- { role: products/hand-e/server/deploy, when: (product == 'hand_e') or
(product == 'arm_hand_e') or
(product == 'hand_lite') or
(product == 'arm_hand_lite') or
(product == 'hand_extra_lite') or
(product == 'arm_hand_extra_lite') }

- name: Install Hand software on control machine
hosts: control_machine
pre_tasks:
- name: No product is defined
when: product != 'hand_e' and product != 'arm_hand_e' and product != 'hand_lite' and product != 'arm_hand_lite' and product != 'hand_extra_lite' and product != 'arm_hand_extra_lite' and product != 'hand_h'
when: (product != 'hand_e') and
(product != 'arm_hand_e') and
(product != 'hand_lite') and
(product != 'arm_hand_lite') and
(product != 'hand_extra_lite') and
(product != 'arm_hand_extra_lite') and
(product != 'hand_h')
meta: end_play

- name: check if customer_key is provided and not false
Expand All @@ -95,7 +112,12 @@
become: yes

roles:
- { role: products/hand-e/control_machine/deploy, when: product == 'hand_e' or product == 'arm_hand_e' or product == 'hand_lite' or product == 'arm_hand_lite' or product == 'hand_extra_lite' or product == 'arm_hand_extra_lite' }
- { role: products/hand-e/control_machine/deploy, when: (product == 'hand_e') or
(product == 'arm_hand_e') or
(product == 'hand_lite') or
(product == 'arm_hand_lite') or
(product == 'hand_extra_lite') or
(product == 'arm_hand_extra_lite')}

- name: Inform user for reboot
hosts: 127.0.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ container_name: "dexterous_hand_real_hw"
image: "shadowrobot/dexterous-hand"
tag: "melodic-release"
full_image_name: "shadowrobot/dexterous-hand:melodic-release"
ethercat_interface: "eth0"
ethercat_right_hand: "eth0"
launch_hand: true
config_branch: ""
use_cyberglove: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pull: yes
env:
verbose: "true"
interface: "{{ ethercat_interface }}"
interface: "{{ ethercat_right_hand }}"
interface_left: "{{ ethercat_left_hand }}"
QT_X11_NO_MITSHM: "1"
LOCAL_USER_ID: "{{ id.stdout }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
pull: yes
env:
verbose: "true"
interface: "{{ ethercat_interface }}"
interface: "{{ ethercat_right_hand }}"
interface_left: "{{ ethercat_left_hand }}"
QT_X11_NO_MITSHM: "1"
LOCAL_USER_ID: "{{ id.stdout }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
runtime: "{{ docker_runtime }}"
env:
verbose: "true"
interface: "{{ ethercat_interface }}"
interface: "{{ ethercat_right_hand }}"
interface_left: "{{ ethercat_left_hand }}"
QT_X11_NO_MITSHM: "1"
LOCAL_USER_ID: "{{ id.stdout }}"
Expand Down
Loading

0 comments on commit e344e0b

Please sign in to comment.