[dumbQuestion] launching v-rep from launchr bar in Ubuntu

Typically: "How do I... ", "How can I... " questions
Post Reply
Tomaszz
Posts: 5
Joined: 29 Jul 2014, 16:30

[dumbQuestion] launching v-rep from launchr bar in Ubuntu

Post by Tomaszz »

Hi,

It's very dumb and not such important, but I want to know what and why.
I run V-REP by command: $ ./vrep.sh since this is how I should run this program in Linux. After program starts I attach the program's icon to the launch bar (as I always do in Ubuntu) and then I exit program. And if I want to run this prgram again somehow i cant launch it form my launch bar. Instead I have to launch it again with the ./vrep.sh command.

Someone can explain what I am missing here?
Thanks

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: [dumbQuestion] launching v-rep from launchr bar in Ubunt

Post by coppelia »

Hello,

you can try to use following bash script to start V-REP via double-click:

Code: Select all

#!/bin/bash

pushd . > /dev/null
SCRIPT_PATH="${BASH_SOURCE[0]}";
while ([ -h "${SCRIPT_PATH}" ]); do
        cd "`dirname "${SCRIPT_PATH}"`"
        SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
done
cd "`dirname "${SCRIPT_PATH}"`" > /dev/null
sh vrep.sh
popd > /dev/null
For some strange reason it will only succeed if the ROS plugin is not loaded (i.e. you will have to rename libv_repExtRos.so to _libv_repExtRos.so for instance).

Cheers

fferri
Posts: 1224
Joined: 09 Sep 2013, 19:28

Re: [dumbQuestion] launching v-rep from launchr bar in Ubunt

Post by fferri »

The problem is that the unity launcher will not spawn a login shell, so it will not source your .bashrc (which is the shell initialization file where you usually load ros stuff, like sourcing /opt/ros/DISTRO/setup.bash).

Since I need ROS, as a workaround for this, I created a launcher (put this in vrep directory, or change the line determining the vrep installation dir VREP_ROOT), that loads ROS before starting vrep:

Code: Select all

#!/bin/bash
. /opt/ros/indigo/setup.bash
. ~/my-ros-ws/devel/setup.bash
VREP_ROOT="$(dirname "$0")"
cd "$VREP_ROOT"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VREP_ROOT"
./vrep "$@"
it is a bit redundant, because you have to replicate your ROS shell setup both in .bashrc and in vrep-ros-launcher.sh (bash -l doesn't work either).
for more complex ROS shell setups, consider putting yours in ~/.rosrc and adding 'source ~/.rosrc' to both .bashrc and your vrep launcher.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: [dumbQuestion] launching v-rep from launchr bar in Ubunt

Post by coppelia »

Thank you, that's very useful!

Cheers

Post Reply