Ask Your Question
0

Extract specific Data from topic

asked 2018-08-22 05:01:21 -0500

Creesy gravatar image

updated 2018-08-22 05:36:53 -0500

Hello there,

I have a node in ros publshing data of type Measurement2 which is used for RN Sensors. The problem wit the Datatype is that it publishes several different Values like you can see here:

header: 
  seq: 36
 stamp: 
    secs: 1531906243
    nsecs:  20823955
  frame_id: "wifi_adapter"
device_name: "simulated"
device_designation: "wifi_adapter"
classification: "W"
values: 
  - 
    sensor: "Elrob-RN-1"
    source: "wifi signal strength"
    type: "wifi signal strength"
    value: [-30.0]
    unit: "dBm"
    min: 0.0
    avg: 0.0
    max: 0.0
    alert_level: 0
    alert_explanation: ''
    substance: []
    info: "Freq. 2.457 GHz mode: Master address: 08:EA:44:7A:FA:55 quality: 70/70 signal: -30.0"

I want to filter out the value of the signal and frequency from the broadcasted topic and then show it in rviz at the current position of my robot but I havent found a way yet how to extract the data and modify it so I can show it colorcoded on the created map in rviz

edit: thanks for editing the post to look better I somehow didnt get it to look straight

EDIT1:

My setup is a roboter with Laserscanners and RGBD Cameras to create a 2D and 3D map of its surroundings. Now I have to make something like a heatmap to show where strong signals occur on this generated maps. For this I need to extract specific Data from the topicoutput shown above. Especially i need the signalstrength and frequency data from the whole dataset.

edit retag flag offensive close merge delete

Comments

Are you trying to build a map of wi-fi signal strength? So you're trying to extract the values->value element from the message?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-08-22 05:31:34 -0500 )edit

Also you say 'the created map in rviz'. There are many ways of creating and showing maps in Rviz, can you describe the method you're using so we can give you some specific help.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-08-22 05:33:02 -0500 )edit

Yes kinda, the wifi signal strength should simulate radioactive fallout and I need the values of the signalstrength and frequency extracted from the ti,opic to show on a 2D map in rviz

Creesy gravatar image Creesy  ( 2018-08-22 05:33:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-08-22 05:49:09 -0500

gvdhoorn gravatar image

This is not a complete answer, but there have been similar questions in the past.

This has led @matlabbe to add a tutorial to the rtabmap_ros pkg documentation specifically about this. See wiki/rtabmap_ros/Tutorials: Wifi Signal Strength Mapping (User Data Usage).

edit flag offensive delete link more

Comments

As I understand it @matlabbe has just a topic with a single output there which just broadcasts the current strength of the wifi signal while I have a topic with a lot of information in it and I havent found a way yet to retrieve a single piece or two of the data published by my topic

Creesy gravatar image Creesy  ( 2018-08-22 06:47:11 -0500 )edit

I assumed the storage and modeling of the data would be the problem.

Accessing single fields from messages is not at all difficult, so that's why I assumed that the question was not about that.

Just to make sure: do you know how to write a subscriber for a topic?

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 06:49:21 -0500 )edit

from the ros tutorial the basics

Creesy gravatar image Creesy  ( 2018-08-22 06:50:56 -0500 )edit

Then can you clarify what is unclear?

"accessing single fields" is exactly what you'd need to do: if an incoming message (with variable name msg) has multiple fields, just do msg.field_name (where field_name is the name of the field that you want to access).

If it has a list (such as ..

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 06:58:37 -0500 )edit

.. the values field in the msg you show), then treat it as a list (or a vector) in the programming language you are using. Iterate over the elements in the list and access individual fields as you would normally do with fields in elements of a list (in C++: msg.values[i].field_name fi).

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 06:59:45 -0500 )edit

ok yes was stuck in my brain there.

Creesy gravatar image Creesy  ( 2018-08-22 07:21:54 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-08-22 05:01:21 -0500

Seen: 146 times

Last updated: Aug 22 '18