Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 475 articles
Browse latest View live

ROS Bag File Point Cloud

$
0
0
Is their a way to open a .bag file in a application such as cloud compare, or mesh lab? I am using a Kinect camera for mapping and I want to be able to view the 3d point cloud map created. Thank you for your help. P.S sorry for bad english. Also, how do I capture one frame of a ros bag. I just one to store one frame of a point cloud scene from rviz.

Is it possible to see the list of topics available in the bag file while running the bag player?

$
0
0
I know there exist a command "rosbag info" that gives the detail of the bag file. But I want the rosbag player to print all the topics on which it will be going publish data once. Is it possible? If yes, then what should be the best way? Thank you very much,

time synchronization

$
0
0
I write the following launch code in order to record synchronized data from 4 topics (color image, depth image, joy command, and IMU) /use_sim_time : false I use ApproximateTime Synchronizer but it does not work! still, I got a bag file with a different number of messages from each topic. what I doing wrong?! any help appriciated

rosbag message instance & ros1_bridge help

$
0
0
Hi, I was working with some tools for ros2 when I came across rosbag and it's message_instace class. On the same topic, I started understanding the ros1_bridge. I'd like to get more detail on how ros1_bridge understands the message_instance data published by rosbag and converts the same to ros2 format and re-publishes. Could anyone help me with docs/links or any suggestions?

record topics with time synchronizer

$
0
0
Hello every one I want to record 4 topics with time synchronization. I found [message_filter](http://wiki.ros.org/message_filters) in ROS documentation that talk about this as a following: import message_filters from sensor_msgs.msg import Image, CameraInfo def callback(image, camera_info): # Solve all of perception here... image_sub = message_filters.Subscriber('image', Image) info_sub = message_filters.Subscriber('camera_info', CameraInfo) ts = message_filters.TimeSynchronizer([image_sub, info_sub], 10) ts.registerCallback(callback) rospy.spin() could anyone tell me what should I put in `callback` function? should I read a previous recording bag? or I have to record a bag within this function? and If I have to record my bag inside a `callback` function what is the appropriate python command to use for the record??

Convert ROS Image to CompressedImage(png)

$
0
0
I am trying to convert a rosbag with raw images to another rosbag containing compressed images using cv2 bridge: def compress_to_png(msg): bridge = CvBridge() img = bridge.imgmsg_to_cv2(msg, desired_encoding="passthrough") ret_val, image_buffer = cv2.imencode(".png", img) compressed_msg = CompressedImage() compressed_msg.header = msg.header compressed_msg.data = image_buffer.tostring() compressed_msg.format = "png" return compressed_msg However, the new rosbag seems to be having issues when I play it with rqt_bag. More specifically, it throws the below message: "Can't convert image: image has wrong mode" This method however works when I convert to jpeg. Only png conversion seems to be running into issues. Any thoughts ?

How can i read messages from a ROSbag file ?

$
0
0
I have a bag file in which some are custom messages whereas others are string messages. How can i display the contents of the topics which have message of type strings (without converting it to a .csv file) ?![image description](/upfiles/15234598878607816.jpg) for example, From the attached image, how can i read the messages of the topic `/pnc/relative_carstatus`

How to read Binary data from a bagfile ?

$
0
0
I have received a bag file which i need to analyze. I opened the file in `rqt_bag` and played a topic `/pnc/carstatus` which has the messages of type `string`. Now to read the messages, I used `rostopic echo /pnc/carstatus`. But this shows `data: !!Binary |` and some unreadable characters below it. Is there a way to read the contents of these bag files ? ps : I cannot covert the file to a `.csv` or a `.txt` format as it contains a topic of custom message type and it fives a `unicode` error. ps : I am not sure if i can attach an image or not but I guess looking at the image makes it a lot more clearer. Sorry if i am offending the rules.![image description](/upfiles/15235359584370357.png)

Confilct in rosbag play and publishing messages

$
0
0
I tried a simple use case. Used the turtlesim example : published messages from `turtle_teleop_key` to `turtlesim_node` and recorded the data in a `.bag` file. Now when i play the rosbag file using `rosbag play fileName`, I can also publish the messages from the `turtle_telep_key` which changes the movement of the turtle ? 1. Is it allowed ? Shouldnt publishing messages be blocked during playing a bag file ? 2. Or is it an application problem and I must prevent it from my end ?

rosbag : rewrite the values of a topic

$
0
0
Dear all, what can be the best way to rewrite the values of the messages in a topic in a bag file. For instance, how can I go about creating a new bag that contains modified values of a topic of another bag file (example : multiply the twists in topic of nav_msgs/Odometry messages and store the results in a new bag) ? Thanks a lot for your help.

Cannot open rosbags with multiarrays.

$
0
0
- Distro: kinetic - OS: Ubuntu 16.04 - Program: Matlab and python Hello, I've encountered this problem in matlab R2018a (it works fine in R2017b) and in python. When trying to open a rosbag with any of these programs. I've attached the file I'm trying to open and the errors i get. (As i cannot attach files I've uploaded it here: https://we.tl/QvCoqIqhd1) ## Matlab R2018a ## >>rosbag('10.bag') No definition for MultiArrayLayout Message def: # Please look at the MultiArrayLayout message definition for # documentation on all multiarrays. MultiArrayLayout layout # specification of data layout float64[] data # array of data ## Python 2.7 ## >>> import rosbag >>> bag = rosbag.Bag('10.bag') >>> for topic,msg,t in bag.read_messages(): ... print(msg) File "", line 1, in (and another bunch of tracebacks) genmsg.msg_loader.MsgNotFound: Cannot locate message [MultiArrayLayout]: unknown package [std_msgs] on search path [{}] I've searched online and I can't find an answer.

Issues rosbag big bags compressed with lz4

$
0
0
Hey everyone, our setup: 1. Ubuntu 16.04.03 LTS 2. ROS Kinectic 3. RealSense R200 We try to record longterm bag-files (about an hour) of realsense_camera r200_nodelet_rgbd.launch. We saved therefore the bags on a external SSD with interface 3.1 USB 2. generation. The bag file is about 289,0 GB. When we play the rosbag while no node is subscribing to the packed topics, the bag file runs without a problem. Also rviz can subscribe to the topics, but when we run our own node, which is subscribing to the topics with message_filters (http://wiki.ros.org/message_filters) for message synchronization, the rosbag play failed with different errors messages: 1. ROSLZ4_OUTPUT_SMALL: output buffer is too small 2. ROSLZ4_DATA_ERROR: malformed data to decompress The errors appear always on the same time. But if we copy the bag file from our back up, the errors appears on a different time. We tried to rosbag reindex and rosbag fix but both seems not to work. We also recorded the bag files several times, but the same errors appears anytime. The other option is to not use the time synchronizazion, but we have no clue how to change callback to solve the problem. The code snippet of the callback: const int QUEUE_LENGTH = 50; std::deque colorQueue; std::deque depthQueue; std::deque colorInfoQueue; const double offset = 1.0; const double frequence = 15.0; const double max = 30.0; const double step = frequence + offset; double fIndex = 0.0; void callback(const sensor_msgs::CameraInfo::ConstPtr& rgbInfo, const sensor_msgs::Image::ConstPtr& rgbImage, const sensor_msgs::Image::ConstPtr& depthImage) { if(fIndex >= max) { fIndex = fIndex - max; colorQueue.push_back(cv_bridge::toCvCopy(rgbImage, rgbImage->encoding)->image); if(colorQueue.size() >= QUEUE_LENGTH) colorQueue.pop_front(); depthQueue.push_back(cv_bridge::toCvCopy(depthImage, depthImage->encoding)->image); if(depthQueue.size() >= QUEUE_LENGTH) depthQueue.pop_front(); colorInfoQueue.push_back(sensor_msgs::CameraInfo(*rgbInfo)); if(colorInfoQueue.size() >= QUEUE_LENGTH) colorInfoQueue.pop_front(); } fIndex = fIndex + step; } Hope any can help us to solve the problem.

Subscribing to compressed Images from rosbag

$
0
0
Hello, I have a rosbag file with compressed images recorded. The rosbag file is publishing the topic: "/xxxx/image_raw/compressed" of type "sensor_msgs/CompressedImage". I want to write the subscriber in python. I saw the following example from ROS wiki for subscribing the normal messages from chatter topic. #!/usr/bin/env python import rospy from std_msgs.msg import String def callback(data): rospy.loginfo(rospy.get_caller_id() + 'I heard %s', data.data) def listener(): rospy.init_node('listener', anonymous=True) rospy.Subscriber('chatter', String, callback) rospy.spin() if __name__ == '__main__': listener() I have changed it as: #!/usr/bin/env python import rospy from sensor_msgs.msg import CompressedImage def callback(data): rospy.loginfo(rospy.get_caller_id() + 'I heard %s', data.data) def listener(): rospy.init_node('image_subscriber', anonymous=True) rospy.Subscriber('/xxxx/image_raw/compressed', CompressedImage, callback) rospy.spin() if __name__ == '__main__': listener() Where should I make more changes so that it will subscribe to the topic /xxxx/image_raw/compressed and save images to the disk. Please, provide me some guidelines. Thanks! ARM

ROSBAG with points cloud

$
0
0
Hello everyone, I have a rosbag file contain images and measurement point list. I have already extracted images. There is a topic of type `datatypes/scan_point_list_2202` And I have no idea from where to start. I need to extract point cloud. Please refer me some useful links/tutorials so that I can get an idea how to extract this information. Thanks and Regards, ARM

Couldn't find an AF_INET address of []

$
0
0
I have written a ROS node to subscribe to the topics from a rosbag `/sensors/velodyne_points /sensors/camera/image_color /sensors/camera/camera_info` The `main()` function is as below int main(int argc, char** argv) { ros::init(argc, argv, "lidar_calibration"); ros::NodeHandle nh; // ROS_INFO("Starting LiDAR node"); message_filters::Subscriber image_sub(nh, "image", 1); message_filters::Subscriber info_sub(nh, "camera_info", 1); message_filters::Subscriber lidar_sub(nh, "velodyne_points", 1); message_filters::TimeSynchronizer sync(image_sub, info_sub, lidar_sub, 10); sync.registerCallback(boost::bind(&processCallback, _1, _2, _3)); ros::spin(); // cv::destroyWindow(OPENCV_WINDOW); return 0; } And my ROS variables are: ROS_ROOT=/opt/ros/kinetic/share/ros ROS_PACKAGE_PATH=/opt/ros/kinetic/share ROS_MASTER_URI=http://localhost:11311 ROS_VERSION=1 ROS_MAVEN_DEPLOYMENT_REPOSITORY=/opt/ros/kinetic/share/maven ROS_MAVEN_PATH=/opt/ros/kinetic/share/maven ROS_HOSTNAME=localhost ROS_MAVEN_REPOSITORY=https://github.com/rosjava/rosjava_mvn_repo/raw/master ROSLISP_PACKAGE_DIRECTORIES= ROS_DISTRO=kinetic ROS_IP=localhost ROS_HOME=/home/ak/.ros ROS_ETC_DIR=/opt/ros/kinetic/etc/ros I'm able to build the code but I'm stuck with the error when I rosrun the binary [FATAL] [1525151060.907371740]: You must call ros::init() before creating the first NodeHandle Couldn't find an AF_INET address for [] Couldn't find an AF_INET address for [] [ERROR] [1525151060.944339461]: [registerPublisher] Failed to contact master at [:0]. Retrying... Couldn't find an AF_INET address for [] Couldn't find an AF_INET address for [] Couldn't find an AF_INET address for [] Couldn't find an AF_INET address for [] And yes, I'm running `roscore` in another terminal and `bashrc` is sourced in every terminal session that is running. The other posts in the forum which look similar are quite different than in my case. Any help would be really appreciated. Thanks

Split ROSbag to two

$
0
0
Hi All, I am using rosindigo on two computers. I am using a ROS bag which includes sensor data from a robot (it's the Cartographer Deutsches museum 2D dataset) used to build a map. I would like to split the bag such that I will be able to run it as if it's collected from two robots, so lets say if the bag is 2000sec long the I would like to split it to two 1000sec bags and treat it as if both halves where collected at the same time by two different robots. Would I be able to do this using rosbag filter? If so how? Would I need to fix time-stamping in the rosbag? I am a relatively new user so would be happy for pointers... Thanks

How to split a recorded rosbag file ?

$
0
0
Ubuntu 12.04 and fuerte I have a bag file of 400 seconds length. I would like to split it into two bag files of 150 seconds and 250 seconds. There is an option to split bag files while recording using option --split, but now I already have a recorder one. What can be done? Thanks

ROSBAG overriding Extracted Images

$
0
0
Hello, I have a rosbag file which contain images. I am extracting images through the following subscriber. I extract only one image. I thing it is replacing every new image with the old one. I need to save all images. Can you point me out where should I make changes. #! /usr/bin/python import rospy from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError import cv2 bridge = CvBridge() def image_callback(msg): print("Received an image!") try: cv2_img = bridge.imgmsg_to_cv2(msg, "bgr8") except CvBridgeError, e: print(e) else: cv2.imwrite('~/rec_images/frame.jpeg', cv2_img) def main(): rospy.init_node('img_listener') image_topic = "/xxxx/image_raw/raw" rospy.Subscriber(image_topic, Image, image_callback) rospy.spin() if __name__ == '__main__': main()

rosbag image timestamp

$
0
0
I have a rosbag file which contain images and sensor data. I need to extract Images and their timestamp. And afterwards I want to use them to train Neural Network for classification purpose. For this, I wrote a rosnode in Python, which subscribes to the image topic. Images are extracted but how I can save timestamps. Those images and their timestamp need to be uploaded into database. **Is this possible when playing rosbag file I can create a CSV file which saves the image name and their timestamp.**

rosbag play folder with bags using roslauch

$
0
0
Hello, how can I use `rosbag play` in a `roslauch` file, in order to play a folder that contains all bags. Folder should be and argument to `roslauch`, e.g: > roslaunch play_data.launch > bag_folder:=some_folder and `bag_folder` is used inside `.launch`. So, in command line this would be just: `rosbag play some_folder/*`. Thanks!
Viewing all 475 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>