'rosApplyTransfrom' gives error even on passing the correct arguments type

조회 수: 1 (최근 30일)
Dhruv Thakkar
Dhruv Thakkar 2022년 6월 1일
답변: Cam Salzberger 2022년 6월 16일
I am trying to tranfrom messages from one frame to another, from a rosbag, in the following fashion.
tranF = getTransform(bagfile,'targetFrame','world');
worldPose = readMessages(select(bagfile,'Topic','/vrpn_client_node/targetFrame/pose' ),'DataFormat','struct');
rosApplyTransform(tranF,worldPose)
But upon doing so I get the following error. Can anyone point me in the right direction?
Error using rosApplyTransform
Expected tfmsg to be one of these types:
struct
Instead its type was ros.msg.geometry_msgs.TransformStamped.
Error in rosApplyTransform (line 40)
validateattributes(tfmsg, {'struct'},{'scalar'},'rosApplyTransform','tfmsg');

답변 (1개)

Cam Salzberger
Cam Salzberger 2022년 6월 16일
Hello Dhruv,
The issue is that the output of "getTransform" is a message object, while the output of "readMessages" is a message struct, and "rosApplyTransform" expects both to be message structs.
Unfortunately, I'm not able to find a way to get a message struct out of "getTransform", which would be the idea situation. So the best workaround for now is probably to get an object out of "readMessages" as well (remove the DataFormat=struct name-value pair), and then use the "apply" function rather than "rosApplyTransform".
-Cam

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by