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

Problems trying to use RViz ViewController API

asked 2015-03-21 16:01:29 -0500

Georacer gravatar image

Hello everyone,

I'm trying to create a camera controller for RViz, which will allow me to track a flying target while standing stationary in the /map frame.

I found this topic and decided to use the ViewController API.

I wrote the following code:

#include <ros/ros.h>
#include <rviz/display.h>
#include "rviz/common.h"
#include "rviz/properties/forwards.h"

#include <last_letter_msgs/SimStates.h>

#define UPDATE_RATE 30

rviz::ViewController * cameraControls;
ros::Subscriber sub;

/////////////////////////////////////
// Callback to point camera to UAV //
/////////////////////////////////////
void pointCamera(const last_letter_msgs::SimStates& state){
    float x = state.pose.position.x;
    float y = state.pose.position.y;
    float z = state.pose.position.z;
    cameraControls.lookat(x,y,z);
}

//////////////////
//Main function //
//////////////////
int main(int argc, char **argv)
{

    ros::init(argc, argv, "sceneControls");
    ros::NodeHandle n;

    sub = n.subscribe("states",1, pointCamera);

    ros::Duration(10).sleep(); //wait for other nodes to get raised
    ros::Rate spinner(UPDATE_RATE);

    spinner.sleep();
    cameraControls = VisualizationManager::getCurrentViewController;
    ROS_INFO("sceneControls up");

    while (ros::ok())
    {
        ros::spinOnce();
        spinner.sleep();

        if (isnan(uav.states.velocity.linear.x))
        {
            ROS_FATAL("State NAN detected on sceneControls!");
        }
    }

    return 0;

}

However, I get this error message on catkin_make:

In file included from /opt/ros/indigo/include/rviz/properties/status_property.h:32:0,
                 from /opt/ros/indigo/include/rviz/display.h:38,
                 from /home/george/catkin_ws/src/last_letter/last_letter/include/cameraController.hpp:2,
                 from /home/george/catkin_ws/src/last_letter/last_letter/src/cameraController.cpp:1:
/opt/ros/indigo/include/rviz/properties/property.h:34:19: fatal error: QObject: No such file or directory
 #include <QObject>
                   ^
compilation terminated.
make[2]: *** [last_letter/last_letter/CMakeFiles/cameraController.dir/src/cameraController.cpp.o] Error 1
make[1]: *** [last_letter/last_letter/CMakeFiles/cameraController.dir/all] Error 2
make: *** [all] Error 2

I'm running ROS Indigo on Ubuntu 14.04.2.

Thanks in advance!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-09 08:18:10 -0500

kramer gravatar image

The compile process can't find QObject, part of Qt. This indicates you're missing build information from the CMakeLists.txt.

I haven't yet transitioned to catkin, so I'm not really in a position to give you proper guidance. But I suspect part of the issue is that you're looking at examples for ROS fuerte, which (if I recall correctly) only used rosbuild.

Again, as I recall, the rviz_animated_view_controller (referenced in your link above) was transitioned to catkin; you might take a look at the build files there for help.

edit flag offensive delete link more
0

answered 2015-06-08 08:23:07 -0500

Georacer gravatar image

Hello Josep,

No, sadly I didn't manage to make any progress with this problem and as you saw, documentation is very scarce.

It's weird how some features, which you would expect they would be clearly documented and implemented, still lie outside the ROS wiki.

edit flag offensive delete link more
0

answered 2015-06-08 05:05:38 -0500

Hi, sorry to not add any answer to your question. I am also interested on controling the point of view and wondered if you succeeded in your attempt.

Thank's in advance.

Josep Arnau

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-03-21 16:01:29 -0500

Seen: 501 times

Last updated: Jun 09 '15