필터 지우기
필터 지우기

Reading sensor_msgs/PointCloud2 data and visualizing the points

조회 수: 10 (최근 30일)
Junaid Baber
Junaid Baber 2021년 12월 22일
답변: Cam Salzberger 2021년 12월 22일
Dear all,
I am connecting Matlab ros with Classical ROS. In command I run the roscore and copy same URL in
> rosinit('http://IMAG-MARVIN:11311/')
Now I can list all the topics by
> rostopic('list')
that gives the output
/clock
/img_node/nearir_image
/img_node/range_image
/img_node/reflec_image
/img_node/signal_image
/os_cloud_node/imu
/os_cloud_node/points
/os_node/imu_packets
/os_node/lidar_packets
/rosout
/rosout_agg
/tf_static
Now I want to visualize /os_cloud_node/points which are of type
/img_node/nearir_image 229 sensor_msgs/Image 'std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵uint32 Height↵uint32 Width↵char Encoding↵uint8 IsBigendian↵uint32 Step↵uint8[] Data↵'
/img_node/range_image 229 sensor_msgs/Image 'std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵uint32 Height↵uint32 Width↵char Encoding↵uint8 IsBigendian↵uint32 Step↵uint8[] Data↵'
/img_node/reflec_image 229 sensor_msgs/Image 'std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵uint32 Height↵uint32 Width↵char Encoding↵uint8 IsBigendian↵uint32 Step↵uint8[] Data↵'
/img_node/signal_image 229 sensor_msgs/Image 'std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵uint32 Height↵uint32 Width↵char Encoding↵uint8 IsBigendian↵uint32 Step↵uint8[] Data↵'
/os_cloud_node/imu 2288 sensor_msgs/Imu 'std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵geometry_msgs/Quaternion Orientation↵ double X↵ double Y↵ double Z↵ double W↵double[9] OrientationCovariance↵geometry_msgs/Vector3 AngularVelocity↵ double X↵ double Y↵ double Z↵double[9] AngularVelocityCovariance↵geometry_msgs/Vector3 LinearAcceleration↵ double X↵ double Y↵ double Z↵double[9] LinearAccelerationCovariance↵'
/os_cloud_node/points 229 sensor_msgs/PointCloud2 'std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵uint32 Height↵uint32 Width↵sensor_msgs/PointField[] Fields↵ uint8 INT8↵ uint8 UINT8↵ uint8 INT16↵ uint8 UINT16↵ uint8 INT32↵ uint8 UINT32↵ uint8 FLOAT32↵ uint8 FLOAT64↵ char Name↵ uint32 Offset↵ uint8 Datatype↵ uint32 Count↵logical IsBigendian↵uint32 PointStep↵uint32 RowStep↵uint8[] Data↵logical IsDense↵'
/os_node/imu_packets 2289 ouster_ros/PacketMsg 'uint8[] Buf↵'
/os_node/lidar_packets 18310 ouster_ros/PacketMsg 'uint8[] Buf↵'
/rosout 12 rosgraph_msgs/Log 'int8 DEBUG↵int8 INFO↵int8 WARN↵int8 ERROR↵int8 FATAL↵std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵int8 Level↵char Name↵char Msg↵char File↵char Function↵uint32 Line↵char[] Topics↵'
/tf_static 1 tf2_msgs/TFMessage 'geometry_msgs/TransformStamped[] Transforms↵ std_msgs/Header Header↵ uint32 Seq↵ Time Stamp↵ char FrameId↵ char ChildFrameId↵ geometry_msgs/Transform Transform↵ geometry_msgs/Vector3 Translation↵ double X↵ double Y↵ double Z↵ geometry_msgs/Quaternion Rotation↵ double X↵ double Y↵ double Z↵ double W↵'
I can't figure it out. Please Help

답변 (1개)

Cam Salzberger
Cam Salzberger 2021년 12월 22일
Hello Junaid,
If you create a subscriber for the topic of interest, you can get the messages on that topic either in the subscriber's callback (NewMessageFcn) that you supply, or by checking the LatestMessage property of the subscriber. Then you can use rosPlot on the message to display them. See this example for a walkthrough on the specialized message handling.
-Cam

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

Help CenterFile Exchange에서 Specialized Messages에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by