rtabmap icon indicating copy to clipboard operation
rtabmap copied to clipboard

use image filter replace original color image but not work! anyone can help me !!!!! thanks!

Open qetuo105487900 opened this issue 1 year ago • 11 comments

i use this command

roslaunch rtabmap_launch rtabmap.launch \
    rtabmap_args:="--delete_db_on_start" \
    depth_topic:=/filter/rs_l515/aligned_depth_to_color/image_raw \
    rgb_topic:=/filter/rs_l515/color/image_filter \
    camera_info_topic:=/filter/rs_l515/color/camera_info \
    approx_sync:=false

is not work on rtabmap

but i use this command

roslaunch rtabmap_launch rtabmap.launch \
    rtabmap_args:="--delete_db_on_start" \
    depth_topic:=/rs_l515/aligned_depth_to_color/image_raw \
    rgb_topic:=/rs_l515/color/image_raw \
    camera_info_topic:=/rs_l515/color/camera_info \
    approx_sync:=false

it can work on rtabmap

so, how to do that i could run with image_filter topic? maybe copy camera info and change stamp to time.now() ? #update it is still failed that i copy camera info and change stamp to time.now()

qetuo105487900 avatar Mar 03 '24 12:03 qetuo105487900

always get the warning code

[ WARN] [1709477545.228805757]: /rtabmap/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). Parameter "approx_sync" is false, which means that input topics should have all the exact timestamp for the callback to be called.
/rtabmap/rtabmap subscribed to (exact sync):
   /rtabmap/odom \
   /filter/rs_l515/color/image_raw \
   /filter/rs_l515/aligned_depth_to_color/image_raw \
   /filter/rs_l515/color/camera_info \
   /rtabmap/odom_info

qetuo105487900 avatar Mar 03 '24 14:03 qetuo105487900

i see here: https://robotics.stackexchange.com/questions/23394/rtabmap-rtabmap-did-not-receive-data-since-5-seconds

mobiiin said is encoding problem ? is it right ? [update] it is still not work ! wt....

qetuo105487900 avatar Mar 03 '24 15:03 qetuo105487900

i also run rostopic hz and i found the original and the filters' are very similar. so maybe is not the problem.

qetuo105487900 avatar Mar 03 '24 16:03 qetuo105487900

should i use tf replace tf_static ? [update] it is still not work ! wt....

qetuo105487900 avatar Mar 04 '24 08:03 qetuo105487900

What is the rostopic hz output for:

rostopic hz \
   /filter/rs_l515/color/image_raw \
   /filter/rs_l515/aligned_depth_to_color/image_raw \
   /filter/rs_l515/color/camera_info \

matlabbe avatar Mar 05 '24 01:03 matlabbe

hello, @matlabbe

[1] run with depth_topic:=/rs_l515/aligned_depth_to_color/image_raw
rgb_topic:=/rs_l515/color/image_raw
camera_info_topic:=/rs_l515/color/camera_info
which publish from realsense nodelet Screenshot from 2024-03-05 20-46-11 this can work well !

[2] run with depth_topic:=/filter/rs_l515/aligned_depth_to_color/image_raw
rgb_topic:=/filter/rs_l515/color/image_raw
camera_info_topic:=/filter/rs_l515/color/camera_info
which publish from (realsense nodelet after sharping then publish) Screenshot from 2024-03-05 20-43-10

this can't work !

[3] this is hz between /filter/rs_l515/color/image_raw /rs_l515/color/image_raw /filter/rs_l515/aligned_depth_to_color/image_raw /rs_l515/aligned_depth_to_color/image_raw Screenshot from 2024-03-05 20-44-40 i sure that the encoding color are both rgb8 depth are both 16UC1

qetuo105487900 avatar Mar 05 '24 12:03 qetuo105487900

maybe problem is at the tf not publish from rs_l515_link? [not this] but i create a tf_frame from base_link, it is still can't work

qetuo105487900 avatar Mar 05 '24 13:03 qetuo105487900

You should have warnings in rtabmap terminal if topics can be synchronized but don't have the right format or if there is a TF issue. If you have warnings about topics not received for 5 seconds, you may check if /filter/rs_l515/color/camera_info also published.

I see that you are also using approx_sync:=false, if the topics don't have the same stamps, use approx_sync:=true instead.

matlabbe avatar Mar 09 '24 20:03 matlabbe

yes, mr. @matlabbe , i had use approx_sync:=true instead. but i still can't slove the problem. so, can't i use /rs_d435i/color/camera_info as camera_info_topic ? like this :

  <!-- RGB-D related topics -->
  <arg name="rgb_topic"               default="filter/rs_d435i/color/image_raw" />
  <arg name="depth_topic"             default="/rs_d435i/aligned_depth_to_color/image_raw" />
  <arg name="camera_info_topic"       default="/rs_d435i/color/camera_info" />
  <arg name="depth_camera_info_topic" default="$(arg camera_info_topic)" />

as below is sharpened code, are there any problem in the code ?

#!/usr/bin/env python3
import rospy
import cv2
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Image

def color_callback(data):

    cv_image = bridge.imgmsg_to_cv2(data, "bgr8")
    sharpened_img = sharpened(cv_image)
    sharpened_img = cv2.cvtColor(sharpened_img, cv2.COLOR_BGR2RGB)

    sharpened_img = bridge.cv2_to_imgmsg(sharpened_img, "rgb8")

    # Publishing
    pub_filter_color.publish(sharpened_img)

if __name__ == '__main__':
    rospy.init_node('image_filter', anonymous=True)

    bridge = CvBridge()
    # Subscribers
    rospy.Subscriber("/rs_d435i/color/image_raw", Image, color_callback)
    
    # Publishers
    pub_filter_color = rospy.Publisher("/filter/rs_d435i/color/image_raw", Image, queue_size=10)
    rospy.spin()

thanks!!

qetuo105487900 avatar Mar 10 '24 16:03 qetuo105487900

You can use /rs_d435i/color/camera_info if /filter/rs_d435i/color/image_raw has still the same resolution (and that you didn't change the scale of the image, i.e., kept same calibration).

matlabbe avatar Mar 13 '24 04:03 matlabbe

Another thing I just noticed, you should copy the old header in your new published topic header.

sharpened_img.header = data.header

matlabbe avatar Mar 13 '24 04:03 matlabbe