Hi,
I was following along the ROS tutorials since the beginning and I am having troubles on the ros_readbagfile command, because I am not able to running it:
I install the dependencies like asked in the beginning of the ros_readbagfile.py file:
sudo apt install python3-rosbag
And did the following steps how suggested in the tutorials:
# Download the file
wget https://raw.githubusercontent.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/master/useful_scripts/ros_readbagfile.py
# Make it executable
chmod +x ros_readbagfile.py
# Ensure you have the ~/bin directory for personal binaries
mkdir -p ~/bin
# Move this executable script into that directory as `ros_readbagfile`, so that it will
# be available as that command
mv ros_readbagfile.py ~/bin/ros_readbagfile
# Re-source your ~/.bashrc file to ensure ~/bin is in your PATH, so you can use this
# new `ros_readbagfile` command you just installed
. ~/.bashrc
But it is still not working and it appears "ros_readbagfile: command not found" when I run:
time ros_readbagfile demo.bag /obs1/gps/fix /diagnostics_agg | tee topics.yaml
Can someone help me how to figure it out why is not working? Thank you
Originally posted by goncaloski on ROS Answers with karma: 11 on 2021-02-11
Post score: 1
Original comments
Comment by jarvisschultz on 2021-02-11:
I'd start by looking at your PATH
environment variable and making sure that ~/bin/
is actually included. Can you run echo $PATH
?
Comment by Super on 2021-02-16:
I had the same problem. If I run "~/bin$ echo $PATH" then i got:
/opt/ros/noetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
In the other hand, if I place myself on my bin folder and run "pwd" i got:
/home/username/bin
Actually I thing I do not understand quite good the problem, or why we have to ~/.bashrc if we already have created our bin folder.
Thanks in advance.
Comment by jarvisschultz on 2021-02-16:
@Super please do not post answers that are actually answers. This is a Q&A site not a discussion forum. I've moved your answer to a question comment.
Comment by jarvisschultz on 2021-02-16:
@Super looking at the PATH
variable you've posted, it's clear that the ~/bin
directory is not on your path. Without that directory being on your PATH
, it will be impossible to execute the script. Likely the author of the instructions from OP's question was counting on the fact that if the ~/bin
directory exists, then on many Ubuntu/Debian systems it will automatically be added to the PATH
. However, this would only happen upon re-running your ~/.profile
or ~/.bashrc
(depending on those files' contents). This is why the instructions have you re-run the bashrc with . ~/.bashrc
. Read more here: https://askubuntu.com/questions/402353/how-to-add-home-username-bin-to-path
Comment by eRCaGuy on 2021-08-27:
Did you figure it out? I wrote ros_readbagfile
and that tutorial.
Comment by Ruturaj on 2022-06-29:
I am facing the same problem, followed all steps in the tutorial , any solution to this? @eRCaGuy (Using Arch Linux, but am newbie to Linux.)
Comment by eRCaGuy on 2022-07-04:
@Ruturaj, does this fix it for you? See my new answer: https://answers.ros.org/question/371583/ros_readbagfile-command-not-found/?answer=403354#post-id-403354