ROS2 Python LaserScan to Transformed Pointcloud major issues
Hi All and much appreciated for the help
I am using the waffle pi on ROS2 Humble and I am having major issues transforming a pointcloud to the base frame. The laserscan is fine and generates correctly on the first pass but as soon as the robot moves the points move relative to the robot as no transform is being applied. I cannot seem to get any of the transform methods to work in ROS2 python.
The first normal method of using the laser geometry package to use the method transformLaserScanToPointCloud() is not available in the python package for ROS2 only the cpp. The projectLaser() function works just fine but stays relative to robot frame not the base frame.
The second method of using tf2_sensor_msgs.do_transform_cloud(msg, t) after manually grabbing the transform with lookup_transform() ans using projectLaser() to convert to PointCloud2 also does not work. I included the tf2_sensor_msgs.py in my package and installed PyKDL for python3 and changed the import rospy to import rclpy in an attempt to update the package.
This fails at line 171 of tf2_sensor_msgs.py with pack_into(buff,offset,*p) struct.error: pack_into expected 5 items for packing (got 3).
Help please.
How is it possible to transform a laserscan to the base frame in ROS2 with python without one of these methods?
Many Thanks
Elliot
Did you somehow manage to get it working? I am having the exact same problem.