필터 지우기
필터 지우기

Color for pointcloud in occupancyMap3d

조회 수: 2 (최근 30일)
Nicolas Jorquera Martinez
Nicolas Jorquera Martinez 2024년 2월 15일
댓글: Nicolas Jorquera Martinez 2024년 2월 19일
I want to make a 3d map with odometry + pointcloud, and for that im using this example (using pointcloud instead of just points). My robot gives me the pc in pointcloud2 format but i need the pointcloud format, so i just change it by doing
pc = pointCloud(pc_face.readXYZ, 'Color', pc_face.readRGB); %pc_face (pointcloud2)/ pc (pointcloud)
This works, but for some reason, the colors are not working for the pointcloud (photo at the end).
rosshutdown;
rosinit('http://192.168.123.161:11311');
go1_odom = rossubscriber('/tf');
fqGet = 1000; %frequency for getting topics
maxRange = 2;
go1_pc_face = rossubscriber('/camera1/point_cloud_face');
tStartOdom = tic;
[odomTF, status1, statusText1] = receive(go1_odom);
[pc_face, status2, statusText2] = receive(go1_pc_face);
map3D = occupancyMap3D(20);
while 1
[go1_test_msg, status1, statusText1] = receive(go1_odom);
if strcmp(go1_test_msg.Transforms.ChildFrameId, 'trunk')
odomTF = go1_test_msg;
end
tEndOdom = toc(tStartOdom);
%disp(1/tEndOdom)
if round(1/tEndOdom) <= fqGet
[pc_face, status2, statusText2] = receive(go1_pc_face);
%showdetails(odomTF);
%showdetails(pc_face);
xPos = odomTF.Transforms.Transform.Translation.X;
yPos = odomTF.Transforms.Transform.Translation.Y;
zPos = odomTF.Transforms.Transform.Translation.Z;
xRot = odomTF.Transforms.Transform.Rotation.X;
yRot = odomTF.Transforms.Transform.Rotation.Y;
zRot = odomTF.Transforms.Transform.Rotation.Z;
wRot = odomTF.Transforms.Transform.Rotation.W;
pose = [ xPos yPos zPos wRot xRot yRot zRot];
points = readXYZ(pc_face);
pc = pointCloud(pc_face.readXYZ, 'Color', pc_face.readRGB);
insertPointCloud(map3D,pose,pc,maxRange);
show(map3D);
fprintf('%d HZ\n',round(1/tEndOdom));
disp('-------------------------------------------------');
tStartOdom = tic;
end
end
  댓글 수: 4
Mann Baidi
Mann Baidi 2024년 2월 19일
Is the image above of "pc"(PointCloud)?
if yes, what is the issue with the color?
Nicolas Jorquera Martinez
Nicolas Jorquera Martinez 2024년 2월 19일
Yes, it's "pc" (PointCloud) cause it gave me an error when I tried to do it with "pc_face" (PointCloud2).
The problem is that the camera captures color (of the surface it's looking at), that information is in the "pc_face" and "pc" variable, but the map doesn't show this colors.
As an example, if the camera sees a red floor I want the map to show a red floor.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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