I am trying to create two .desktop entries to launch shell scripts.
the shell scripts fullLaunch.sh and tracepen.sh should be executed.
Both run when launched from the terminal.
They launch multiple other files, including ros launchfiles and other shell scripts.
tracepen.desktop looks like this:
[Desktop Entry]
Type=Application
Exec=bash /home/qiaoyue/happyspace/src/fmp_robot_shellscripts/robot/tracepen.sh
Icon=/home/qiaoyue/happyspace/src/fmp_robot_shellscripts/icons/tracepen.png
Name=Trace Pen
Terminal=true
tracepen.sh:
#!/bin/bash
# Check if SteamVR is running
if pgrep -x "vrmonitor" > /dev/null
then
echo "SteamVR is running"
else
echo "SteamVR is not running, starting it now..."
xdg-open steam://rungameid/250820 & disown
echo "Waiting for SteamVR to start..."
# Wait for SteamVR to start
while ! pgrep -x "vrmonitor" > /dev/null
do
sleep 1
done
fi
echo "Starting up tracepen"
rosrun fmp_tracepen_node tracepen_node.py
bahavior:
steam is started, but in the end i am not left with an open terminal running the tracepen_node.py.
Starting it directly with ./tracepen.sh does.
fullLaunch.desktop (basically the same):
[Desktop Entry]
Type=Application
Exec=/home/qiaoyue/happyspace/src/fmp_robot_shellscripts/robot/fullLaunch.sh
Icon=/home/qiaoyue/happyspace/src/fmp_robot_shellscripts/icons/launch.png
Name=Robot
Terminal=true
fulLaunch.sh:
#!/bin/bash
wait_for_topic() {
TOPIC=$1
while true; do
if rostopic list | grep -q "$TOPIC"; then
break
else
sleep 0.5
fi
done
}
# Check if roscore is already running, if yes then kill it
if (rosnode list &> /dev/null); then
killall -9 roscore
killall -9 rosmaster
fi
# Start roscore in a new tab
nohup roscore &> /dev/null &
# Wait for roscore to start
while ! (rosnode list &> /dev/null); do
sleep 0.5
done
gnome-terminal -- bash -c "roslaunch fmp_launch trajServer.launch"
# Wait for move_group to start
wait_for_topic "/sequence_move_group"
gnome-terminal --tab -- bash -c "rosrun fmp_move_traj trajectory_server.py"
gnome-terminal --tab -- bash -c "rosrun fmp_move_traj pose_server.py"
gnome-terminal --tab -- bash -c "rviz -d $(rospack find fmp_move_traj)/rvizLaunch/realRobot.rviz"
gnome-terminal --tab -- bash -c "rosrun fmp_move_traj buttons.py"
gnome-terminal --tab -- bash -c "rosrun fmp_move_traj poseModifier.py"
the .desktop launches two terminals, one with an error that immediately terminates.