Can we control a real robot using ROS(Robot operating system) with simulink or MATLAB Image processing Coding. If it is possible what is the flow of interconnection between these entities ?

1 Ansicht (letzte 30 Tage)
What should be the flow of interconnection between entities to control a Real Robot using ROS(Robot operating system)and simulink.

Antworten (1)

Cam Salzberger
Cam Salzberger am 30 Jan. 2018
Hello Sajid,
I am assuming that your desired result is to have your robot publishing images from a camera, MATLAB or Simulink receiving the images, and then some other MATLAB code or Simulink blocks processing the images. If that is correct, then the usual way to do this is quite simple.
It can make things easier if you start the ROS Master first, either outside or inside MATLAB.
ROS steps:
  • Set up a ROS node on your robot that gathers the images from your camera in whichever manner you desire.
  • Create a publisher for that node, publishing messages containing the images on your chosen topic name. I'd recommend sensor_msgs/Image or sensor_msgs/CompressedImage for simplicity of extraction later.
  • Start the node publishing to make testing things easier later.
If you want your image processing code in MATLAB:
  • Create a function that does the desired image processing. Make it accept the ROS message as input, and you can use readImage to extract the image from the message.
  • Code up a rossubscriber to that topic.
  • Make the image processing function the callback for the subscriber.
  • If you started the ROS master outside of MATLAB, connect to it with rosinit.
  • Run your subscriber code.
If you want your image processing to be done in Simulink:
  • Specify the correct network connection settings for connecting to the ROS network.
  • Add a Subscribe block to your model, setting the properties appropriately to handle the correct topic and message type.
  • Connect the output to your desired image processing functionality.
  • (Optional) If you only want to call your image processing functionality when you receive a new message (likely), then put it all in a Triggered Subsystem, setting the IsNew output of the Subscribe block to be the trigger.
  • Run the model.
Here's a good example series to get you started in MATLAB, and another for Simulink.
-Cam
  1 Kommentar
sajid javid
sajid javid am 3 Mär. 2018
Thanks to clear my concept. There is another confusion.if i install Raspberry Pi MALTAB image on my Raspberry Pi hardware. how to setup ROS on maltab image installed Raspberry Pi hardware. i may want to make MATLAB computer as mater and Raspberry Pi hardware as node1

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by