rqt plugin crhashes static map rviz

asked 2014-03-14 01:25:04 -0500

acp gravatar image

updated 2015-11-14 07:05:46 -0500

lucasw gravatar image

Dear all,

I have created a rqt plugin in python. When I run the application rqt and then I invoke the launch file within my plugin.py and then I tick the static map option in Rviz, I get the following error:

[ WARN] [1394792185.671328003]: Failed to create full-size map texture, likely because your graphics card does not support textures of size > 2048.  Downsampling to [2048 x 2048]...
terminate called after throwing an instance of 'Ogre::RenderingAPIException'
  what():  OGRE EXCEPTION(3:RenderingAPIException): Zero sized texture surface on texture MapTexture0Downsampled face 0 mipmap 0. Probably, the GL driver refused to create the texture. in GLTexture::_createSurfaceList at /build/buildd/ogre-1.7.4/RenderSystems/GL/src/OgreGLTexture.cpp (line 406)
Aborted (core dumped)

But the funny thing is that, if I run Rviz separately from the plugin with the command rosrun rviz rviz and then I run map server command and then I tick the static map in Rviz. I have no error and the map is uploaded into Rviz.

To be sincere I have no clue what is triggering this error.

I will appreciate any help.

The code is just down here

from __future__ import division
import os
import rospy
import sys
import rospkg
import subprocess

from actionlib_msgs.msg import GoalID
from PyQt4 import QtCore, QtGui
from rosgraph import rosenv
from rqt_gui_py.plugin import Plugin
from python_qt_binding import loadUi
from python_qt_binding.QtGui import QWidget, QKeySequence, QShortcut, QFileDialog, QIcon, QDialog, QStandardItem
from rqt_msg.messages_widget import MessagesWidget
from python_qt_binding.QtCore import Qt, QTimer, Slot,  QModelIndex, Signal

import roslaunch
from roslaunch.core import RLException

 #from rqt_py_common import rosaction


class AWCPlugin(Plugin):
    def __init__(self, context):
        super(AWCPlugin, self).__init__(context)
        self.setObjectName('AWCPlugin')

        self._publisher = None
        self._rospack = rospkg.RosPack()

        self._widget = QWidget()  # MessagesWidget(rosaction.MODE_ACTION)
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_awc'), 'resource', 'awc_gui.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('AWCPlugin')


       # self._widget.setWindowTitle('AWC')



        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        context.add_widget(self._widget)


        # self._widget.start.pressed.connect(self._on_start_clicked)
        self._widget.restart.pressed.connect(self._on_restart_clicked)
        self._widget.autonomous.pressed.connect(self._handle_autonomous)
        self._widget.joystick.pressed.connect(self._handle_joystick)
         #self._widget.stop_joystick.pressed.connect(self._on_stop_joystick_clicked)
        self._widget.stop.pressed.connect(self._on_stop_pressed)
        self._widget.semi_autonomous.clicked[bool].connect(self._handle_semi_autonomous)
        # self._widget.stopautonomous.pressed.connect(self._on_stop_autonomous)


    global joystick_flag, start_flag,re_start_flag, autonomous_flag,semiautonomous_flag,runner_start,stop_flag   
    joystick_flag        = 0    
    start_flag           = 0
    re_start_flag        = 0
    autonomous_flag      = 0
    semiautonomous_flag  = 0
    stop_flag            = 0
     #runner_start = 0
    @Slot(str)
    def _handle_autonomous(self): 
        global  start_flag,joystick_flag,autonomous_flag,runner_start,start_flag
        if autonomous_flag == 0:
            self._widget.textEdit.setText("<font size = '30' color ='red'>AUTONOMOUS</font>")
            self._widget.textEdit.setAlignment(QtCore.Qt.AlignCenter)
            launchfile_name = 'patrolbot_navigation.launch'
            folder_name_launchfile = 'launch'
            pkg_name  =  'awc_navigation'
            # try:
             #launchfile = os.path.join(rospkg.RosPack().get_path(pkg_name), folder_name_launchfile, launchfile_name)
             #print( launchfile)
            args =  roslaunch.rlutil.resolve_launch_arguments([pkg_name, launchfile_name])
            rospy.loginfo("Starting task: %s"%args)
            runner_start = roslaunch.parent.ROSLaunchParent(rospy.get_param("/run_id"), args)
            runner_start.start()
                 #start_flag = 0
            autonomous_flag =1
                 #re_start_flag = 1
             #return start_flag
            # except IndexError as e:
                # raise ...
(more)
edit retag flag offensive close merge delete

Comments

Can you show your code in plugin.py?

ZdenekM gravatar image ZdenekM  ( 2014-03-14 03:24:00 -0500 )edit

The code is just up here, the funny thing is that it was working well.

acp gravatar image acp  ( 2014-03-14 05:14:00 -0500 )edit

Souns like the launchfile you're launching is publishing a huge map. You can do "rostopic echo /map --noarr" and watch the output when you run your plugin to see the exact size.

jbinney gravatar image jbinney  ( 2014-03-14 13:03:30 -0500 )edit

Well, I get this map size width: 1984 height: 1984 Then I get another error: terminate called after throwing an instance of 'Ogre::InternalErrorException' what(): OGRE EXCEPTION(7:InternalErrorException): Cannot create GL vertex buffer in GLHardwareVertexBuffer::GLHardwareVertexBuffer at /build/buildd/ogre-1.7.4/RenderSystems/GL/src/OgreGLHardwareVertexBuffer.cpp (line 46)

acp gravatar image acp  ( 2014-03-16 03:18:59 -0500 )edit

The funny thing is that it works quite well when I launch the application in a launch file outside the rqt plugin GUI. I have installed rosserial following this site, http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup maybe that installation somehow screw up my rqt plugin

acp gravatar image acp  ( 2014-03-16 03:25:12 -0500 )edit