Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Run a terminal command with a button click
QtWS25 Last Chance

Run a terminal command with a button click

Scheduled Pinned Locked Moved Unsolved General and Desktop
rosterminalubuntuqprocesscommand
2 Posts 2 Posters 883 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aliemrenebiler
    wrote on last edited by
    #1

    Hi,
    We are creating a GUI for our Rover project. Rover is working with ROS and right now we are dealing with a problem.
    We are using different programs for the vehicle, one of them is Rviz. We have a 3D model on Rviz and we open that model with terminal codes:

    1. We open the terminal
    2. We start the roscore with "roscore".
    3. We open another terminal and go to the direction that launch file exists
    4. and launch the model with "roslaunch display.launch" (display.launch is the file name)

    That opens the full model on Rviz. We want to make it happen with single button click but all solutions are useless. QProcess is not working, the program never opens and says as output "QProcess: Destroyed while process ("...") is still running.".

    So the question is, how can we start a terminal and run a terminal command? Terminal doesn't have to appear, only the code should work (if terminal appears, it is not a problem).

    NOTE: roslaunch or roscore is not system commands, other system commands work but these are not working.

    C 1 Reply Last reply
    0
    • A aliemrenebiler

      Hi,
      We are creating a GUI for our Rover project. Rover is working with ROS and right now we are dealing with a problem.
      We are using different programs for the vehicle, one of them is Rviz. We have a 3D model on Rviz and we open that model with terminal codes:

      1. We open the terminal
      2. We start the roscore with "roscore".
      3. We open another terminal and go to the direction that launch file exists
      4. and launch the model with "roslaunch display.launch" (display.launch is the file name)

      That opens the full model on Rviz. We want to make it happen with single button click but all solutions are useless. QProcess is not working, the program never opens and says as output "QProcess: Destroyed while process ("...") is still running.".

      So the question is, how can we start a terminal and run a terminal command? Terminal doesn't have to appear, only the code should work (if terminal appears, it is not a problem).

      NOTE: roslaunch or roscore is not system commands, other system commands work but these are not working.

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @aliemrenebiler said in Run a terminal command with a button click:

      QProcess is not working, the program never opens and says as output "QProcess: Destroyed while process ("...") is still running.".

      The problem would appear to be that your QProcess object goes out of scope (is destroyed) while the process you asked it to launch is still running i.e. exactly what the error message says. This is most likely because you have create the QProcess on the stack in the slot handling your button click, but it could be because it is parented to another QObject that is destroyed.

      We can only guess without seeing your code.

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved