Ask Your Question
0

Run QT project with ROS publisher/subscriber

asked 2016-04-14 05:06:04 -0500

JaneSheard gravatar image

updated 2016-04-14 07:02:51 -0500

Hi all,

I'm new to ROS. I have used the tutorials to make a catkin workspace with a publisher and subscriber cpp file. I have run these via terminal and they work fine. I have also created QT projects for them, and ran and they communicate.

My project involves a high speed vision system using QT for ball detection and tracking. I need to run a ROS publisher in this project on my laptop, and via wifi communicate with the subscriber in a QT project on an Odroid board (or vice versa), to send information about the located ball position/size/distance.

My questions are: 1. how can i put my ROS publisher into my existing QT project? 2. can I run QT after ssh into wifi? I get display errors. 3. can i send images from publisher to subscriber? 4. Everytime I want to run my current publisher/subscriber I have to remake my CMakeLists.txt file otherwise I get 'no executable specified' error - is this normal?

Thanks! :)


[EDIT]:

I'll try my best to explain it all.

I have simply put in the #includes (eg ros/ros.h) and added a ros::intit(<variables>) statement into my current project main, I get 'undefined reference to ros::init(<variables>)'

My vision project is a normal <project>.pro with header and sources. The ros qt project built off the CMakeLists.txt so its layout is different.. I get many many errors when I put my ros talker.cpp code into my vision project so I'm guessing I'm missing some includes or libs in my pro file :/

I have ssh into the odroid and run a publisher/subscriber using terminal command line like rosrun and this does work. I just cant run qtcreator apparently and get a display warning.

Thank you for the information on images! I have also been shown cv_bridge.

I've setup my publisher project following the ros IDE instructions, remaking the CMakeLists.txt and using this to build a new project. When I googled the error it comes up as an Ubuntu bug that hasn't been fixed. It doesnt appear if I remake the .txt file each time I open qtcreator. A huge pain!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-04-14 05:45:28 -0500

Airuno2L gravatar image

updated 2016-04-14 05:49:43 -0500

1). There is nothing special about ROS code, you can just take the code you did in your tutorials and copy and paste it into your QT project, the ROS stuff can be thought of as just a regular CMake project. Is there a specific problem you're having?

2). Yes, you can ssh into the Odroid using wifi. Another option would be to setup the Odroid to launch your programs at startup.

3). Yes, sending images is something people do with ROS all the time. Here is a link with plenty of information.

4). That is not normal, but I'm not sure how you're running it and don't have enough information to help.

edit flag offensive delete link more

Comments

My reply was too big, so I had to write a new answer but don't know how to quote/tag you in it :)

JaneSheard gravatar imageJaneSheard ( 2016-04-14 06:21:55 -0500 )edit

Don't I have to open the ros package in QT using my CMakeLists.txt? How can I just add ros code to an existing QT project without first making a ros package and using CMake?

JaneSheard gravatar imageJaneSheard ( 2016-04-14 07:22:07 -0500 )edit

Ah, I'm using qmake for my qt project.. I'm guessing I need to change this to CMake and it'll be in the right direction?

JaneSheard gravatar imageJaneSheard ( 2016-04-14 07:42:40 -0500 )edit

I had a similar problem. And, for me, it was easier to create a ROS catkin package, then open it with QT creator and all the previous code in there. It is not ideal, but it worked fine for me.

Mario Garzon gravatar imageMario Garzon ( 2016-04-14 09:37:07 -0500 )edit

@ Mario so once you've created your catkin package, do you move/copy all your existing QT cpp and header files into the package and add them to the CMake file? I am considering trying this, but also wondering if I modify my current QT project to use CMake and not qmake whether I can then ~

JaneSheard gravatar imageJaneSheard ( 2016-04-14 14:31:30 -0500 )edit

~ configure the cmake file to include the ros package?

JaneSheard gravatar imageJaneSheard ( 2016-04-14 14:32:26 -0500 )edit

Yes, you need to move/copy your files and then define libraries and executables in the CMakelist to include all your previous code, even if they don't use ROS. I've never tried to modify the QT project, but I guess you can do that as well.

Mario Garzon gravatar imageMario Garzon ( 2016-04-19 12:24:54 -0500 )edit

My project supervisor has recommended using the qmake project, so I now need to figure out how to run ros code in a qmake project and cant find much help online. Something about including paths to roscpp and rospy?

JaneSheard gravatar imageJaneSheard ( 2016-04-20 04:33:19 -0500 )edit
0

answered 2016-04-29 02:30:02 -0500

I also encountered such a problem, can you tell me how do you solve?

edit flag offensive delete link more

Comments

@rosWang you're using qmake with ros? The solution is actually quite simple - I was surprised. Install ROS as normal, if ubuntu desktop-full should install all your packages. Ubuntu ARM boards may need packages installing separately so make sure all your packages are good to go.

JaneSheard gravatar imageJaneSheard ( 2016-04-29 04:46:19 -0500 )edit

Right click on your project header or .pro file (like you would to add a new file) and choose add library. Choose the last option for system package, and add roscpp. I would check that this works by calling ros::init and if this works then you should be able to use ros!

JaneSheard gravatar imageJaneSheard ( 2016-04-29 04:48:14 -0500 )edit

Obviously remember to #include "ros/ros.h" and any other includes you may need. But all I needed was about 6 ros packages added in my .pro file and everything built.

If you're using an image publisher and using cv_bridge you may need to re-cmake your opencv build directory without openCL

JaneSheard gravatar imageJaneSheard ( 2016-04-29 04:50:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-04-14 05:06:04 -0500

Seen: 976 times

Last updated: Apr 29 '16