function did not receive any data and timed out

12 次查看(过去 30 天)
Here is the detail.
machine 1: windows 10 with MatLab 2017
machine 2 (turtlebot pc): ubuntu 14 with ROS indigo attached with TURTLEBOT 2 and ROS ASTRA PRO.
both machines can ping each other and i can see the rostopics from Matlab machine node also. I run following commands on machine 1
$ roscore
$ roslaunch turtlebot_bringup minimal.launch
I am trying to run MatLab code from explore basic behaviour of turtlebot example on machine 2 . and i got MatLab error at code line laser = rossubscriber('/scan'); while I was not getting /scan topic listed on MatLab output for rostopic list also. th`en I executed the following command also on machine 1 and executed again Matlab code on pc2. and this time i resolved thisproblem and listed /scan topic also in rostopic list on Matlab output successfully.
$ roslaunch turtlebot_rviz_launchers view_navigation.launch
but now i am stuck at next line of /scan topic code line scan = receive(laser,3) and getting timeout error message Error using robotics.ros.Subscriber/receive The function did not receive any data and timed out. i even tried and checked all help on my setup from these two threads link 1 and link 2. still, i am getting same timeout error message and i am not able to run code completely for turtlebot. please help. here is the screen shot.Screenshot_1.jpg

采纳的回答

naria
naria 2020-1-31
sorry to answer my own question, I have plotted the data received from /scan topic on MATLAB. I am using it for obstacle avoidance and navigation. The main reason that i was not receiving the scan topic data for astra pro 3d sensor is that i was missing the command $rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/camera/depth/image_raw for astra on ros machine.
problem solved. Thanks for all your support.

更多回答(1 个)

Cam Salzberger
Cam Salzberger 2020-1-29
After you create the subscriber "laser", does it receive any messages from the turtlebot? To determine this, you can check the LatestMessage property, or add a callback function to display the message:
laser.NewMessageFcn = @(~, msg) disp(msg);
If you are receiving messages, you may simply need to increase the timeout. If you are not receiving messages, you can also check with rostopic:
rostopic echo /scan
Use Ctrl+C to exit the echo. If that also is not working, then make sure that the turtlebot is actually sending messages. You can do the rostopic echo on one of the Linux terminals on the turtlebot machine to check that.
If messages are being sent, but not received, then there is a connection issue. Make sure that both MATLAB and turtlebot are using the same ROS Master. Also check that the turtlebot is advertising its IP address by setting the ROS_IP environment variable appropriately before launching the turtlebot node. You can also try simpler demos (talker/listener) to see if you can get communication going between MATLAB and the turtlebot machine without involving the complexity of the actual turtlebot.
-Cam
  2 个评论
naria
naria 2020-1-30
编辑:naria 2020-1-30
Thanks for your answer:
i can easily get image_raw and odomdetry data values on matlab. and it also displays video or images sent from turtlebot. but laser scan data is recived empty.
when i run
$rosrun depthimage_to_laserscan depthimage_to_laserscan image:=camera/depth/image_raw
in turtlebot machine , i get no response/output whereas i can easily get rgb, ir and depth images using rosrun commands.
afte rusing this command laser.NewMessageFcn = @(~, msg) disp(msg); i get following sort of messages
Screenshot_2.jpg
is it working fine? i could nto interpret it much as in intensities there is not data see 0x1 size
Cam Salzberger
Cam Salzberger 2020-1-30
I'm not sure I understood all of that, but it sounds like you are receiving the LaserScan messages when using the subscriber callbacks, but not when using the "receive" function. It could simply be that if you increase the timeout value for "receive", you would see the messages. Otherwise, you could restructure your code to use either the subscriber callback or LatestMessage properties.
It looks like the intensity values are empty, but the range values are provided. It may simply be that your sensor is not detecting or setting the intensity values (range is what matters the most anyway).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Network Connection and Exploration 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by