ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Xiuda's profile - activity

2014-08-06 22:58:32 -0500 received badge  Student (source)
2014-08-06 22:58:31 -0500 received badge  Self-Learner (source)
2014-08-06 22:58:31 -0500 received badge  Teacher (source)
2014-07-16 17:48:42 -0500 received badge  Famous Question (source)
2014-07-14 02:42:20 -0500 received badge  Notable Question (source)
2014-07-09 12:40:42 -0500 received badge  Supporter (source)
2014-07-09 12:39:52 -0500 received badge  Enthusiast
2014-07-09 01:49:57 -0500 received badge  Popular Question (source)
2014-07-08 16:43:15 -0500 answered a question Why would librviz (in Python) only sometimes read the config file?

There was an issue with it not finding the correct path to the config.rviz file. I realized it when it worked in a terminal window that was in the package directory but not in one where it was not. Adding a launchfile that specifies the location of the file as a parameter fixes this problem.

        import rospkg

and in the init for the class we have

    reader = rviz.YamlConfigReader()
    config = rviz.Config()

# We use rospack to find the filepath for the package using rviz.
    rospack = rospkg.RosPack()
    package_path = rospack.get_path('demo')
#Now you can grab this filepath from either roslaunch and using the launch file or just rosrun with the file in a config folder
    config_file = rospy.get_param('demo/rviz_config', package_path + "/config/myConfig.rviz")
    reader.readFile( config, config_file )
    self.frame.load( config )
2014-07-02 18:18:17 -0500 asked a question Why would librviz (in Python) only sometimes read the config file?

I am using librviz in a GUI using python (PyQt/PySide) I started with the librviz tutorial (docs.ros.org/hydro/api/rviz_python_tutorial/html/) and was able to use my own config files to show the panels and views that I want. The problem is that it is extremely sporadic.

I have tried:

  • alternating config files
  • downloading the tutorial and testing my config file with the tutorial script
  • using the tutorial config file (raw.githubusercontent.com/ros-visualization/visualization_tutorials/hydro-devel/rviz_python_tutorial/config.myviz) with my script
  • using the tutorial config file with the original tutorial code.
  • restarting the computer
  • Loading the config files into rviz (this works)

When it doesn't work, it looks something like this (tutorial script + tutorial config file): Broken image- i.imgur.com/j1rlQsf.png)

I note that it probably isn't reading the config file properly, because one of the first functions in the tutorial pulls from the file and changes the title, and it does not manage to even do that.

When it is working (my code + my config): Working image: (i.imgur.com/nN7vKkF.png)