0
$\begingroup$

Rosanswers logo

I'm trying to get a piece of research software from github up and running on a lab computer for my professor. Flydra is a multi-camera tracking system used to detect multiple airborne insects or small animals. The required OS for Flydra is Ubuntu 16.04, which I haven't frequently used before but am semi-competent with. For instance, I was able to fix the low resolution problem by manually installing the Nvidia driver, and another failed-login issue upon startup from the grub menu. Flydra is installed using the ansible tool, something that I am completely unfamiliar with how it works. Below is the entire setup process I've gone through for Flydra, as I am not sure what step or how the issue is caused with the $PYTHONPATH.



  • The following commands use ansible to download the code from github, and gives the following output.
  1. 'sudo apt-get install git ansible'
  2. 'cd ~/'
  3. 'git clone https://github.com/strawlab/strawlab-ansible-roles.git'
  4. 'cd strawlab-ansible-roles/'
  5. 'sudo ansible-playbook -i "localhost," -c local playbook.yml'

*Note in order for the ansible package to install correctly and avoid a localhost not found error, I had to reenable the security update settings in System Settings -> Software & Updates -> Updates -> Install updates from -> Important security updates, Recommended updates, Unsupported updates.


PLAY ***************************************************************************

TASK [setup] ******************************************************************* ok: [localhost]

TASK [ros-kinetic : get ROS apt signing key] *********************************** ok: [localhost]

TASK [ros-kinetic : use ROS Ubuntu repository] ********************************* ok: [localhost]

TASK [ros-kinetic : use ROS Ubuntu source repository] ************************** ok: [localhost]

TASK [ros-kinetic : install ROS kinetic packages] ****************************** ok: [localhost]

TASK [strawlab-public-debs : get strawlab apt signing key] ********************* ok: [localhost]

TASK [strawlab-public-debs : get strawlab public apt repo] ********************* ok: [localhost]

TASK [ros-kinetic-freemovr-engine : Ensure rosdep sources dir exists] ********** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : Ensure strawlab rosdep URL is included into rosdep sources] *** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : Ensure freemovr-engine-kinetic.rosinstall is available] *** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : install sudo command] ********************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : install wstool command] ******************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : Ensure workspace installer dir exists] ***** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : copy installer script] ********************* ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-freemovr-engine : apt] *************************************** ok: [localhost]

TASK [ros-kinetic-flydra : install flydra package] ***************************** ok: [localhost]

TASK [ros-kinetic-flydra : Ensure rosdep sources dir exists] ******************* ok: [localhost]

TASK [ros-kinetic-flydra : Ensure strawlab rosdep URL is included into rosdep sources] *** ok: [localhost]

TASK [ros-kinetic-flydra : Ensure flydra-kinetic.rosinstall is available] ****** ok: [localhost]

TASK [ros-kinetic-flydra : install sudo command] ******************************* ok: [localhost]

TASK [ros-kinetic-flydra : install wstool command] ***************************** ok: [localhost]

TASK [ros-kinetic-flydra : install rosinstall command] ************************* ok: [localhost]

TASK [ros-kinetic-flydra : Ensure workspace installer dir exists] ************** ok: [localhost]

TASK [ros-kinetic-flydra : copy installer script] ****************************** ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-flydra : apt] ************************************************ ok: [localhost]

TASK [ros-kinetic-freemovr : put "vr" function into bashrc] ******************** ok: [localhost]

TASK [ros-kinetic-freemovr : Ensure freemovr-kinetic.rosinstall is available] ** ok: [localhost]

TASK [ros-kinetic-freemovr : copy installer script] **************************** ok: [localhost]

PLAY RECAP ********************************************************************* localhost : ok=42 changed=0 unreachable=0 failed=0



  • Then the workspace is created and sourced
  1. 'rm -rf ~/strawlab-ansible-roles/
  2. '/opt/ros/workspace-installers/kinetic/make-flydra-workspace.sh'
  3. 'source ~/ros/flydra-kinetic/devel/setup.bash'
  • In order to launch, Flydra requires a "triggerbox" which can be either an Arduino Uno or Nano. The triggerbox serves as a clock synchronization tool for the computers running each camera and the host PC. The triggerbox needs to have the triggerbox.ino filed located at "~/ros/flydra-kinetic/src/triggerbox/firmware/triggerbox" uploaded to the board. In order for the file to be correctly uploaded, the Arduino IDE must be able to compile the file, if the environment path is set incorrectly within the IDE it must be fixed to include the missing library. Also, Flydra will look for a symbolic link called "trig1" of the usb connection of the triggerbox, which can be created by making a file "99-arduino-udev.rules" in the /etc/udev/rules.d directory and inserting the line:
  1. SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="trig1".
  • Check to make sure the symbolic link was successfully created with 'ls /dev'.

  • Start the main_brain program with

  1. 'roslaunch ros_flydra main_brain.launch'
  • Run the camnode.py file to create a camera node that subscribes to the main_brain. Camnode.py is located at ~/ros/flydra-kinetic/src/ros_flydra/nodes. A video input device should be automatically detected when connected.
  1. 'sudo python camnode'

Unfortunately, running that command causes the following output and this is where I'm unable to resolve the issue.


Traceback (most recent call last):

File "camnode", line 11, in import flydra.camnode

File "/usr/lib/python2.7/dist-packages/flydra/camnode.py", line 1, in from flydra_camnode.camnode import *

File "/usr/lib/python2.7/dist-packages/flydra_camnode/camnode.py", line 75, in import roslib;

ImportError: No module named roslib


  • The file in "/usr/lib/python2.7/dist-packages/flydra_camnode/camnode.py" is unable to find the correct path along the $PYTHONPATH to the directory containing the roslib module.
  1. echo $PYTHONPATH
  • Simply returns blank, which I read on an erroneous forum post that a blank $PYTHONPATH potentially breaks certain things during installation. After investigating, I found the roslib module was located in the following places:

"/opt/ros/kinetic/share"

"/opt/ros/kinetic/lib/python2.7/dist-packages"

  1. export PYTHONPATH="/opt/ros/kinetic/share:/opt/ros/kinetic/lib/python2.7/dist-packages".

  • Does nothing to solve the problem. I have read some documentation talking about ROS environment variables, namely $ROS_ROOT and $ROS_PACKAGE_PATH. Following the commands from wiki.ros.org/ROS/EnvironmentVariables
  1. export ROS_ROOT=/home/usr/ros/ros --> export ROS_ROOT=/home/apg/ros
  2. export PATH=$ROS_ROOT/bin:$PATH --> export PATH=$ROS_ROOT/bin:$PATH
  3. export PYTHONPATH=$PYTHONPATH:$ROS_ROOT/core/roslib/src -->export PYTHONPATH=$PYTHONPATH:$ROS_ROOT/flydra-kinetic/src
  4. echo $PYTHONPATH

Which gives the following output.

/opt/ros/kinetic/share:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/apg/ros/flydra-kinetic/src

Unfortunately at this point the error did not resolve itself, and I tried to comb the search results of google for any possible solutions. One such example was the following https://answers.ros.org/question/41241/importerror-no-module-named-roslib/ which unfortunately did not work. I hope someone on the ROS forums might have an inclination as to what the deeper problem might be.


Originally posted by mbfg on ROS Answers with karma: 15 on 2019-05-24

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The trouble you're having is that sudo doesn't forward the environment variables that are used by ROS. I suggest you try to run this program as your user instead.

All of the environment variable setup should happen automatically when you source the setup.bash for your catkin workspace. In this case, it looks like that's done by running source ~/ros/flydra-kinetic/devel/setup.bash

I took a brief look at flydra's github page, but I wasn't able to find the directions that you're following, so I'm not sure what the original intent of them was. If you can provide a link to the instructions that you're following, that would help me and anyone else reading this question understand what is supposed to be happening and maybe help you along.


Originally posted by ahendrix with karma: 47576 on 2019-05-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by mbfg on 2019-05-25:
The instructions for flydra installation are linked on the main page under "Installation" with a link called 'our Ansible playbooks'. The link leads to https://github.com/strawlab/strawlab-ansible-roles. My instructions are slightly modified but essentially the same as what is shown on their page. I thought it would be important to describe the installation process for replication purposes, or clues to what could be causing the problem.

I think you are onto something with the sudo suggestion. Running 'python camnode' doesn't throw the same ImportError, which atleast implies that the sudo was causing problems. I'll continue to investigate and see if that fixes the problem fully.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.