ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

tilting velodyne lidar: pointcloud and tf

asked 2022-10-07 02:08:52 -0500

hommsy gravatar image

updated 2022-11-04 04:33:47 -0500

Hi,

Im working with a velodyne Lidar sensor to eventually be mounted on a UAV. (Ubuntu 20,5.15.0-46-generic,ROS Noetic)

I understand that the velodyne lidar when in a horizontal position has its axis as defined by ROS REP-103, as seen in the figure (x- forward, y-right, z-up)

image description

With the lidar in the horizontal position and running the ros driver package (https://github.com/ros-drivers/velodyne) with frame_id=velodyne and visualizing the pointcloud, the result is as expected. The pointcloud is shown with the 'velodyne' frame as below.

image description

I then physically tilt the lidar forward (rotate +90 degrees around +y) and set the frame_id=velodyne_vertical and visualize the pointcloud as below.

image description

now since the pointcloud data is collected in the frame frame_id=velodyne_vertical, how can I transform the pointcloud to be represented in the original velodyne frame (frame_id=velodyne)? The lidar mapping package im trying to use requires the pointcloud data to be in the original ROS-REP103 standard.

Any ideas on how that can be achieved? Am i missing something here?

Edit:

TF tree

image description

Edit:

I did just that @ravijoshi, but when visualizing both pointclouds they seem to be coinciding. Doesnt seem to be correct, is it? Here is the original pointcloud in the frame_id=velodyne_vertical

image description

and here is the same pointcloud in the transformed frame base_link

image description

for reference, here is the callback function to transform the pointcloud

void pcCallback(const PointCloud::ConstPtr &msg)
    {
        try
        {
            if (target_frame_.empty() == false)
            {
                if (pcl_ros::transformPointCloud(target_frame_, *msg, *cloud_tranformed_, tf_listener_) == false)
                {
                    ROS_ERROR("Failed pcl_ros::transformPointCloud target_frame:[%s]",target_frame_.c_str());
                    return;
                }

                //BOOST_FOREACH (const pcl::PointXYZ& pt2, cloud_tranformed_->points)
                //printf ("transformed points: \t(%f, %f, %f)\n", pt2.x, pt2.y, pt2.z);

                pub_transformed_.publish(cloud_tranformed_);
            }
        }
        catch (std::exception &e)
        {
            ROS_ERROR("%s", e.what());
        }
    }
edit retag flag offensive close merge delete

Comments

hello . did you solved this problem? i just want to do that either. if you had done, is there any references that you can recommend?

for me i want to change the orientation of the point cloud. but for me i am quite newbie in this field. so can you help me?

lee hisae gravatar image lee hisae  ( 2022-11-01 05:47:18 -0500 )edit

unfortunately i havent solved it yet. hopefully we can get help from this forum.

hommsy gravatar image hommsy  ( 2022-11-04 04:35:47 -0500 )edit
1

@lee hisae please do not create an answer that is not actually an answer to the question being asked. In the future, please use the Comments section for this kind of query.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-11-04 07:38:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-10-07 03:11:16 -0500

ravijoshi gravatar image

how can I transform the pointcloud to be represented in the original velodyne frame ...

You can transform your point cloud to target frame by using pcl_ros::transformPointCloud API. There are several variants of the function, so please pick one based on your convenience.

edit flag offensive delete link more

Comments

Can you please check the followings:

  1. In your screenshots, i.e., [1] and [2], both are shown with a fixed frame chasis_link. Therefore, both of them should be the same.
  2. In your screenshots, i.e., [1] and [2], I can not see the frame id of the point cloud. Therefore, can you please confirm that the frame id changes to the target frame after applying the transformation?
  3. Can you please ensure that the transformation values (rotation matrix and translation vector) are correct? If the transformation values are incorrect, we will see the wrong result.
ravijoshi gravatar image ravijoshi  ( 2022-10-07 22:14:39 -0500 )edit

thanks for the comment, and apologies for the late reply. I confirm that the frame id does change for each of the screenshots. I also confirm that the transformation values are correct.

hommsy gravatar image hommsy  ( 2022-11-04 04:35:29 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-10-07 02:08:52 -0500

Seen: 466 times

Last updated: Nov 04 '22