Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UR Reacher on UR e-series #42

Open
nlynn12 opened this issue Nov 12, 2018 · 9 comments
Open

UR Reacher on UR e-series #42

nlynn12 opened this issue Nov 12, 2018 · 9 comments

Comments

@nlynn12
Copy link

nlynn12 commented Nov 12, 2018

System: I'm using PR #29 on Ubuntu 18.04 with both real UR5s and the URSim in Virtualbox

Intro: I've successfully run SenseAct on the CB3 (v.3.7.0) and the new e-series (v.5.1.2) simulators.

Problem: I'm trying to move from UR offline simulators to the real UR5s. This time the newest e-series v.5.1.2. However when I run the example code I get an error stating

AttributeError: 'ReacherEnv' object has no attribute 'angle_return_point'

This does not occur when connecting to the offline simulator.

@nlynn12
Copy link
Author

nlynn12 commented Nov 12, 2018

Full error log:

$ python ur5_reacher.py 
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
0.009797096252441406: Hiccup of 1.80ms overhead between UR packets)
0.12884044647216797: Hiccup of 106.87ms overhead between UR packets)
 timed out : Lost socket to UR, going into reconnect loop
2018-11-12 08:44:35.757849: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Started plotting routine
0.8315298557281494: Hiccup of 689.29ms overhead between UR packets)
Init param sum -2.3423016
********** Iteration 0 ************
sampling
Resetting
Reset done
WARNING:root:Agent has over-run its allocated dt, it has been 0.050118446350097656 since the last observation, 0.010118446350097655 more than allowed
Process Process-2:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/rtrl_base_env.py", line 480, in _run_loop_
    self._action_to_actuator_()
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/rtrl_base_env.py", line 351, in _action_to_actuator_
    self._compute_actuation_(action[0], timestamp, index)
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/envs/ur/reacher_env.py", line 505, in _compute_actuation_
    self._handle_bounds_speedj()
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/envs/ur/reacher_env.py", line 643, in _handle_bounds_speedj
    if not self.angle_return_point:
AttributeError: 'ReacherEnv' object has no attribute 'angle_return_point'
ERROR:root:One of the environment subprocess has died, closing all processes.
Traceback (most recent call last):
  File "ur5_reacher.py", line 185, in <module>
    main()
  File "ur5_reacher.py", line 84, in main
    callback=kindred_callback
  File "/home/nily/Projects/SenseAct/lib/python3.6/site-packages/baselines/trpo_mpi/trpo_mpi.py", line 199, in learn
    seg = seg_gen.__next__()
  File "/home/nily/Projects/SenseAct/lib/python3.6/site-packages/baselines/trpo_mpi/trpo_mpi.py", line 56, in traj_segment_generator
    ob, rew, new, _ = env.step(ac)
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/utils.py", line 150, in step
    wrapped_step = self._wrapped_env.step(scaled_action)
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/rtrl_base_env.py", line 243, in step
    self.act(action)
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/rtrl_base_env.py", line 235, in act
    raise e
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/rtrl_base_env.py", line 232, in act
    self._write_action(action)
  File "/home/nily/Projects/SenseAct/SenseAct/senseact/rtrl_base_env.py", line 401, in _write_action
    raise Exception("Environment has been shutdown due to subprocess error.")
Exception: Environment has been shutdown due to subprocess error.
Process Process-4:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 749, in _callmethod
    conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "ur5_reacher.py", line 125, in plot_ur5_reacher
    old_size = len(shared_returns['episodic_returns'])
  File "<string>", line 2, in __getitem__
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 753, in _callmethod
    self._connect()
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 740, in _connect
    conn = self._Client(self._token.address, authkey=self._authkey)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 487, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 614, in SocketClient
    s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory

@nlynn12
Copy link
Author

nlynn12 commented Nov 12, 2018

Update

In the new e-series teach pendant it is required that "remote control" is enabled.

To do so:

  1. Click at the three bars at the top right
  2. Go to "Settings"
  3. Select "System"
  4. Select "Remote Control"
  5. Click "Enable"

Then when you want to remote control the robot you should ensure that it is active by clicking at the teach pendant icon at the top right, and select "Remote Control".

Now you can control the robot through TCP.

@nlynn12
Copy link
Author

nlynn12 commented Nov 12, 2018

This however is not the complete solution. Now the robot doesn't reset upon request. It continues to be in the speedj program on the UR controller all the time.

@fisherxue
Copy link

Can you clarify on how you managed to get SenseAct working with the offline simulators? Thanks!

I have URSim installed on Ubuntu 16.04, but I don't seem to be able to get it to enable networking in either Setup Robot > Setup Networking or Program Robot > Installation > Ethernet/IP.

@nily-dti
Copy link

@fisherxue sorry for the long response time. Did you manage to native-install the UR offline simulator in Ubuntu? Then you installed the oldest version of Java on the planet (or close to v.1.6)? I'd not recommend to do that, but rather use their VM, despite the overhead.

I currently don't have a complete guide for setting up the simulators, but I'll try to outline what I did (I'll try to verify it later and come back to you):

  1. Go to https://www.universal-robots.com/download/
  2. Select robot type (CB- or e-series)
  3. Choose "Software"
  4. Choose "Offline Simulator"
  5. Choose "Non Linux" (to get their VM)
    1. When Download completes unrar the package (Note that you with some of the packages have to do the unrar in Windows as Ubuntu does not do it correctly)
  6. Load the VM with the UR simulator
  7. Set the network settings to bridge
  8. Start the VM
  9. Inside the VM verify in the terminal that you have an IP and try to ping it from your host machine.
  10. Start the offline simulator by double-clicking it on the VM desktop.
  11. Simply set the IP address (in the setup.py file) to the one of your VM and you're good to go

Docker: If you're using Docker then (I've been told that) you shouldn't run VM on the same machine as the machine you run Docker on.

@fisherxue
Copy link

fisherxue commented May 17, 2019

@nily-dti
I'm getting stuck on step 9. I have network settings set to bridged adapter, which I hook up to one of my Ethernet interfaces. However, running ifconfig inside URSim does not provide an IP, and attempting to ping the host returns "network unreachable". What kind of network settings did you have? Thanks!

@nily-dti
Copy link

nily-dti commented May 18, 2019 via email

@nily-dti
Copy link

@fisherxue are you sure that the PC you are running VM on have obtained an IP? Are both PCs connected to the same network or are they directly connected? If the latter one, have you set fixed IPs for your PCs?

I've just tried to follow the guide from above and that works flawlessly. I'm running two separate PCs on the same corporate network.

@fisherxue
Copy link

Ran the VM in Host-Only mode instead of Bridged mode (on Virtualbox) and it runs flawlessly. Thanks for all the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants