Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solutions for errors i face while i tried to install the package #38

Open
ManChrys opened this issue Aug 31, 2023 · 1 comment
Open

Comments

@ManChrys
Copy link

Today i tried to install the allan_variance_ros and i face a lot os issues.

1st error
User geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Traceback (most recent call last): File "/home/geo/allan_ws/src/allan_variance_ros/scripts/cookbag.py", line 4, in <module> import rosbag File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in <module> from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 56, in <module> import gnupg ModuleNotFoundError: No module named 'gnupg'

Solution

pip install python-gnupg
pip install python

even if iinstall them still had the same error so i installed for python3 even if i am using 2.7 and the error has gone.
pip3 install python-gnupg

2nd error
geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Traceback (most recent call last): File "/home/geo/allan_ws/src/allan_variance_ros/scripts/cookbag.py", line 4, in <module> import rosbag File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in <module> from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 68, in <module> import roslib.names # still needed for roslib.names.canonicalize_name() File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in <module> from roslib.launcher import load_manifest # noqa: F401 File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in <module> import rospkg ModuleNotFoundError: No module named 'rospkg'

Solution
again i tried first pip install -U rospkg
but the real solution was pip3 install -U rospkg

3rd error

geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Failed to load Python extension for LZ4 support. LZ4 compression will not be available. Traceback (most recent call last): File "/home/geo/allan_ws/src/allan_variance_ros/scripts/cookbag.py", line 14, in <module> with rosbag.Bag(args.output, 'w', compression='lz4') as outbag: File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 445, in __init__ raise ValueError('compression must be one of: %s' % ', '.join(allowed_compressions)) ValueError: compression must be one of: none, bz2

Solution

Firsty i check if i had the library pip install lz4
but then i notice that in python2.7 there is no lz4 compression method so i use bz2, you can use none too but my bag was too large.

`#!/usr/bin/env python3

import rosbag
import argparse

parser = argparse.ArgumentParser()

parser.add_argument("--input", type=str, default=None)
parser.add_argument("--output", type=str, default=None)

args = parser.parse_args()

with rosbag.Bag(args.output, 'w', compression='lz4') as outbag:
    for topic, msg, t in rosbag.Bag(args.input).read_messages():
        # This also replaces tf timestamps under the assumption 
        # that all transforms in the message share the same timestamp
        if topic == "/tf" and msg.transforms:
            outbag.write(topic, msg, msg.transforms[0].header.stamp)
        else:
            outbag.write(topic, msg, msg.header.stamp if msg._has_header else t)`

If you fix this error and the 1st step is running you will notice that in terminal you will have a message like this

User geo@geo:~/allan_ws$ rosrun allan_variance_ros cookbag.py --input /home/geo/allan_ws/original.bag --output /home/geo/allan_ws/cooked.bag Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
the cooked.bag file will be 90 bytes but it needs time to become larger so be patient.

4th error
Finally, my last issue was

geo@geo:~/allan_ws$ rosrun allan_variance_ros allan_variance /home/geo/allan_ws/cooked.bag /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml [ INFO] [1693519129.931957167]: Bag Folder = /home/geo/allan_ws/cooked.bag [ INFO] [1693519129.932655760]: Config File = /home/geo/allan_ws/src/allan_variance_ros/config/xsens.yaml terminate called after throwing an instance of 'boost::filesystem::filesystem_error' what(): boost::filesystem::directory_iterator::construct: Not a directory: "/home/geo/allan_ws/cooked.bag" Aborted (core dumped)

Solution

i change some lines in /home/geo/allan_ws/src/allan_variance_ros/src/allan_variance.cpp

copy and paste it to your cpp

new_allan_cpp.txt

SOS

dont forget to catkin_build again before run the command.

I hope to help you.

@luminous-wu
Copy link

I tried your solution for the 4th error, and it locates the .bag file, but doesn't seem to generate the allan_variance.csv file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants