Myzhar / ros_simple_zed_cuda_driver

[Obsolete] Please use the official ROS node by StereoLabs: https://github.com/stereolabs/zed-ros-wrapper
GNU Lesser General Public License v3.0
9 stars 6 forks source link

How to display things in RVIZ ? #5

Closed benoit-cty closed 6 years ago

benoit-cty commented 8 years ago

Hello, I'm quite new to ROS so it is not really a defect but more a lack of information. After launching with roslaunch ros_simple_zed_cuda_driver simple_zed.launch I'm not able to display something in RVIZ. There is no Fixed Frame reference ? Could you provide the rviz config you are using ? What I want to achieve is to have a valid pointcloud2 topic to use. How to use depth_image_proc with your code ? Thanks in advance

Myzhar commented 8 years ago

Hello, to enable the frame reference you need to change "publish_TF" to true in the launch file. Otherwise it expects that you are giving the position of the sensor in the robot description file.

To get a 3D point cloud you must use depth_image_proc launching the nodelet "point_cloud_xyz" or "point_cloud_xyzrgb".

Please remember that the ZED camera emits RGB and Depth images not raw, but rectified, so you do not need to calibrate them.

Myzhar commented 8 years ago

You can look at this example: https://gist.github.com/bhaskara/2400165

benoit-cty commented 8 years ago

Thank you for your quick response. I did not succeed yet but I will post the answer here when it works.

benoit-cty commented 8 years ago

Hi Myzhar, I still did not achieve to display a point cloud in RVIZ. Laserscan is working fine. Here is my launch code in attachment zed_cloud.txt

.

jeremy-a commented 8 years ago

When I run my launch file (openni_record_player.txt) and the launch file for the simple driver with publish_TF set to true, I see this (rosgraph) node/topic graph. Any idea why I don't see any point cloud data in the /camera/depth_registered/points topic?

jeremy-a commented 8 years ago

The other thing I noticed is that sometimes the nodelets don't seem to subscribe. I'm not sure if this is because I'm running on two different machines, but I'm not changing my environment from run to run and the nodelet portion is pretty inconsistent.

jeremy-a commented 8 years ago

My problem with getting a reliable subscription across multiple machines appears to be related to the use of the getNumSubscribers in the publish functions. I would suggest not using the condition on some number of subscribers to publish. In fact I wonder if this can introduce some race condition that is only amplified when connection ROS topics between machines.

There is another issue. I was able to get a pointcloud topic out of my depth_image_proc nodelet. However, even with TF turned on, the depth and rgb images do not have a named frame when using rostopic echo and therefore the pointcloud topic out of depth_image_proc doesn't have a frame_id. RVIZ won't display without a frame_id set. I noticed that rgbMsgHeader and depthMsgHeader are defined and setup with valid frame names, but they don't appear to be associated with the published message so I'm guessing that's why when I echo the topic, I don't see any string set for the frame_id.

Myzhar commented 8 years ago

Have you set "fixed frame" to "world"?

jeremy-a commented 8 years ago

Yes but since the message didn't have a frame_id it didn't work. I changed the code and added the depthImgMsg.header fields as shown below.

depthMsgHeader.stamp = ros::Time::now();
depthMsgHeader.seq = frmCnt;
depthMsgHeader.frame_id = "depth";

depthImgMsg.header.stamp = ros::Time::now();
depthImgMsg.header.seq = frmCnt;
depthImgMsg.header.frame_id = "left";

uchar* ros_data_ptr = (uchar*)(&depthImgMsg.data[0]);

memcpy( ros_data_ptr, image, dataSize );
depthImgPub.publish( depthImgMsg, depthCamInfo );

My problem at the moment is that the nodelet doesn't seem to setup the subscriptions from the remap in my launch file reliably. Without the nodelet subscriptions I won't get the pointcloud. It seems that the nodelet as shown in the launch file snippet below will launch sometimes as I have shown in the node graph a few comments above, but other times (in fact most of the time) the nodelet launches with the rosnode/topic as shown below. Any ideas?

<!-- Convert it into a point cloud -->
<node pkg="nodelet" type="nodelet" name="cloudify"
args="load depth_image_proc/point_cloud_xyzrgb record_player_manager --no-bond">
<remap from="depth_registered/image_rect" to="zed/stereo/depth/image_rect"/>
<remap from="depth_registered/points" to="camera/depth_registered/points"/>
<remap from="rgb/image_rect_color" to="zed/stereo/left/image_rect"/>
<remap from="rgb/camera_info" to="zed/stereo/depth/camera_info"/>

rosgraph

jeremy-a commented 8 years ago

Moved depth_image_proc discussion to http://answers.ros.org/question/228164/depth_image_proc-sometimes-fails-to-show-remapped-subscriptions-in-rqt-and-rostopic-list-v/

Myzhar commented 8 years ago

I have a doubt... nodelet are used to run "node" in the same process and have zero-copy advantages. Can you run a nodelet on a different machine?

jeremy-a commented 8 years ago

I ran the launch file I mentioned above on the TK1 running your ZED node and also on a PC. Same thing in both cases. I'll try one other machine just in case.

jeremy-a commented 8 years ago

I ran the nodelet launch file I listed above on yet another computer with the same result. Do you have a launch file that you used to visualized the point cloud using the depth_image_proc nodelet?

Russ76 commented 6 years ago

Hi, Walter. Could you please share a copy of what you used for your launch file to make the point cloud? I'm trying to use Zed and TX1 to do this, and the program needs the rgb image, pointcloud2, and camera info. It is proving to be a challenge to make it all work!

Myzhar commented 6 years ago

Hi @Russ76, this is an old repository created before the official node made by StereoLabs. I'm not sure it works. Please use the official StereoLabs node: https://github.com/stereolabs/zed-ros-wrapper