If you are interested in reading bag files in python, you will need to install bagpy package. I recommend using virtual environment for installation.
- Ubuntu
- Python 3.6 or higher preferred, might work with other versions of python but not tested on them.
There are two ways you can create python virtual environment: (i) Using Anaconda (ii) Using python virtualenv package
wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
chmod +x https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
./Anaconda3-2020.07-Linux-x86_64.sh
Following command will create a virtual environment named rosread
.
conda create -n rosread python=3.6 anaconda
It will take a few minutes to several depending on availability of CPU and RAM in your system.
source activate rosread
Install virtualenv package
sudo apt install virtualenv
Now, create a virtual environment:
virtualenv --python=python3.6 rosread
Once you create virtual environment, activate as follows:
source rosread/bin/activate
Now, every time you open a terminal and want to use virtual environment, you will have to activate using one of the two methods methods mentioned above.
We will install packages in virtual environment. First activate the virtual environment and then install following bagpy
package for reading bagfiles:
pip install bagpy
Now you are ready to use bagpy. Look for examples at https://github.com/jmscslgroup/bagpy/tree/master/notebook and documentation at https://jmscslgroup.github.io/bagpy/