You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running on Ubuntu 22.04 with ROS Humble installed.
While the rest of the components in the librviz tutorial works (changing grid spacing, grid line thickness), I am completely unable to move the camera.
I've attempted to enable mouse tracking of the render_panel_ via render_panel_->setMouseTracking(true); but this had no effect.
I can confirm QMouseEvents are triggering on the main window widget using qDebug, which to me strikes as a sign it's not a Qt installation issue.
Aside from the mouse tracking being enabled, the code is exactly as it is in the ros2 branch of MyViz under librviz_tutorial.
It's worth noting that I was able to move the camera programmatically using the following:
But would prefer to use the Orbit controller the render_panel_ already has for controlling the camera with a mouse if possible.
Anyone been able to get specifically the ROS2 branch of this code to work with camera mouse controls?
The text was updated successfully, but these errors were encountered:
Finally figured it out after weeks of trudging through QT forums and rviz source code, seems simple once you figure it out!
The first indicator was the segfault caused when a key was pressed after having clicked the render panel: 0x00007ffff7f2fc0f in rviz_common::ToolManager::handleChar(QKeyEvent*, rviz_common::RenderPanel*) () from /opt/ros/humble/lib/librviz_common.so
At first I disregarded this as a separate issue but turns out it's somewhat related, and my problem was that I didn't properly add the moveCamera tool (dead obvious once figured out) to the VisualizationManager's ToolManager.
auto clock = rviz_ros_node_.lock()->get_raw_node()->get_clock();
rviz_common::WindowManagerInterface * wm = nullptr;
manager_ = new rviz_common::VisualizationManager(render_panel_, rviz_ros_node_, wm, clock);
render_panel_->initialize(manager_);
std::cout << render_panel_->children().size() << std::endl;
app_->processEvents();
manager_->initialize();
manager_->startUpdate();
auto tm = manager_->getToolManager();
tm->addTool("rviz_default_plugins/MoveCamera");
With the above code added to the rest of the widget code, it works perfectly and no longer segfaults on keypresses either.
For anyone having this problem with Foxy (I know it is EOL). There is no tool_manager.hpp header when rviz is installed through apt. If you get the error: error: invalid use of incomplete type ‘class rviz_common::ToolManager’
Just copy the tool_manager.hpp header from rviz_common/src to you package.
I am running on Ubuntu 22.04 with ROS Humble installed.
While the rest of the components in the librviz tutorial works (changing grid spacing, grid line thickness), I am completely unable to move the camera.
I've attempted to enable mouse tracking of the
render_panel_
viarender_panel_->setMouseTracking(true);
but this had no effect.I can confirm
QMouseEvents
are triggering on the main window widget using qDebug, which to me strikes as a sign it's not a Qt installation issue.Aside from the mouse tracking being enabled, the code is exactly as it is in the ros2 branch of MyViz under librviz_tutorial.
It's worth noting that I was able to move the camera programmatically using the following:
But would prefer to use the Orbit controller the
render_panel_
already has for controlling the camera with a mouse if possible.Anyone been able to get specifically the ROS2 branch of this code to work with camera mouse controls?
The text was updated successfully, but these errors were encountered: