Ask Your Question

Rviz robot model will not open via script

asked 2017-06-28 08:18:19 -0500

vrosuser gravatar image

Without bash and python script: master and rviz works successfully

When I run "roscore" in first terminal. Master runs successfully

process[master]: started with pid [4355] ROS_MASTER_URI=http://userid:11311/

New terminal I type in "roslaunch /home/userid/catkin_ws/src/robot/launch/robot.launch". This basically open RVIZ with the robot model in grid successfully

Above steps are implemented as follows in bash and python script and it does NOT work.

   source ~/.bashrc


def init():
    os.system("gnome-terminal -e 'bash -c \"pwd; roslaunch /home/userid/catkin_ws/src/robot/launch/robot.launch; exec bash\"'")

if (__name__ == '__main__'):

This fails. RVIZ opens with a white blob in center on grid NOT the robot model. and left hand panel it says robot model error. status error.

Why rviz wouldn't work with script?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-28 12:08:55 -0500

Felix_N gravatar image

Why would you want to start rviz from inside a python file at all?

It's hard to tell if that fits your functionality, but maybe you can use a ros launchfile.

You could then launch your executable as well as the other launchfile like this:

    <include file="$(find robot)/launch/demo.launch"/>
    <node name="mynode" pkg="mypkg" type="pythonscipt />

To get this to work you need to define "pythonscript" as an executable in your CMakeList.txt of course.

edit flag offensive delete link more


My plan was to include all launch cmds in python script. so user will have to simply run one python script, instead of doing a roslaunch. I will try the solution you have proposed.

I would still like to understand the theory as to why the method I have implemented not work.?

vrosuser gravatar image vrosuser  ( 2017-06-29 08:04:15 -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



Asked: 2017-06-28 08:18:19 -0500

Seen: 212 times

Last updated: Jun 28 '17