ROS Toolbox read scan block ouput zero all the time.
5 ビュー (過去 30 日間)
古いコメントを表示
I tried to use the new ROS Toolbox read-scan block to get the lidar sensor distance info to do APF obstacle avoiding. I followed the example and can get the scan plot. However, if I changed the simulink model to my own algorithm, the read scan block output zeros all the time, causing my APF not working. It is the same Gazebo and ROS environment and I am thinking if it is a bug that this block does not work if the simulink model is running without a stop. I notice the comment on the read-scan example matlab function " % Read Scan block will output all zeros until the Subscriber blocks". I could not figure out what does that means, I did have a subscriber block with the scan topic and sensor_msgs/LaserScan message type selected.
0 件のコメント
回答 (1 件)
Josh Chen
2023 年 1 月 23 日
Hi Zike,
It does not matter if you have a "stop" or not in the Simulink model.
When referring to the comment on the read-scan example, do you mean the comment inside 'plotXY' MATLAB Function? From my side, I am seeing it contains two lines as:
% Read Scan block will output all zeros until the Subscriber blocks
% outputs a message.
As the comment mentioned, if the subscriber block receives no message, Read Scan block will always output all zeros.
In your own model, can you verify if the message coming out from "Subscribe" block actually represents an valid message? You can do this by connecting the "Msg" output port of "Subscribe" block to a "bus selector" block and use a "Display" block to view contents of the message.
Hope this helps,
Josh
2 件のコメント
Josh Chen
2023 年 1 月 30 日
Hi Zike,
The 'ROS' Tab in Simulink will appear only after you configure the hardware board to 'ROS' or 'ROS 2'. To do so, you can navigate to 'APPS>Robot Operating System (ROS)' and select "Robot Operating System (ROS)" from the pop-up window. However, also note that anything under 'ROS' tab is not required if you are just running simulation. They are mainly designed for code generation workflow.
If you see all zeros as output message from "Subscribe" block, that means there is no valid message. We always return the default all zeros message in this case to ensure consistent output for downstream blocks.
One possible thing to check is whether you are connecting to the same network, e.g., when running "rosinit", did you connect to the same network where those messages been published? Please feel free to create a help ticket and discuss more with our fantasic technical support team if you need help subscribing to the topic.
Thanks,
Josh
参考
カテゴリ
Help Center および File Exchange で Specialized Messages についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!