Skip to content

Instantly share code, notes, and snippets.

@mstaflex
Last active August 29, 2015 13:56
Show Gist options
  • Save mstaflex/9229282 to your computer and use it in GitHub Desktop.
Save mstaflex/9229282 to your computer and use it in GitHub Desktop.
Script that launches a complete twistbot tmux environment
# let us run the script on startup of the station
# this files lays under /etc/rc.local and is executed on boot of the system
su tbot -c 'source /home/tbot/.bashrc && /home/tbot/ros/twistbot-tmux-init.bash'
#!/bin/bash
# var for session name (to avoid repeated occurences)
sn=twistbot
cd
tmux new-session -s "$sn" -d -n "core"
tmux send-keys -t "$sn:core" C-z 'roslaunch twistbot_core twistbot_core.launch' Enter
sleep 5 # gives the core time to come along
tmux new-window -t "$sn:2" -n "twistbot-main"
tmux split-window -v -t "$sn:twistbot-main" # this window will listen for the start topic
tmux send-keys -t "$sn:twistbot-main.1" C-z 'while true; do rostopic echo -n 1 /move_base_simple/goal && tmux send-keys -t "twistbot:twistbot-main.0" "roslaunch twistbot_start twistbot.launch" Enter; done' Enter
tmux split-window -v -t "$sn:twistbot-main" # this window will listen to the kill topic
tmux send-keys -t "$sn:twistbot-main.2" C-z 'while true; do rostopic echo -n 1 /kill_twistbot_start && tmux send-keys -t "twistbot:twistbot-main.0" C-c; done' Enter
tmux new-window -t "$sn:3" -n "waypoints"
tmux send-keys -t "$sn:waypoints" C-z 'rosrun waypoints waypoint_controller.py' Enter
tmux new-window -t "$sn:4" -n "bssid-switcher"
tmux send-keys -t "$sn:bssid-switcher" C-z 'roscd router_tools/scripts/client && python remote_switcher.py' Enter
@mchwalisz
Copy link

Did you really impement the start of the navigation stack in tmux? In my opinion it will produce a lot of errors....

@mstaflex
Copy link
Author

Why would it? What exactly do you mean? Starting it in tmux, or the fact that the navigation occasionally crashes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment