Ask Your Question
0

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.

##bashscript.sh

   source ~/.bashrc

 python pythonscript.py

##pythonscript.py

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__'):
    init()

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
0

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:

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

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

Comments

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

2 followers

Stats

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

Seen: 197 times

Last updated: Jun 28 '17