Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine /imu/data and /imu/data_raw #39

Closed
mhkabir opened this issue Jun 29, 2014 · 25 comments
Closed

Combine /imu/data and /imu/data_raw #39

mhkabir opened this issue Jun 29, 2014 · 25 comments

Comments

@mhkabir
Copy link
Member

mhkabir commented Jun 29, 2014

As far as I understand:

  1. The "data" topic (from ATTITUDE_MSG) is publishing orientation and angular acceleration.
  2. The "data_raw" topic(from HIGHRES_IMU_MSG) is publishing angular and linear acceleration but no orientation.

Can we get a single topic with all 3 sets of data in one message? To get this combined message at 100Hz, I would need to stream both HIGHRES_IMU and ATTITUDE at 100Hz right?

Kabir

@vooon
Copy link
Member

vooon commented Jun 29, 2014

  1. "data" topic publishes linear acc too (from last HIGHRES/RAW IMU), so it is sensor data + AHRS oprintation computed by FCU.
  2. "data_raw" consists only sensor data, from HIGHRES/SCALED/RAW IMU messages.

Stream rates can be requested by ~set_stream_rate.

@vooon vooon added the question label Jun 29, 2014
@mhkabir
Copy link
Member Author

mhkabir commented Jun 30, 2014

This is what I get from 'data' :

header: 
  seq: 0
  stamp: 
    secs: 1404116269
    nsecs: 370753605
  frame_id: fcu
orientation: 
  x: -0.0122482950772
  y: 0.0128198330144
  z: 0.983876964174
  w: 0.177965588012
orientation_covariance: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
angular_velocity: 
  x: 0.00635452289134
  y: 0.00816642027348
  z: 0.0066369920969
angular_velocity_covariance: [1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07]
linear_acceleration: 
  x: 0.0
  y: 0.0
  z: 0.0
linear_acceleration_covariance: [8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08]
---

I get this from data_raw:

header: 
  seq: 0
  stamp: 
    secs: 1404116760
    nsecs: 718308339
  frame_id: fcu
orientation: 
  x: 0.0
  y: 0.0
  z: 0.0
  w: 0.0
orientation_covariance: [-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: 0.00487843248993
  y: 0.00567598594353
  z: 0.00487843248993
angular_velocity_covariance: [1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07]
linear_acceleration: 
  x: 0.0648902505636
  y: -0.0876651704311
  z: 9.82027339935
linear_acceleration_covariance: [8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08]
---

Please let me know what is the problem. I'm using the PX4 stack alongwith 'common' message set.

How do I use set_stream_rate?

Kabir

@vooon
Copy link
Member

vooon commented Jun 30, 2014

Seems it is bug.
This is imu/data with APM:

header: 
  seq: 5
  stamp: 
    secs: 1404120662
    nsecs: 792497974
  frame_id: fcu
orientation: 
  x: -0.0304314685103
  y: -0.0537969396712
  z: -0.481879858576
  w: 0.874054699035
orientation_covariance: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
angular_velocity: 
  x: 0.0035301039461
  y: -0.0109049407765
  z: -0.00545139471069
angular_velocity_covariance: [1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07]
linear_acceleration: 
  x: 1.0002783
  y: 0.0588399
  z: 9.4928372
linear_acceleration_covariance: [8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08]

P.S.: Add 4 space for code blocks.

@mhkabir
Copy link
Member Author

mhkabir commented Jun 30, 2014

Will you be able to check out this bug and fix it?

@vooon
Copy link
Member

vooon commented Jun 30, 2014

Set rate example:

rosservice call /mavros/set_stream_rate 0 100 1

Note: APM drop stream request not from GCS.

I will check that bug, but I need help with validation (I do not have PX4).

@vooon
Copy link
Member

vooon commented Jun 30, 2014

Could you add dump of imu/data_raw stream?

@mhkabir
Copy link
Member Author

mhkabir commented Jun 30, 2014

Yep, I will validate the fix for you. Thanks for the help!!

Kabir

@mhkabir
Copy link
Member Author

mhkabir commented Jun 30, 2014

From data_raw :

header: 
  seq: 0
  stamp: 
    secs: 1404121613
    nsecs: 448683070
  frame_id: fcu
orientation: 
  x: 0.0
  y: 0.0
  z: 0.0
  w: 0.0
orientation_covariance: [-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: 0.00126349925995
  y: 0.00419683149084
  z: 0.00126349925995
angular_velocity_covariance: [1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07]
linear_acceleration: 
  x: 0.184763044119
  y: -0.174803182483
  z: 9.76903629303
linear_acceleration_covariance: [8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08]
---

@vooon vooon added this to the Versoin 0.6.0 milestone Jun 30, 2014
vooon added a commit that referenced this issue Jun 30, 2014
@vooon vooon added bug and removed question labels Jun 30, 2014
@vooon
Copy link
Member

vooon commented Jun 30, 2014

I fix it. Check please.

@mhkabir
Copy link
Member Author

mhkabir commented Jun 30, 2014

Yep fixed ;) It is working as it should. Thanks for the fix.

So, for 250 Hz update on 'imu/data' I need to set stream rate of 250Hz on both HIGHRES_IMU and ATTITUDE, right?

@vooon
Copy link
Member

vooon commented Jun 30, 2014

Yes, you right. But values in REQUEST_MESSAGE_STREAM not well described, so you must check in px4 source what values to use.

@vooon vooon added the question label Jun 30, 2014
@vmayoral
Copy link

vmayoral commented Jul 2, 2014

@mhkabir, @vooon I'm trying to fetch read /mavros/imu/data_raw topic using:

rostopic echo /mavros/imu/data_raw

But i get nothing. Please refer to http://erlerobotics.gitbooks.io/erlerobot/en/mavlink/ros/mavros.html.
Any idea why? Maybe related to the socat tunnel created?

@vooon
Copy link
Member

vooon commented Jul 2, 2014

It can be related, please show how do you use socat. And see /diagnostics topic (better using rqt runtime monitor).

FCU connection status must be "connected" and rx_seq increases. Also you can add hex dump to socat and check message flow.

@vmayoral
Copy link

vmayoral commented Jul 2, 2014

At http://erlerobotics.gitbooks.io/erlerobot/en/mavlink/ros/mavros.html you can see that i launch socat with the following syntax:

socat  pty,link=/dev/ttyAutopilot,raw  tcp:127.0.0.1:6000&

I tried rostopic echo /diagnostics but i'm not getting anything either.

@vooon
Copy link
Member

vooon commented Jul 2, 2014

Strange. Try rosnode info mavros, rosnode ping mavros. Check CPU consumption using htop (on imx6q its ~15% load).

Add -vx flag to socat (dumps data to stderr).

@vooon
Copy link
Member

vooon commented Jul 2, 2014

And don't set _gsc_host if you don't use stream, "" disables send until somebody sends packet to _bind_port.

@mhkabir
Copy link
Member Author

mhkabir commented Jul 2, 2014

Something I found, set_stream_rate doesn't work with PX4 stack. I need to delve into the source code to find out how they handle it...

@vooon
Copy link
Member

vooon commented Jul 2, 2014

FYI: APM reject REQUEST_DATA_STREAM if msg.sysid != GCS (parameter).

@vooon
Copy link
Member

vooon commented Jul 2, 2014

@vmayoral, i am trying get same issue, but mavros works. My steps:

  1. APM 2.6 connected via USB to Wandboard, do socat -vx FILE:/dev/ttyACM0,nonblock,waitlock=/tmp/ttyACM0.lock TCP-L:6000,reuseaddr,fork
  2. on my notebook: socat -vx TCP:wandboard:6000 PTY,link=/tmp/fcu
  3. finally run node: rosrun mavros mavros_node _serial_port:=/tmp/fcu

On both socat terminals have some data flow, and have messages after MAVROS started on MAV 1 (component 240) from node.
Note: ~serial_baud not needed, and have not effect with pty.

@vooon
Copy link
Member

vooon commented Jul 2, 2014

Reproduce @vmayoral problem, when socat demonized with & problem exists.
When server and client socat's not in background it works.

But rostopic echo /diagnostics always works (all messages "no data").

@vooon
Copy link
Member

vooon commented Jul 11, 2014

@vmayoral, sometimes socat drops connections, sometime i forgot to set baudrate (e.g. stty -F ospeed 57600), but most time it works.
Currently trying to find leaks with valgrind, and connecting via socat bridge.

@mhkabir are all discussed in this topic? can be closed?

@ggregory8
Copy link

@vmayoral If you are connecting to pixhawk on PX4 stack with USB, you have to make sure you start the mavlink stream by connecting with QGC.

@vooon This can be worked around by initialising the mavlink on USB by sending the following bytes to PX4 first.
const uint8_t init[] = {0x0d, 0x0d, 0x0d, 0};
const uint8_t nsh[] = "sh /etc/init.d/rc.usb\n";

@ggregory8
Copy link

@vooon Sorry I realise you already have this via startup_px4_usb_quirk parameter :)

@vooon
Copy link
Member

vooon commented Jul 14, 2014

@ggregory8 not shure, but APM (BeaglePilot use their code) don't require PX4 USB quirk.

I think original issue is fixed, so i can close.

@ShiinoMashiro
Copy link

What's the difference between "data" and "data_raw" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants