Ask Your Question
0

Rosrun in a cpp program

asked 2020-08-30 07:51:31 -0500

ferkus gravatar image

I have a program that publish in a topic that my arduino is subscribed. I am using kinetic in an Ubuntu distribution. Right now to make it work I have to write in two different command prompts the following:

rosrun rosserial_python serial_node.py _port:=/dev/ttyArduino _baud:=500000 //This is to start connexion with the arduino rosrun sigue_lineas camera_sigue_lineas //This is the program that I want to run

Is there a way to avoid writing the rosrun rosserial_python command by adding it to the C++ program? Is it possible to run any rosrun in a C++ program?

edit retag flag offensive close merge delete

Comments

If the issue is to write two command prompts, you could use a launch file.

Solrac3589 gravatar image Solrac3589  ( 2020-09-01 02:42:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-31 18:07:55 -0500

dtyugin gravatar image

Not sure exactly what you want to do, here are my suggestions:

  1. If you want just start another program from your c++ program you can use system command (Execute the given line as a shell command), or use QProcess from qt framework for advanced options of child process management.
  2. If you want to replace serial communication with c++ code you need to rewrite it using c++ API implementation of serial port. This again depends on your OS, but QSerialPort from qt framework allows you to do this on both linux/windows.
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-08-30 07:51:31 -0500

Seen: 69 times

Last updated: Aug 31 '20