uoft-cs-robotics / robot_system_tools

Repository containing software infrastructure for running experiments on Franka Emika Panda Arms
9 stars 3 forks source link

Test the documentation for the robot infra docker #8

Closed kouroshD closed 1 year ago

kouroshD commented 1 year ago

first I search for the nuc machine:

we have two options for the ubuntu installation: https://ubuntu.com/download/intel-nuc

OS asked from Ruthrash: ubuntu 20.0 with RT_preempt patch kernel

https://unix.stackexchange.com/questions/650320/installing-preempt-rt-kernel-on-ubuntu-20-04

I have updated the ubuntu from 18.04 to 20.04, following the instructions in https://www.omgubuntu.co.uk/2020/04/how-to-upgrade-to-ubuntu-20-04

I am going to follow the instructions here to install RT-preempt patch kernel on ubuntu 20.04.

make sure that correct options after changes to the prompt of make menuconfig is saved.

I had the following problem while rebooting, so I did as it was mentioned in the notes:

If you encounter errors that you fail to boot the new kernel see Cannot boot realtime kernel because of “Invalid Signature”

the RT kernel has been verified, as mentioned in the link of the instructions.

kouroshD commented 1 year ago

missing dependency for the cloning git clone https://github.com/pairlab/franka_arm_infra.git

sudo apt install git

kouroshD commented 1 year ago

I had this error when trying https://github.com/pairlab/franka_arm_infra#usage-instructions on Workstation Computer:

docker exec -it workstation_computer_docker bash

the error is:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/workstation_computer_docker/json": dial unix /var/run/docker.sock: connect: permission denied

and here there is a written a solution for that: https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue

I think https://github.com/pairlab/franka_arm_infra#usage-instructions, the header should be bigger wrt to real time and workstation computers!

kouroshD commented 1 year ago

Frankapy can be used with the control_computer docker and optionally with workstation_computer docker(if you don't use a docker for workstation, build and use this frankapy)

here by control_computer you mean real time computer.

kouroshD commented 1 year ago

in the chem-lab workstation (with ubuntu 18), i had the following problem when install dependencies: docker.io : Depends: containerd (>= 1.2.6-0ubuntu1~)

fixed it with the suggestion in https://askubuntu.com/questions/1273024/docker-io-depends-containerd-1-2-6-0ubuntu1

kouroshD commented 1 year ago

in the case of ubuntu 18 it does not build the container and this is the output:

sf3202msi@sf3202msi-Z490-A-PRO-Aegis-RS:~/Desktop/franka_arm_infra$ sudo docker-compose --log-level ERROR  -f docker/workstation_computer/docker-compose-gui.yml build
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name (default: directory name)
  --verbose                   Show more output
  --no-ansi                   Do not print ANSI control characters
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the name specified
                              in the client certificate (for example if your docker host
                              is an IP address)
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)

Commands:
  build              Build or rebuild services
  bundle             Generate a Docker bundle from the Compose file
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show the Docker-Compose version information
sf3202msi@sf3202msi-Z490-A-PRO-Aegis-RS:~/Desktop/franka_arm_infra$ 
kouroshD commented 1 year ago

Make sure to setup your workstation/workstation docker's ssh key to ssh without a password(this is needed for frankapy) following instructions here

It should be described here the instructions, as the terminologies are a bit confusing in the provided link and different from ours. Probably, an image of FCI, real_time machine and workstation can be a nice addition :)

kouroshD commented 1 year ago

When running the script to run the franka interface, I have the following error:

root@kdarvish:~/git/frankapy# bash ./bash_scripts/start_control_pc.sh -i 172.16.0.4 -u sf3202inuc -d /root/git/franka-interface -a 172.16.0.2 -w 172.16.0.5
Control PC IP uname/address: sf3202inuc@172.16.0.4
Workstation IP address: 172.16.0.5
Will use input password to ssh into control pc.
Will start ROS master in new terminal./root/git/frankapy/bash_scripts/start_rosmaster.sh
No protocol specified
Unable to init server: Could not connect: Connection refused
# Failed to parse arguments: Cannot open display: 
Did start ROS master in new terminal.
/root/git/frankapy/bash_scripts
/root/git/frankapy/bash_scripts/start_franka_interface_on_control_pc.sh
Will ssh to control PC and start franka-interface.
No protocol specified
Unable to init server: Could not connect: Connection refused
# Failed to parse arguments: Cannot open display: 
Done
/root/git/frankapy/bash_scripts/start_franka_ros_interface_on_control_pc.sh
Will ssh to control PC and start ROS action server.
No protocol specified
Unable to init server: Could not connect: Connection refused
# Failed to parse arguments: Cannot open display: 
Will ssh to control PC and start ROS action server.
No protocol specified
Unable to init server: Could not connect: Connection refused
# Failed to parse arguments: Cannot open display: 
Done
root@kdarvish:~/git/frankapy# 

in workstation machine run it without any docker.

in our workstation machine, we have to be in docker and then run:

to test, run

python3 scripts/reset_arm.py

When running bash ./bash_scripts/start_control_pc.sh -i (realtime computer ip) -u (realtimecomputer username) -d /root/git/franka-interface -a (robot_ip) -w (workstation IP) on workstation machine without docker enabled, it could run ros master and opened and closed the terminal very quickly. Apparently, they need sshpass that was missing, so I have installed them on the workstation (client) machine.

kouroshD commented 1 year ago

Here we are using https://github.com/pairlab/franka_arm_infra/blob/527bf448d85adbf7aede468dbaf80ac7de593b0a/docker/realtime_computer/Dockerfile#L69 version Number 5 as the default option and this causes the problem. So, we have to set it to 4 apparently for our usecase. But not sure, if we can update the franka server side to number 5.

So, when I was trying to run the test in python3 scripts/reset_arm.py nothing was happening. However, I could see the outputs from the libfranka for the robot states. Even opening python files and running fa=FrankaArm() was blocked. Then I thought it might be related to the network configurations. So, on my system a simple pub/sub was not working...

kouroshD commented 1 year ago

The problem I had was mainly coming from the network configuration we set here: https://github.com/pairlab/franka_arm_infra/blob/527bf448d85adbf7aede468dbaf80ac7de593b0a/docker/workstation_computer/Dockerfile#L109-L111

Either we have to ask the user set a hostname and/or IP address manually by the user. Another option can be when running bash ./bash_scripts/start_control_pc.sh -i (realtime computer ip) -u (realtimecomputer username) -d /root/git/franka-interface -a (robot_ip) -w (workstation IP) we use the workstation ip address and pass it as env variables to the new terminals. however, when openning new terminal by user, probably he will not be able to find the rosmaster as the ip is not set.

kouroshD commented 1 year ago

With the latest changes, I managed to reset the robot arm by running python3 scripts/reset_arm.py, however, I had the following error as well:

Reset with joints
Opening Grippers
Traceback (most recent call last):
  File "scripts/reset_arm.py", line 26, in <module>
    fa.open_gripper()
  File "/root/git/frankapy/frankapy/franka_arm.py", line 1410, in open_gripper
    self.goto_gripper(FC.GRIPPER_WIDTH_MAX, block=block, skill_desc=skill_desc)
  File "/root/git/frankapy/frankapy/franka_arm.py", line 1270, in goto_gripper
    self._gripper_move_client.send_goal(move_skill)
AttributeError: 'FrankaArm' object has no attribute '_gripper_move_client'

The franka gripprt is not connected in our case. However, in our current setup, when we run the python3 scripts/reset_arm.py we do not have this error.

kouroshD commented 1 year ago

some small suggestions:

kouroshD commented 1 year ago

to test, run python3 scripts/reset_arm.py

We have to mentioned that in a dockerized terminal before.

bash ./bash_scripts/start_control_pc.sh -i (realtime computer ip) -u (realtimecomputer username) -d /root/git/franka-interface -a (robot_ip) -w (workstation IP)

I could not manage to run this in a dockerized terminal.

kouroshD commented 1 year ago

Hi @Ruthrash Here are my comments and suggestions and problems and fixes I had using the documentation. Let me know if you have any question.

N.B. There might be some duplications in my comments, as they have done in several days!

Ruthrash commented 1 year ago

see PR #18