How to call rtabmap screen from rviz

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

How to call rtabmap screen from rviz

koba
Hi,

I want to display the rtabmap Loop closure detection screen,
Odometry screen, 3D Map screen, Graph view screen from rviz.
What kind of method do you think?

Thanks,
koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator
Hi,

3D Map screen is similar to add rtabmap_ros/MapCloud display to rviz. For graphview, it is similar to add separately the map display and the rtabmap_ros/MapGraph display to rviz. For loop closure and odometry screens, there is no similar widget in rviz, though you can add some odometry topics (like 3D points) in rviz. Otherwise, the easiest way is to use rtabmapviz directly (just keeping odometry and loop closure views shown).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
Hi Mathieu,

Thank you for your answer.

It seems easier to use rtabmapviz as described.
I was trying to customize the following with rviz plugin panel.

How do I add such a customized button in rtabmap?

Many Thanks,
koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator

Those kind of buttons are available through menu actions in rtabmapviz. If you want to add new larger buttons or widgets to rtabmapviz, the easiest way would be to edit the MainWindow UI with QtDesigner, then connect signals under the hood (MainWindow.cpp).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
Hi,

I will try that way.Thank you very much.

koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
In reply to this post by matlabbe
Hi,

I'm thinking about the implementation in rviz again.
For example, can you not open two screens, OrbitOriented (rtabmap_ros) and TopDownOrth (rviz)?

Last time, I added display in the way I was told, but the appearance did not change.
 Do you need to make any settings?
3D Map screen is similar to add rtabmap_ros / MapCloud display to rviz. For graphview, it is similar to add separately the map display and the rtabmap_ros / MapGraph display to rviz.



Many thank you,
koba

Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator
Use only one view. For 3D Map and GraphView, I was refering that you can have both information in the same view in RVIZ, by adding the corresponding displays (MapCloud, MapGraph, Map).
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
Hi,

Thank you for your answer.

I understood that I can only use 1 view.
I want to respond by switching the topDownOrth (rviz) and FPS (rviz) screens.
What kind of method can be considered in the program to cope with this?
Also, is it possible to display BackGroundColor in red like RTABMAP when Lost Odometry?

Many thanks,
koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator
Hi,

not sure if there is a programmatically way to switch views in rviz, though you could modify the "Views" panel of rviz to select the view differently (with a button instead of a combobox). Note that for FPV, you could add a "Camera" display.

For the background color, not sure how to do this in rviz from a plugin. But with Ogre (rendering engine used by RVIZ), it could be possible like this:
Ogre::RenderWindow::getViewport(int index)::setBackgroundColour (const ColourValue &colour)

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
Hi,

Thank you for your answer.
I will try to implement your answer in reference.

Is there a way to know Lost Odometry with rviz?
Is this function the information that is published from rtabmap-ros to rviz?
Is it a function that rtabmapviz is doing on its own?

Many thanks,
koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator
Hi,

You can subscribe to odom_info topic published by visual odometry node, there is a "lost" value that can give you the information: http://docs.ros.org/kinetic/api/rtabmap_ros/html/msg/OdomInfo.html

$rostopic echo /rtabmap/odom_info/lost

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
This post was updated on .
Hi,

Thank you for your answer.

I'm writing code based on your answers.
How to subscribe to rtabmap "/rtabmap/odom_info/lost" with the code below?
Please let me know if you have sample code.

**
#include "std_msgs/Bool.h"

void msgCallback (const std_msgs::Bool& msg)
{
// msg.data refer
// Change the display depending on the status
}

void timer_odom_info ()
{

ros::NodeHandle nh;
ros::Subscriber sub =
nh.subscribe ("/rtabmap/odom_info/lost", 1, msgCallback);

}
**

I think that this is called from a ROS plug-in created with Qt using a timer.
Please let me know if there is a better way.

**
// Timer set
this-> timer = new QTimer (this);
connect (this-> timer, SIGNAL (timeout ()), this, SLOT (timer_odom_info ()));
this-> timer-> setInterval (1000);
this-> timer-> start ();
**

Many thanks,
koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator
Hi,

I don't think you can subscribe directly to a subset member of a topic. I suggest to look at the InfoDisplay here:
https://github.com/introlab/rtabmap_ros/blob/master/src/rviz/InfoDisplay.h
https://github.com/introlab/rtabmap_ros/blob/master/src/rviz/InfoDisplay.cpp

which subscribes to rtabmap_ros/Info message. You could rename to OdomInfoDisplay and change the type to rtabmap_ros/OdomInfo msg.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
Hi,

Thank you for your answer.
I was able to get rtabmap_ros/OdomInfo msg information,
referring to the answer that you gave me.

I incorporated the following, which was taught last time when I was "LOST", but it did not work well.
Ogre::RenderWindow::getViewport(int index)::setBackgroundColour (const ColorValue & colour)

Isn't there a simple and good way to tell the user that you have "LOST" in this plugin?
The way to know in the UI is good.

Many thanks,
koba
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

matlabbe
Administrator
Hi,

I don't know how much is possible to do with rviz plugins. You may ask on ROS answers with a RVIZ specific question about changing the background color.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to call rtabmap screen from rviz

koba
Hi,

Tnak you for your reply.

I will ask ROS answers.

Many thanks,
koba