ROS
is a common platform for robot development. Normally it has some descent document, but not for rosbash. It is stated in the document that
The
rosbash
package includes limited support forzsh
andtcsh
by way of sourcing theroszsh
orrostcsh
files respectively. We currently do not provide documentation on these shells, though much of the functionality is similar to the bash shell extensions.
What if I want to use fish shell instead of bash
? There is a file called rosfish
in Github but how to use that?
roscd
and rosed
Instead of sourcing source /opt/ros/lunar/setup.bash
as is told in the official document, go to your ~/.config/fish/config.fish
file (which is essentially .bashrc
for bash), add the following line:
source /opt/ros/kinetic/share/rosbash/rosfish
To source your workspace, you can’t just source the file in devel/setup.bash
since it’s written in shell script that fish do not understand. Instead, install bass as a bridge between fish and shell script. I recommend using fisherman for installing bass.
Now every time you need to source your workspace, run this:
bass source devel/setup.bash
I got you. Why sourcing scripts manually when everything can be automated? Let’s use fish’s excellent hook functionality to source the files for us.
Place the following file in ~/.config/fish/conf.d
, you can name it catkin.autosource.fish
or whatever
function catkinSource --on-variable PWD
status --is-command-substitution; and return
if test -e ".catkin_workspace"
bass source devel/setup.bash
echo "Configured the folder as a workspace"
end
end
The script monitor the variable PWD
, which is the location you’re at, if it changes, search for the .catkin_workspace
file (which in the workspace when you create it). If it finds the file, the source it for you.
Happy fishing!