Ask Your Question
0

rviz config file for android sensors

asked 2019-02-25 08:17:55 -0500

swiss_knight gravatar image

updated 2019-03-06 08:52:27 -0500

Hi,

I'm pretty new to all the ROS ecosystem so please excuse my question if not adequate (and I feel I miss many pieces for the moment...).

I'm wondering; is there a config file for ROS Sensors Driver ( http://wiki.ros.org/android_sensors_d... ) to use with $ rosrun rviz riv -d <config_file> in order to plot (on a 2D graph e.g.) sensors' data from an Android device (smartphone)? The "ROS Sensors Driver" was installed and is successfully connected to ROS master on the laptop running roscore.

I can also successfully print out variation from the IMU chips with $ rostopic echo /android/imu for instance:

header: 
  seq: 384095
  stamp: 
    secs: 1551421044
    nsecs: 381000000
  frame_id: "/imu"
orientation: 
  x: -0.0177525561303
  y: -0.00952073466033
  z: -0.892899274826
  w: 0.449805617332
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: -0.000991821289062
  y: 0.00173950195312
  z: -0.00140380859375
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration: 
  x: 0.445648193359
  y: -0.0185089111328
  z: 9.7029876709
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---

In RViz, I got this warning:

No tf data.  Actual error: Fixed Frame [map] does not exist

And if I run this command in parallel: $ rosrun tf static_transform_publisher 0 0 0 0 0 0 1 map my_frame 10 I have this error:

For frame [/imu]: Frame [/imu] does not exist

I'm running ros melodic 1.14.3 on Ubuntu 18.04 64 bits.
And the "ROS Sensors Driver" app on the Android 6.0.1 smartphone is coming from the playstore.
Thanks.


* Edit: *
Thanks gvdhoorn for the hint. Explanations here under.

I have tried two other things in the meantime:
1) the imu plugin for rviz: http://wiki.ros.org/rviz_imu_plugin : worked like a charm, I'm receiving the /android/imu messages from the $ rosbag play <my_bag_file> command I launched in the same time (I'm now searching how to visualize the device motion relative to the map frame instead of it's own frame, which is giving it a "static look" except for rotations which are fine.

2) rqt_bag: http://wiki.ros.org/rqt_bag : it seems also to work correctly to me but hasn't a graph visualization mode; rqt_bag screenshot

Then, I tried your python script to fix the bag file itself in two ways, none of them is working;
a) $ python rosbag_fixer/fix_bag_msg_def.py --use-local-defs -c "/android/imu" "bagfiles/2019-03-01-11-53-15.bag" "bagfiles/2019-03-01-11-53-15_FIX.bag"

which printed:

No topics found for callerid '/android/imu'. Make sure it is correct.

b) $ python rosbag_fixer/fix_bag_msg_def.py --use-local-defs "bagfiles/2019-03-01-11-53-15.bag" "bagfiles/2019-03-01-11-53-15_FIX.bag"

which printed:

Writing out fixed bag ..
 bagfiles/2019-03-01-11-53-15_FIX.bag        100%            687.3 KB 00:00    

done

The new bag probably needs to be re-indexed. Use 'rosbag reindex bagfiles/2019-03-01-11-53-15_FIX.bag' for that.

So I ran the proposed reindex command to fix it ... (more)

edit retag flag offensive close merge delete

Comments

1

If you want to see the transform properly, what you need is a transform between map and imu. Try running rosrun tf static_transform_publisher 0 0 0 0 0 0 1 /map /imu 10 instead.

jubeira gravatar image jubeira  ( 2019-02-27 07:44:41 -0500 )edit

Your answer wasn't an answer, so I appended it to your original question text.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-01 08:43:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-25 12:02:00 -0500

gvdhoorn gravatar image

updated 2019-03-06 06:19:29 -0500

I'm wondering; is there a config file for ROS Sensors Driver ( http://wiki.ros.org/android_sensors_d... ) to use with $ rosrun rviz riv -d <config_file> in order to plot (on a 2D graph e.g.) sensors' data from an Android device (smartphone)?

I'm not aware of such a config file existing. Not that I'm pretending to know everything, but because RViz is not a "plotting tool", but a 3D rendering environment that happens to know how to visualise ROS msgs that have a spatial aspect to them (ie: a TF frame or some other form of 3D / 6D data).

Plotting could be done using rqt_plot or plotjuggler.


Edit:

I have tried two other things in the meantime:
1) the imu plugin for rviz: http://wiki.ros.org/rviz_imu_plugin : worked like a charm, I'm receiving the /android/imu messages from the $ rosbag play <my_bag_file> command I launched in the same time (I'm now searching how to visualize the device motion relative to the map frame instead of it's own frame, which is giving it a "static look" except for rotations which are fine.

This may be semantics, but when you wrote "plotting", I understood you wanted to be able to visualise a time-varying signal in such a way that its values would be both visualised as well as inspectable at all times captured in your data. RViz does not support that, as it only renders the current state. The IMU plugin is nice, but it doesn't "plot".

2) rqt_bag: http://wiki.ros.org/rqt_bag : it seems also to work correctly to me but hasn't a graph visualization mode; rqt_bag screenshot

Try right clicking on one of the rows there. The context menu allows various operations to be performed on the message streams.

Then, I tried your python script to fix the bag file itself in two ways, none of them is working;

Just to clarify: the error message from PlotJuggler made me suspect that you may be running into the issue with rosjava msgs I linked to. I can't be certain.

As to the errors from rosbag_fixer: if you can provide (a short segment of) the bag file, I can take a look.


Edit 2:

Ok for having append my own answer to the first post, even if it may be more difficult to "follow a discussion" in the future as it becomes more and more detailed.

true, but at least we keep the chronological ordering of interactions. ROS Answers is a Q&A type site, which works best if there is (almost) a 1-to-1 ratio of questions and answers. It's fine to post answers yourself, but they should then actually answer the question, not be updates with additional information or progress.

If you'd like, you could put the most recent edit at the top instead of at the bottom of your post.

I also wasn't able to read a bagfile with the python API ( http://wiki.ros.org/rosbag/Code%20API ...

(more)
edit flag offensive delete link more

Comments

I tried to plot data from the /android/imu topic with rqt_plot but the "plus" button is grayed out; I am unable to proceed to this data visualization. Here is the graph of nodes and topics: https://reho.st/self/e7b9c51d00da1ded...

swiss_knight gravatar image swiss_knight  ( 2019-03-01 02:31:42 -0500 )edit

And with plotjugler, when trying to load the sensor_msgs/Imu Datatype from topic /android/imu I get the following error message:

The plugin thrown the following exception: 
This type was not registered
swiss_knight gravatar image swiss_knight  ( 2019-03-01 02:58:08 -0500 )edit

Could be that you're running into #q108956. In short: rosjava (used by ros_android) doesn't send a part of the necessary data to properly introspect messages. You could try running your bag through the rosbag_fixer I mention in #q108956.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-01 04:42:40 -0500 )edit

Edit 2, for more convenience I append it to the first post as well.
Btw, do you know where we can adresse the rosjava issue?

swiss_knight gravatar image swiss_knight  ( 2019-03-04 01:42:45 -0500 )edit
1
gvdhoorn gravatar image gvdhoorn  ( 2019-03-04 02:10:24 -0500 )edit

I just checked all that with an other bag file recorded on the same android device. This one has no values from the IMU topic and I can open it without having to run the fix. The rosjava issue seems only related when working with IMU (and potentially other sources) but not from the pressure sensor

swiss_knight gravatar image swiss_knight  ( 2019-03-04 04:54:13 -0500 )edit
1

From the data I get from the bag you posted that would seem surprising. All topics, except TF2 and the rosout ones seem to have malformed message_definition headers.

If you have that as a bag I would be interested.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-04 05:05:03 -0500 )edit

Ok, good thing to know, I'm not yet "ROSed" enough to understand fine grained details such as these. What you said could be a cue for java developers (let's hope). Are git users/devs aware of this detail?

swiss_knight gravatar image swiss_knight  ( 2019-03-04 05:11:31 -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

2 followers

Stats

Asked: 2019-02-25 08:17:55 -0500

Seen: 243 times

Last updated: Mar 06 '19