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

Usage of Filtered Orientation and Original Acceleration #42

Open
tiandaji opened this issue Oct 29, 2018 · 3 comments
Open

Usage of Filtered Orientation and Original Acceleration #42

tiandaji opened this issue Oct 29, 2018 · 3 comments

Comments

@tiandaji
Copy link

tiandaji commented Oct 29, 2018

Hello @arunvydhya
I am using xsens G710-2A8G4, and I would like to know if it is possible to obtain both filtered orientation and original acceleration using your python node. I was able to get rostopic echo /mti/sensor/imu with the output like this:

header:
seq: 3010
stamp:
secs: 1540801612
nsecs: 818232059
frame_id: "xsens"
orientation:
x: 0.0150714591146
y: -0.00283857248724
z: 0.968756854534
w: 0.247538030148
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity:
x: 0.0
y: 0.0
z: 0.0
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.0
y: 0.0
z: 0.0
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

However, whichever parameter I chose (rosed xsens_driver xsens.yaml, to change the output mode among 1, 2, 3) in the xsens.yaml, the accelerations remained zeros. Will you please give me some indications?

@tiandaji
Copy link
Author

Furthermore, there are no output in output mode 3 for topic /mti/sensor/imu, which means even if the topic has output, the result will not be processed by the filter and remain original, which is not what I want. Thanks very much for all kinds of help @StevenXsens @arunvydhya

@Steven-GH
Copy link

Hello Tiandaji,

The ROS driver is merely a starting point for your application. It currently has three output data modes, available through the yaml configuration file:

  1. (sensor data): this configures your MTi to output e.g. dq, dv and magnetic field data.
  2. (sensor data w/ rate quantities): this configures your MTi to output e.g. acceleration and rate of turn data.
  3. (filter estimates): this configures your MTi to output e.g. Euler angles, position and velocity.

Next, there are several rostopic echo combinations available to visualize the data outputs. For example:

  • /mti/sensor/imu will print quaternions, angular velocity and linear acceleration (if available)
  • /mti/filter/orientation will print euler angles (if available)

In order to change the behaviour or add output modes, you can modify mtnode.py and mtdevice.py in the src folder to your needs.

@hittingray
Copy link

hittingray commented Nov 29, 2018

Hello @tiandaji

I know you asked a month ago, but I performed the modifications that Steven described above today. The modifications below should give you the outputs as if both modes 2 and 3 are enabled. If you have not been able to get it working, here is what you need:

The line numbers below assume you have unedited files thus far:

In mtnode.py, on line 73:

Change if output_mode not in [1, 2, 3]: to if output_mode not in [1, 2, 3, 4]:

In mtdevice.py, in the area of line 447, add the following lines under the section for your device:

elif mtiMode == 4:
    print "Custom"
    data = mStf+mImuGyr+mImuAcc+mImuMag+mSw+mOrientationQuat+mStf+mSw+mOrientation

If you are using a G710, this should be the first block.


Edit:

For my use case, I wanted to see the quaternions and Euler angles simultaneously. I realised the above modification will only show whichever of the two is on the end of the list. To show both:

In mtnode.spin_once(), under if orient_data:, change the elif to if.

In mtdevice.parsedata(), in the while data: loop, under elif group == XDIGroup.OrientationData: add

if 'Orientation Data' in output:
    o = output['Orientation Data']
else:
    o = {}

and change the function call to:

output['Orientation Data'] = parse_orientation_data(data_id, content, ffmt, o)

Consequently, redefine the first couple lines of parse_orientation_data() as:

def parse_orientation_data(data_id, content, ffmt, o):
	# o = {}

Edit 2:

I also neglected to mention in mtnode.spin_once(), the else: under if orient_data: needs to be changed to if not pub_ori and not pub_imu: to prevent an exception being raised when there is no roll/pitch/yaw data.

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

No branches or pull requests

3 participants