ros2 / ros2/geometry2

Getting Message Filter dropping message for reason Unknown on ROS2 and Rviz2

Open
#402 1 comment 0 reactions 1 assignee View on GitHub

@clalancette is already working on this.

Since May 13, 2021.

Dominant language
C++
Stars
153
Forks
256
Avg merge
3d 23h
Merged PRs (30d)
14

Description

  • Ubuntu 20.04
  • Default DDS implementation

Getting messages during Rviz2 run and of course UI is not updated:

➜  imu_tools git:(eloquent) ✗ rviz2
[INFO] [1619443348.077977901] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [1619443348.078077117] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[INFO] [1619443348.109486697] [rviz2]: Stereo is NOT SUPPORTED
	[INFO] [1619443368.523429374] [rviz]: Message Filter dropping message: frame 'imu_link' at time 1619443358.495 for reason 'Unknown'
[INFO] [1619443369.515854324] [rviz]: Message Filter dropping message: frame 'imu_link' at time 1619443359.495 for reason 'Unknown'
[INFO] [1619443370.508120856] [rviz]: Message Filter dropping message: frame 'imu_link' at time 1619443360.495 for reason 'Unknown'
[INFO] [1619443371.531937095] [rviz]: Message Filter dropping message: frame 'imu_link' at time 1619443361.495 for reason 'Unknown'
[INFO] [1619443372.523825584] [rviz]: Message Filter dropping message: frame 'imu_link' at time 1619443362.495 for reason 'Unknown'

My code is as follows:

    def loop(self):
        acc_fact = 1000.0
        # mag_fact = 16.0
        gyr_fact = 900.0

        bus = SMBus(self.i2c_bus)
        data = bus.read_i2c_block_data(self.i2c_addr, 0, 0x1f)

        imu_data = Imu()
        imu_data.header.stamp = self.get_clock().now().to_msg()
        imu_data.header.frame_id = self.frame_id

        roll = data[0x0d]
        if roll > 127:
            roll -= 256

        pitch = (data[0x1c] << 8) + data[0x1d]
        yaw = ((data[0x02] << 8) + data[0x03]) / 10

        q = Quaternion.from_euler(roll, pitch, yaw)

        imu_data.orientation.w = q.w
        imu_data.orientation.x = q.x
        imu_data.orientation.y = q.y
        imu_data.orientation.z = q.z

        acc = [(d - 65536 if d > 32767 else d) / acc_fact for d in \
            [(data[0x0c] << 8) + data[0x0d], (data[0x0e] << 8) + data[0x0f], (data[0x10] << 8) + data[0x11]]
        ]

        imu_data.linear_acceleration.x = acc[0]
        imu_data.linear_acceleration.y = acc[1]
        imu_data.linear_acceleration.z = acc[2]
        imu_data.linear_acceleration_covariance[0] = -1

        gyr = [(d - 65536 if d > 32767 else d) / gyr_fact for d in \
            [(data[0x12] << 8) + data[0x13], (data[0x14] << 8) + data[0x15], (data[0x16] << 8) + data[0x17]]
        ]

        imu_data.angular_velocity.x = gyr[0]
        imu_data.angular_velocity.y = gyr[1]
        imu_data.angular_velocity.z = gyr[2]
        imu_data.angular_velocity_covariance[0] = -1

        self.data_publisher.publish(imu_data)

        mag_msg = MagneticField()
        mag_msg.header.stamp = self.get_clock().now().to_msg()
        mag_msg.header.frame_id = self.frame_id

        mag = [float(d - 65536 if d > 32767 else d) for d in \
            [(data[0x06] << 8) + data[0x07], (data[0x08] << 8) + data[0x09], (data[0x0a] << 8) + data[0x0b]]
        ]

        mag_msg.magnetic_field.x = mag[0]
        mag_msg.magnetic_field.y = mag[1]
        mag_msg.magnetic_field.z = mag[2]

        self.mag_publisher.publish(mag_msg)

        temperature_msg = Temperature()
        temperature_msg.header.stamp = self.get_clock().now().to_msg()
        temperature_msg.header.frame_id = self.frame_id

        temperature_msg.temperature = float((data[0x18] << 8) + data[0x19])

        self.temp_publisher.publish(temperature_msg)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.