Gazebo | Ignition | Community
Ask Your Question

How can I turn off the Space Navigator's control of the camera?

asked 2016-08-23 11:32:33 -0500

I'm using a plugin to control models with the Space Navigator (spacenav 6 DOF) 3D mouse. It works, but the controller is controlling both the object (through the spnav external library) and the camera at the same time. I'm looking for a way to turn off the camera control and just use the regular mouse for that. If necessary, it looks like i could recompile Gazebo from source after commenting out the relevant lines in gazebo/gui/CMakeLists.txt, but it would be easier to use ~/.gazebo/gui.ini, or an API call, or something.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-10-26 10:19:57 -0500

Illuminatur gravatar image

There is a much easier way: Just adapt the configuration in ~/.gazebo/gui.ini

deadband_x = 0.1
deadband_y = 0.1
deadband_z = 0.1
deadband_rx = 0.1
deadband_ry = 0.1
deadband_rz = 0.1

Just change the topic to something you are going to listen in your own plugin and it will not interfere with the gui, which listens to ~/spacenav/joy

Best regards!

edit flag offensive delete link more


this works and is easy, thanks!

Oscar Lima gravatar imageOscar Lima ( 2021-04-14 22:53:24 -0500 )edit

answered 2016-08-23 15:17:22 -0500

Alright, I found out how. You apparently have to create a plugin to do this; I didn't find a way to do it from the model plugin in which I use the Space Navigator. But it works if you create a visual plugin and refer to it in a <plugin> element within a <visual> element in the SDF file. Here's the plugin code I used:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>

namespace gazebo
{ class MyVisualPlugin : public VisualPlugin
  { public: 
      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // Turn off the SpaceNavigator's default camera control
        rendering::UserCameraPtr cam = _visual->GetScene()->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );

  // Register this plugin with the simulator
edit flag offensive delete link more


+1 for the workaround. I feel like there should be an easier way of doing this, either through SDF or the GUI.

chapulina gravatar imagechapulina ( 2016-08-23 15:21:44 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-08-23 11:32:33 -0500

Seen: 1,225 times

Last updated: Oct 26 '16