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

Revision history [back]

click to hide/show revision 1
initial version

Hey guys,

i just want to add my final code to this problem (note only used with ROS indigo):

bool QNode::init(const std::string &master_url, const std::string host_url, const std::string &name){

Hey guys,

i just want to add my final code to this problem (note only used with ROS indigo):

bool QNode::init(const std::string &master_url, const std::string host_url, &host_url, const std::string &name){
&name ) {


    if(ros::isInitialized()){
        m_instanciated = true;
        qDebug() << "ROS already initialized.";
        //return true;
    } else {
        std::map<std::string,std::string> remappings;
        remappings["__master"] = master_url;
        remappings["__hostname"] = host_url;
        ros::init(remappings, name);
        ix = 0;
    }

    if(ros::isStarted()){
        qDebug() << "ROS already started.";
        //return true;
    }

    if ( ! ros::master::check() ) {
       return false;
    }

    ros::start(); // explicitly needed since our nodehandle is going out of scope.

    ros::NodeHandle n;

/**RVIZ PointCloudContainer is set from your GUI-Class e.g qnode.setRvizPointCloudContainer(gui->pointCloudContainer)**/

pointCloud_panel = new rviz::RenderPanel();
    managerPointCloud =  new rviz::VisualizationManager(pointCloud_panel);
    pointCloud_panel->initialize(managerPointCloud->getSceneManager(), managerPointCloud);
    pointCloudContainer->addWidget(pointCloud_panel);
    pointCloud_panel->setBackgroundColor( Ogre::ColourValue(0, 0,0,0.3));

    managerPointCloud->initialize();
    managerPointCloud->startUpdate();
/**E.g. For velodyne **/
    managerPointCloud->setFixedFrame("velodyne");
    grid = managerPointCloud->createDisplay("rviz/Grid","Grid",true);

    pointCloudTop->subProp("Topic")->setValue("velodyne_points");
    pointCloudTop->subProp("Style")->setValue("Points");
    pointCloudTop->subProp("Size (Pixels)")->setValue("2");
    pointCloudTop->subProp("Color Transformer")->setValue("Intensity");
    pointCloudTop->subProp("Invert Rainbow")->setValue("true");

    }

Hey guys,

i just want to add my final code to this problem (note only used with ROS indigo):

bool QNode::init(const std::string &master_url, const std::string &host_url, const std::string &name ) {


    if(ros::isInitialized()){
        m_instanciated = true;
        qDebug() << "ROS already initialized.";
        //return true;
    } else {
        std::map<std::string,std::string> remappings;
        remappings["__master"] = master_url;
        remappings["__hostname"] = host_url;
        ros::init(remappings, name);
        ix = 0;
    }

    if(ros::isStarted()){
        qDebug() << "ROS already started.";
        //return true;
    }

    if ( ! ros::master::check() ) {
       return false;
    }

    ros::start(); // explicitly needed since our nodehandle is going out of scope.

    ros::NodeHandle n;

/**RVIZ PointCloudContainer is set from your GUI-Class e.g qnode.setRvizPointCloudContainer(gui->pointCloudContainer)**/

pointCloud_panel = new rviz::RenderPanel();
    managerPointCloud =  new rviz::VisualizationManager(pointCloud_panel);
    pointCloud_panel->initialize(managerPointCloud->getSceneManager(), managerPointCloud);
    pointCloudContainer->addWidget(pointCloud_panel);
    pointCloud_panel->setBackgroundColor( Ogre::ColourValue(0, 0,0,0.3));

    managerPointCloud->initialize();
    managerPointCloud->startUpdate();
/**E.g. For velodyne **/
    managerPointCloud->setFixedFrame("velodyne");
    grid = managerPointCloud->createDisplay("rviz/Grid","Grid",true);

    pointCloudTop->subProp("Topic")->setValue("velodyne_points");
    pointCloudTop->subProp("Style")->setValue("Points");
    pointCloudTop->subProp("Size (Pixels)")->setValue("2");
    pointCloudTop->subProp("Color Transformer")->setValue("Intensity");
    pointCloudTop->subProp("Invert Rainbow")->setValue("true");

    }

Hey guys,

i just want to add my final code to this problem (note only used with ROS indigo):

bool QNode::init(const std::string &master_url, const std::string &host_url, const std::string &name ) {


    if(ros::isInitialized()){
        m_instanciated = true;
        qDebug() << "ROS already initialized.";
        //return true;
    } else {
        std::map<std::string,std::string> remappings;
        remappings["__master"] = master_url;
        remappings["__hostname"] = host_url;
        ros::init(remappings, name);
        ix = 0;
    }

    if(ros::isStarted()){
        qDebug() << "ROS already started.";
        //return true;
    }

    if ( ! ros::master::check() ) {
       return false;
    }

    ros::start(); // explicitly needed since our nodehandle is going out of scope.

    ros::NodeHandle n;

/**RVIZ PointCloudContainer is set from your GUI-Class e.g qnode.setRvizPointCloudContainer(gui->pointCloudContainer)**/

pointCloud_panel = new rviz::RenderPanel();
    managerPointCloud =  new rviz::VisualizationManager(pointCloud_panel);
    pointCloud_panel->initialize(managerPointCloud->getSceneManager(), managerPointCloud);
    pointCloudContainer->addWidget(pointCloud_panel);
    pointCloud_panel->setBackgroundColor( Ogre::ColourValue(0, 0,0,0.3));

    managerPointCloud->initialize();
    managerPointCloud->startUpdate();
/**E.g. For velodyne **/
    managerPointCloud->setFixedFrame("velodyne");
    pointCloud = managerPointCloud->createDisplay("rviz/PointCloud2","PointCloudAir", true);
    grid = managerPointCloud->createDisplay("rviz/Grid","Grid",true);

    pointCloudTop->subProp("Topic")->setValue("velodyne_points");
    pointCloudTop->subProp("Style")->setValue("Points");
    pointCloudTop->subProp("Size pointCloud->subProp("Topic")->setValue("velodyne_points");
    pointCloud->subProp("Style")->setValue("Points");
    pointCloud->subProp("Size (Pixels)")->setValue("2");
    pointCloudTop->subProp("Color pointCloud->subProp("Color Transformer")->setValue("Intensity");
    pointCloudTop->subProp("Invert pointCloud->subProp("Invert Rainbow")->setValue("true");

    }