How to use MATLAB open the baxter robot's cameras?

4 visualizaciones (últimos 30 días)
snow John
snow John el 11 de En. de 2019
Comentada: Hanlin Wang el 21 de Feb. de 2019
Hello guys,i have try use the follow codes to control the baxter robot,and its works.
rosshutdown;
rosinit('011602P0019.local','NodeHost','192.168.1.128');
%%
pub1=rospublisher('/robot/limb/left/joint_command');
Msg1=rosmessage('baxter_core_msgs/JointCommand');
%%
showdetails(Msg1)
%%
while true
command=[0.0, 0.0, 0.0, 0.0, 0.0, -0.4, 0.0];
names=[{'left_w0'}, {'left_w1'}, {'left_w2'}, {'left_e0'}, {'left_e1'}, {'left_s0'}, {'left_s1'}];
mode=1;
Msg1.Command=int64(command);
Msg1.Mode=int32(1);
Msg1.Names=(names);
send(pub1,Msg1);
end
so i try to use the same way to open the camera ,but i don't know the details,can someone help me .
i will appreciate your kindness help!
Best wishes!

Respuesta aceptada

Sebastian Castro
Sebastian Castro el 11 de En. de 2019
The joint commands require publishing to the topic, as it's actuators. Cameras are sensors, so they would require subscribing to the camera topic and receiving images.
So MATLAB code to display the cameras would be something like:
imgSub = rossubscriber('/cameras/head_camera/image');
imgMsg = receive(imgSub); % or imgMsg = imgSub.LatestMessage
img = readImage(imgMsg);
imshow(img);
Hope this helps.
- Sebastian
  2 comentarios
snow John
snow John el 12 de En. de 2019
Thanks to Mr. Sebastian Castro for your help.
The code works.
Wish you have a happy weekend!
Hanlin Wang
Hanlin Wang el 21 de Feb. de 2019
hi, I have a question about how to open camera with ubuntu.
this code only can take picture but I want to see the image before I take pictures
best wishes

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Network Connection and Exploration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by