Create a custom Lidar message

asked 2022-11-13 10:06:07 -0600

Heqas gravatar image

updated 2022-11-14 02:57:32 -0600

ravijoshi gravatar image

Hello everyone, I'm trying to create a neural model for detecting a docking station using a RPLidar A1. For these a created a lot of rosbag file which I converted to txt file and edited it to separated the data (I wanted to have only a scan of docking station, not the rest of the room). Right now I'm facing a problem with taking back the txt file into rosbag.

Below is the txt file as example

%time,
field.header.seq,
field.header.stamp,
field.header.frame_id,
field.angle_min,
field.angle_max,
field.angle_increment,
field.time_increment,
field.scan_time,
field.range_min,
field.range_max,

field.ranges0,field.ranges1,field.ranges2,field.ranges3,field.ranges4,field.ranges5,field.ranges6,
field.ranges7,field.ranges8,field.ranges9,field.ranges10,field.ranges11,field.ranges12,field.ranges13,field.ranges14,field.ranges15,field.ranges16,field.ranges17,field.ranges18,field.ranges19,
field.ranges20,field.ranges21,field.ranges22,field.ranges23,field.ranges24,field.ranges25,field.ranges26,field.ranges27,field.ranges28,field.ranges29,field.ranges30,field.ranges31,field.ranges32,
field.ranges33,field.ranges34,field.ranges35,field.ranges36,field.ranges37,field.ranges38,field.ranges39,field.ranges40,field.ranges41,field.ranges42,field.ranges43,field.ranges44,field.ranges45,
field.ranges46,field.ranges47,field.ranges48,field.ranges49,field.ranges50,field.ranges51,field.ranges52,field.ranges53,field.ranges54,field.ranges55,field.ranges56,field.ranges57,field.ranges58,
field.ranges59,field.ranges60,field.ranges61,field.ranges62,field.ranges63,field.ranges64,field.ranges65,field.ranges66,field.ranges67,field.ranges68,field.ranges69,field.ranges70,field.ranges71,
field.ranges72,field.ranges73,field.ranges74,field.ranges75,field.ranges76,field.ranges77,field.ranges78,field.ranges79,field.ranges80,field.ranges81,field.ranges82,field.ranges83,field.ranges84,
field.ranges85,field.ranges86,field.ranges87,field.ranges88,field.ranges89,field.ranges90,field.ranges91,field.ranges92,field.ranges93,field.ranges94,field.ranges95,field.ranges96,field.ranges97,
field.ranges98,field.ranges99,field.ranges100,field.ranges101,field.ranges102,field.ranges103,field.ranges104,field.ranges105,field.ranges106,field.ranges107,field.ranges108,field.ranges109,
field.ranges110,field.ranges111,field.ranges112,field.ranges113,field.ranges114,field.ranges115,field.ranges116,field.ranges117,field.ranges118,field.ranges119,field.ranges120,field.ranges121,
field.ranges122,field.ranges123,field.ranges124,field.ranges125,field.ranges126,field.ranges127,field.ranges128,field.ranges129,field.ranges130,field.ranges131,field.ranges132,field.ranges133,
field.ranges134,field.ranges135,field.ranges136,field.ranges137,field.ranges138,field.ranges139,field.ranges140,field.ranges141,field.ranges142,field.ranges143,field.ranges144,field.ranges145,
field.ranges146,field.ranges147,field.ranges148,field.ranges149,field.ranges150,field.ranges151,field.ranges152,field.ranges153,field.ranges154,field.ranges155,field.ranges156,field.ranges157,
field.ranges158,field.ranges159,field.ranges160,field.ranges161,field.ranges162,field.ranges163,field.ranges164,field.ranges165,field.ranges166,field.ranges167,field.ranges168,field.ranges169,
field.ranges170,field.ranges171,field.ranges172,field.ranges173,field.ranges174,field.ranges175,field.ranges176,field.ranges177,field.ranges178,field.ranges179,field.ranges180,field.ranges181,
field.ranges182,field.ranges183,field.ranges184,field.ranges185,field.ranges186,field.ranges187,field.ranges188,field.ranges189,field.ranges190,field.ranges191,field.ranges192,field.ranges193,
field.ranges194,field.ranges195,field.ranges196,field.ranges197,field ...
(more)
edit retag flag offensive close merge delete

Comments

What is the question? Do you want to extract data from a bag file? Or create a bag file from data? Or create a ROS message?

ravijoshi gravatar image ravijoshi  ( 2022-11-14 02:58:54 -0600 )edit

I want to convert a bag file into txt file. Edit it to only have a docking station without the rest of room and recreate a bag file from it

Heqas gravatar image Heqas  ( 2022-11-14 05:25:28 -0600 )edit

I would suggest the following simple pipeline for this pre-processing:

  1. Play the bag file in a terminal
  2. In another terminal, write a node to subscribe to your message
  3. Inside the subscriber's callback, filter the points from your data
  4. Publish those filtered data
  5. Record the filtered data in another bag file

Alternatively, you can make use of the rosbag API to retrieve your messages directly from the bag file. An example of using rosbag API is shown here.

ravijoshi gravatar image ravijoshi  ( 2022-11-14 23:14:18 -0600 )edit