ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Opening an image file with ros

asked 2022-09-20 21:20:46 -0500

sajid1122 gravatar image

updated 2022-09-22 05:53:15 -0500

I want ROS to help me open an image file when a trigger/condition occurs.

For example I have a hello world program, which prints:

hello world [1] hello world [2] hello world [3]

when the hello world program reaches hello world [5] i want ROS to automatically help me open up for example

image1.jpg

or perhaps any file for that matter, maybe word1.docs. All in all, how can i get ros to help open up a file when there is a condition/trigger.

How can i do this? Thanks for any help.

Edit:

so sorry i seemed very unclear to a lot of people and i missed out many key points.

I want to do this on with the c++ language.

And i just wanted to know if there were any packages that i could download that is able to support this functionality, it seems that ROS dosent support this according to the responses.

I tried searching if there were any packages that can has this feature which i mentioned and i couldn’t find any. And i couldn’t find anyone else with who posted a similar question on this forum so i decided to ask here.

Im using Ubuntu 20.04 with ros noetic.

Why do i need this function? Im trying to implement a program where if the program fulfills a certain condition i want the led screen display to change. For example, the robot is about to enter a lift, i want the led screen on the robot to show an image saying, “entering lift with red background” or if i am doing a task which is dangerious i want to show an image to tell people to keep away from the place with an image.

How is the image shown on the led panel? I have hdmi connected to my pc and so i wanted to trigger ros to open an image and the image will be directly displayed onto the led screen.

Once again, i did not find anything while googling this feature so i asked it on this forum.

So sorry for not following the rules of this forum. I’ll be more clearer here on.

edit retag flag offensive close merge delete

Comments

This question is not written correctly or does not contain sufficient information. Moreover, ROS is not designed to open a file! Please:

  • Describe what you have already tried
  • Where you found that
  • What you expected to happen
  • What actually happened (if it did not work)
  • What do you believe the problem could be

Then we can help you.

ROS Answers is not a place where we expect other people to just do your work for you. Of course, we help you try to get your work done, but we have to see a little effort on your side first.

ravijoshi gravatar image ravijoshi  ( 2022-09-20 23:01:06 -0500 )edit

@sajid1122 When asking this kind of question, you need to tell us what programming language and what operating system you are using. The answer is going to depend on both pieces of information.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-09-21 08:48:41 -0500 )edit

You don't need ROS for this... Just go with any image processing library e.g. OpenCV: https://docs.opencv.org/4.x/db/deb/tu...

GeorgNo gravatar image GeorgNo  ( 2022-09-22 05:36:55 -0500 )edit

... perhaps any file for that matter, maybe word1.docs...

@GeorgNo: We are not sure what exactly he/she wants. I hope to hear more from @sajid1122

ravijoshi gravatar image ravijoshi  ( 2022-09-22 05:40:32 -0500 )edit

Hi guys, so sorry about what i did. I have updated the post.

sajid1122 gravatar image sajid1122  ( 2022-09-22 05:53:41 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2022-09-22 08:27:21 -0500

Mike Scheutzow gravatar image

updated 2022-09-22 08:31:36 -0500

What you are describing is called "running a child process". The most common way to do this in c++ is to use the system() or popen() calls. Google for how to use these.

However, you need to careful when using system() call in ros because the call blocks execution until the child process exits. This means you get really bad performance if you call it directly from a subscribe callback. What you need to do instead is: inside the subscribe callback you launch a new thread, then call system() from inside the thread.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-09-20 21:20:46 -0500

Seen: 63 times

Last updated: Sep 22 '22