Ubuntu 16.04 LTS Xenial
ROS Kinetic
Linux novice, ROS novice.
Have a catkin workspace with some packages in it (robot_localization etc).
import rosbag
gives error
import error: no module named rosbag
so tried installing:
sudo apt-get update
sudo apt-get install python-rosbag
get error:
p@t:~$ sudo apt-get install python-rosbag
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python-rosbag : Depends: python-roslib but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
What should I do? How do i fix the import error?
**Edit**
I'm sorry. I've been at this for months now. I didn't study for this. Frustration is making me go crazy.
$ which python returns "/usr/bin/python" now. I assume this is what it's supposed to be?
$ grep -i anaconda /home/pieter/.bashrc returns "grep: /home/pieter.bashrc: No such file or directory" if that's still relevant
$ ~/folderimworkingin python file.py now returns with error ending in
File "/opt/ros/kinetic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 83, in get_msg_file
% (base_type, package, search_path), base_type, package, search_path)
genmsg.msg_loader.MsgNotFound: Cannot locate message [Header]: unknown package [std_msgs] on search path [{}]
So am I missing a message package now or?
**Edit**
pieter@turing:~/benchmarking$ rospack find std_msgs
/opt/ros/kinetic/share/std_msgs
Seems reasonable.
>>> import std_msgs
>>>
does not complain.
Python --version
returns 2.7.12 now (instead of 2.7.14).
File.py:
#import numpy as np
#import scipy.io
from bag import get_topic_data
testfile = "/home/pieter/benchmarking/bagfiles/2018-03-03-11-13-48.bag"
testdata = get_topic_data(testfile,"/android/imu")
#size = len(testdata)
#print(size)
with bag.py:
import rosbag
def get_topic_data(bagFile, topic):
all_msg = []
# Initialize rosbag object
bag = rosbag.Bag(bagFile)
for topic, msg, t in bag.read_messages(topics=[topic]):
all_msg = np.append(all_msg, msg)
return all_msg
bag file I think is accessible?:
https://github.com/PieterVanB/bagfile
↧