Giter Site home page Giter Site logo

rviz2 tf message drop about ros1_bridge HOT 7 CLOSED

ros2 avatar ros2 commented on September 6, 2024
rviz2 tf message drop

from ros1_bridge.

Comments (7)

sloretz avatar sloretz commented on September 6, 2024 1

@llllIIIIllll I believe the issue is resolved by the referenced PRs. Would you mind checking using your setup with the latest code?

from ros1_bridge.

calvertdw avatar calvertdw commented on September 6, 2024

Have you compared the performance to OpenSplice? (RMW_IMPLEMENTATION=rmw_opensplice_cpp)

Are you using BEST_EFFORT or RELIABLE QoS settings for the tf in rviz2?

Since you are building from source, you might have to rebuild to use OpenSplice, following instructions at https://github.com/ros2/ros2/wiki/Linux-Development-Setup#install-more-dds-implementations-optional

from ros1_bridge.

llllIIIIllll avatar llllIIIIllll commented on September 6, 2024

I use the default Qos settings in rviz2 RMW_QOS_POLICY_RELIABILITY_RELIABLE, I have tried change it, but the problem still exist.
I also try the opensplice, it has the same problem.

from ros1_bridge.

sloretz avatar sloretz commented on September 6, 2024

I can reproduce what looks like a lag in tf frames sent from ros1 to ros 2 when using latest ros2 sources on xenial. I built both ros1_bridge and ros2 using -DCMAKE_BUILD_TYPE=RelWithDebInfo.

Here's a smaller example that doesn't require rotors or gazebo.

Save this file as pub_tf_transforms.py
#!/usr/bin/env python  
import math
import rospy

import tf_conversions
import tf2_ros
import geometry_msgs.msg


def circle_transform(child_frame, radius, angle):
    t = geometry_msgs.msg.TransformStamped()
    t.header.stamp = rospy.Time.now()
    t.header.frame_id = "map"
    t.child_frame_id = child_frame

    t.transform.translation.x = radius * math.sin(angle)
    t.transform.translation.y = radius * math.cos(angle)
    t.transform.translation.z = 0.0
    q = tf_conversions.transformations.quaternion_from_euler(0, 0, angle)
    t.transform.rotation.x = q[0]
    t.transform.rotation.y = q[1]
    t.transform.rotation.z = q[2]
    t.transform.rotation.w = q[3]

    return t


if __name__ == '__main__':
    rospy.init_node('pub_tf_transforms')
    br = tf2_ros.TransformBroadcaster()

    freq = 100.0
    r = rospy.Rate(freq)
    angle = 0.0
    while not rospy.is_shutdown():
        radius = 2.0 * math.sin(2.0 * angle)

        t = circle_transform("base_link", radius, angle)
        br.sendTransform(t)

        angle += 2.0 * math.pi / freq / 5.0
        if angle >= 2.0 * math.pi:
            angle -= 2.0 * math.pi
        r.sleep()
Open a bunch of terminals

Roscore

. /opt/ros/kinetic/setup.bash
roscore

RViz 1

. /opt/ros/kinetic/setup.bash
rviz

Add TF display, and check Show Names

RViz 2

. ros2_ws/install/setup.bash
ros2 run rviz2 rviz2

Add TF display and check Show Names

ROS 1 Bridge

. /opt/ros/kinetic/setup.bash
. ros1_bridge_ws/install/setup.bash
ros2 run ros1_bridge dynamic_bridge

TF publisher

. /opt/ros/kinetic/setup.bash
./pub_tf_transforms.py

It looks like what RViz2 and RViz display is out of sync. Visually it looks like RViz2 is displaying data about 1 second after RViz is. However, the movement of the link frame in both looks smooth to me.

RViz left, RViz2 right
peek 2018-09-14 11-14_tf_lag

I have a lot of stuff running on the machine but the CPU and RAM usage isn't all that high.
Tasks: 329 total,   1 running, 327 sleeping,   0 stopped,   1 zombie
%Cpu(s):  2.3 us,  0.8 sy,  0.0 ni, 96.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 32872912 total,  8103708 free,  6789292 used, 17979912 buff/cache
KiB Swap: 16702460 total, 16687400 free,    15060 used. 24509028 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
 6184 sloretz   20   0 2305628 706152  83660 S   8.0  2.1 135:31.67 compiz      
 6454 sloretz   20   0  695044  72472  13184 S   4.3  0.2   0:29.94 python      
24457 sloretz   20   0 1666712 116076  78164 S   4.3  0.4   2:17.53 rviz        
 1211 root      20   0 1396648 909896 340608 S   4.0  2.8 440:46.41 Xorg        
31915 sloretz   20   0 2688032 966724 272868 S   3.7  2.9 114:49.08 Web Content 
31733 sloretz   20   0 3691204 999680 493096 S   2.7  3.0  69:22.07 firefox     
 6378 sloretz   20   0  979296  33392  25756 S   2.3  0.1   0:16.98 dynamic_br+ 
23884 sloretz   20   0  935696 101116  68900 S   2.0  0.3   0:55.71 rviz2       
 6122 sloretz    9 -11  509392  13796  10184 S   0.7  0.0  10:03.47 pulseaudio  
31797 sloretz   20   0 2709896 781004 237460 S   0.7  2.4  18:12.58 Web Content 
32062 sloretz   20   0 2335028 378924 157740 S   0.7  1.2  10:33.94 Web Content 
 5075 root      20   0 1534028  79600  39172 S   0.3  0.2   8:25.50 dockerd     
15582 sloretz   20   0  327320   8356   6960 S   0.3  0.0   0:04.20 sd_espeak   
15870 sloretz   20   0   41932   3816   3144 R   0.3  0.0   0:00.01 top         
20014 sloretz   20   0  534776  53260   7348 S   0.3  0.2   0:06.52 rosmaster   
20027 sloretz   20   0  334088  10176   9284 S   0.3  0.0   0:03.02 rosout      
31956 sloretz   20   0 2427884 595732 187096 S   0.3  1.8 213:15.74 Web Content 
    1 root      20   0  185612   6232   4008 S   0.0  0.0   0:02.75 systemd     
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.02 kthreadd    
    3 root      20   0       0      0      0 S   0.0  0.0   0:02.09 ksoftirqd/0 
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:+ 
    7 root      20   0       0      0      0 S   0.0  0.0   2:19.48 rcu_sched   
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh      
    9 root      rt   0       0      0      0 S   0.0  0.0   0:00.20 migration/0 
   10 root      rt   0       0      0      0 S   0.0  0.0   0:00.66 watchdog/0 

from ros1_bridge.

sloretz avatar sloretz commented on September 6, 2024

This looks like it is an issue higher level than the bridge, possible tf2 or RViz2.

When I run ros2 topic echo /tf tf2_msgs/TFMessage and rostopic echo /tf in side-by-side terminals the timestamps appear to be the same. If I kill and restart the transform publisher the last transform displayed by each is usually the same message (there is a delay of about 0.5 seconds between starting the ros 1 tf publisher and receiving a message on the ROS 2 side). Further tf2_monitor shows very little delay

$ ros2 run tf2_ros  tf2_monitor 



RESULTS: for all Frames

Frames:
Frame: base_link, published by <no authority available>, Average Delay: 0.00051274, Max Delay: 0.00609875

All Broadcasters:
Node: <no authority available> 100.101 Hz, Average Delay: 0.00051274 Max Delay: 0.00609875

from ros1_bridge.

llllIIIIllll avatar llllIIIIllll commented on September 6, 2024

I have tried in my project, it works. Thank you!

from ros1_bridge.

Myzhar avatar Myzhar commented on September 6, 2024

I'm having the same problem... but not only in Rviz.

There is an open question on ROS answer if someone can help me:
https://answers.ros.org/question/303377/ros2-tf2-broadcasting-very-slow/

Thank you

from ros1_bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.