Ask Your Question

riot's profile - activity

2020-12-18 16:41:35 -0500 marked best answer IDEs QT Creator - Desktop Entry Troubles

Ok ROS Team, you very efficient at solving my problems last time, but this one is a real brain bender:

I have successfully integrated to ROS C++ libraries into my QT environment, and I am able to call ROS functions from within my programs, and they execute properly.

In order to run my resulting programs in QT, I either need to:

  1. Run them from a terminal
  2. Modify my QT .desktop [desktop entry] file

I followed the instructions for (2) from the ROS IDE page here: http://wiki.ros.org/IDEs#QtCreator

--> Essentially I added the terms "bash -i -c", to the exec line for my .desktop entry.

Here is where it gets weird:

My QT Creator will launch properly and run my ROS applications ONLY ONCE per boot. So If I launch QT Creator after a restart everything works correctly, but if I close it and relaunch it, bash hangs and never launches the app!

Further, I have created a .desktop entry for my resulting QT application and it has an even stranger behavior:

-- If place my .desktop entry on the desktop (or many other tested locations such as /usr/share/applications), it behaves the same as QT creator. It launches only once.

-- If I place my .desktop file on my home directory it works correctly!

Since catkin_ws is on my home path, I suspect it has something to do with my terminal trying to find source files in catkin_ws, but I am at a loss for how to resolve this using the .desktop file.

Specifics: ROS Melodic installed on /opt/ros/melodic/ I have 2 systems, both running Ubuntu 18.04 LTS.
Both have QT Creator QT 5.12.1.
My catkin_ws path is /home/<user>/catkin_ws in /home/<user>/ is my .bashrc, which has been modified to include the ros and catkin sources as listed in the tutorial.

Finally, my code:

[Desktop Entry]
Type=Application
Exec=bash -i -c /opt/Qt5.12.1/Tools/QtCreator/bin/qtreator**
Name=Qt Creator (Enterprise)
GenericName=The IDE of Choice for Qt developmen
Icon=QtProject-qtcreator
SytartupWMClass=qtcreator
Terminal=false
Categories=Development;IDE;Qt;
MimeType=text/x-c++src;text/x-c++hdr;text/....

I suspect the Exec line is the source of the trouble, the remaining entry was unchanged from the original QT .desktop entry file.

Does anyone know how to modify my .desktop exec line so that the resulting terminal application launched from my home directory (or with visibility to it)? Or is there some alternative way that you have solved this problem?

Thanks in advance!

2020-06-15 06:59:58 -0500 received badge  Famous Question (source)
2019-12-19 12:47:50 -0500 received badge  Famous Question (source)
2019-12-19 12:36:18 -0500 received badge  Student (source)
2019-12-06 10:16:59 -0500 received badge  Notable Question (source)
2019-10-21 06:01:05 -0500 received badge  Notable Question (source)
2019-10-10 11:11:14 -0500 received badge  Popular Question (source)
2019-07-29 08:23:31 -0500 received badge  Popular Question (source)
2019-07-27 12:56:41 -0500 received badge  Rapid Responder (source)
2019-07-27 12:56:41 -0500 answered a question IDEs QT Creator - Desktop Entry Troubles

Ok Update! Setting the .desktop entry for Terminal from 'false' to 'true', now allows the QT Creator to be relaunched i

2019-07-27 11:28:15 -0500 edited question IDEs QT Creator - Desktop Entry Troubles

IDEs QT Creator - Desktop Entry Troubles Ok ROS Team, you very efficient at solving my problems last time, but this one

2019-07-27 11:25:20 -0500 asked a question IDEs QT Creator - Desktop Entry Troubles

IDEs QT Creator - Desktop Entry Troubles Ok ROS Team, you very efficient at solving my problems last time, but this one

2019-07-12 10:50:10 -0500 marked best answer calling ros::spin or ros::spinOnce from other function in QT

Hello,

I am very new to ROS and I have just manged to integrate the ROS libraries into my QT IDE.

I am building a fairly complex application, however the ROS subscriber example I am attempting to implement fairly simple.

If I implement my code this way (per the examples), I get subscriber callbacks as expected:

void MainWindow::rtsp1Callback(const sensor_msgs::Image::ConstPtr& msg)
{
    qDebug() << "rtsp1 Image has data";
}

With this initializer:

void MainWindow::on_ROSSubscribeButton_clicked()
{
    ros::init(m_argc, m_argv, "camera_check");
    ros::NodeHandle n1;
    ros::Subscriber sub1 = n1.subscribe("/rtsp_1/image_raw", 100, &MainWindow::rtsp1Callback, this);
    ros::spin();
}

But of course, this is an undesirable design, as ros::spin(); then blocks the rest of my program.

So I execute a timer to call ros::spinOnce(); on demand:

Callback unchanged:

void MainWindow::rtsp1Callback(const sensor_msgs::Image::ConstPtr& msg)
{
    qDebug() << "rtsp1 Image has data";
}

Initializer with timer:

void MainWindow::on_ROSSubscribeButton_clicked()
{
    ros::init(m_argc, m_argv, "camera_check");
    ros::NodeHandle n1;
    ros::Subscriber sub1 = n1.subscribe("/rtsp_1/image_raw", 100, &MainWindow::rtsp1Callback, this);
    CameraCheckTimer.start(100);  //calls ros::spinOnce() every 1000ms;
}

And this spin call (on timer execution):

void MainWindow::checkCameras()
{
    ros::spinOnce();
    qDebug() << "Spin!";
}

However I do not get any callbacks.

I also tested calling ros::spin() - which was working in my initial example, by calling a singleShot timer. When I do this, my program blocks as expected, however I do not get any callbacks.

This makes me suspect that ros::spin() and ros::spinOnce() are somehow getting an implicit pointer to the GlobalCallbackQueue from the ros::init() function. Is this the case?

If so, what is the data type of ros::GlobalCallbackQueue (so that I can pass a global pointer to it into my timer loop)?

Or, if you have an example of how to simply fix my problem, I will accept that as well!

2019-07-12 10:50:10 -0500 received badge  Scholar (source)
2019-07-12 10:49:52 -0500 answered a question calling ros::spin or ros::spinOnce from other function in QT

Thank you for your very concise answer! I simply declared the handles as 'static' and they now persist outside of the c

2019-07-12 10:49:52 -0500 received badge  Rapid Responder
2019-07-12 09:28:36 -0500 asked a question calling ros::spin or ros::spinOnce from other function in QT

calling ros::spin or ros::spinOnce from other function in QT Hello, I am very new to ROS and I have just manged to inte