asrob-uc3m / rd2

RD2
0 stars 0 forks source link

Unable to launch motor controller #3

Closed PeterBowman closed 5 years ago

PeterBowman commented 5 years ago

From freshly recompiled CMake 3.5.2, YARP 2.3.72.1 w/ opencv_grabber and asrob-uc3m/yarp-devices:

pi@raspberrypi ~ $ sudo yarpdev --from /usr/local/share/robotDevastation-robots/contexts/launch/launchRobot.ini
[ERROR]YARP network not available, check if yarp server is reachable

YARP network is available and I can launch test_grabber, for instance. Looks like this error originates upstream, not in our own code. Any ideas?

PS I had to start YARP's name server on my PC with yarpserver --ip 222.1.1.92 --write since Docker's networking was being picked as the first option (both were apparently reported as available, but yarp name list was showing the Docker one, only).

jgvictores commented 5 years ago

sudo sometimes grabs different environmental variables. From here we see the one that really matters is setting YARP_CONF.

jgvictores commented 5 years ago

PS: Docker??? (that could also affect #2)

PeterBowman commented 5 years ago

Same error today, I didn't have to use --ip.

jgvictores commented 5 years ago

What is the output of sudo yarp where?

PeterBowman commented 5 years ago

Can't tell now, but I recall that plain yarp where gave the expected output (remote nameserver).

jgvictores commented 5 years ago

Yes, that's why I'm concerned about the output using sudo.

jgvictores commented 5 years ago

Ideas for testing:

  1. All yarp detect etc in a sudo su so env variables are shared and yarp conf is in /root
  2. There was a way to chmod /dev/mem/something to avoid need of sudo. I guess an udev rule could be set up. However, seems dangerous.

Anyway, once we get back to the script to which I pointed above (via daemontools) there will be no need for sudo.

jgvictores commented 5 years ago

PS: Sorry, cold fingers closed the issue, reopened. : )

jgvictores commented 5 years ago

PS2: I've updated https://github.com/asrob-uc3m/robotDevastation-developer-manual/tree/master/robots#configure-yarp-devices-as-services-on-raspi as a result of https://github.com/asrob-uc3m/robotDevastation-developer-manual/issues/12

PeterBowman commented 5 years ago
$ yarp where
Looking for name server on 222.1.1.92, port number 10000
If there is a long delay, try:
  yarp conf --clean
Name server /root is available at ip 222.1.1.92 port 10000
$ sudo yarp where
Looking for name server on 222.1.1.26, port number 10000
If there is a long delay, try:
  yarp conf --clean

=======================================================================
==
== PROBLEM
== No valid YARP name server is available.
== Here is the expected configuration:
==   host: 222.1.1.26 port number: 10000
==   namespace: /root
==   type of name server: yarp
== But such a name server was not found.
[...]

You were right:

$ yarp conf
/home/pi/.config/yarp/yarp.conf
$ sudo yarp conf
/root/.config/yarp/yarp.conf
PeterBowman commented 5 years ago

It worked after I replaced YARP_CONF with YARP_CONFIG_HOME here (ref). Same for the camera device.

@jgvictores any compelling reason for not marking that as the final solution?

jgvictores commented 5 years ago

Oh, yes! We had to do something similar for TEO here: https://github.com/roboticslab-uc3m/teo-developer-manual/commit/2b79bde7890d48f7daf68437b62caa83b89961c3