Note: This tutorial assumes that you have completed the previous tutorials: ROS tutorials.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

How to Use a SpaceNavigator with the spacenav_node

Description: This tutorial is an introduction to using the 3DConnexion SpaceNavigator connected to a desktop. After reading this, you should be able to bring up the spacenav_node and display the data.

Keywords: spacenavigator, 3DConnexion, joystick, driver

Tutorial Level: BEGINNER

Next Tutorial: Writing a Teleoperation Node for the SpaceNavigator

Compiling

Start by getting the dependencies and compiling the driver.

$ sudo apt install spacenavd
$ sudo apt install ros-indigo-spacenav-node

Plugged In

Make sure that your SpaceNavigator is plugged into the USB port.

Running the spacenav_node

$ roslaunch spacenav_node classic.launch

Viewing the data

The spacenav_node publishes four topics:

rostopic list

You will see something similar to:

  • /spacenav/joy
    /spacenav/offset
    /spacenav/rot_offset
    /spacenav/twist
  • /spacenav/joy - publishes the linear motion on a scale of [-1, 1]
  • /spacenav/offset - publishes the unscaled linear motion
  • /spacenav/rot_offset - publishes the unscaled rotational motion
  • /spacenav/twist - publishes a twist of unscaled linear and rotational motion

To see that everything is working and data is being published to ROS, in a new terminal:

$ rostopic echo /spacenav/joy

You will see something similar to:

  • ---
    axes: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    buttons: (0, 0)
    ---
    axes: (-0.021484375, 0.009765625, -0.009765625, 0.0, 0.0, 0.0)
    buttons: (0, 0)
    ---
    axes: (-0.005859375, 0.02734375, -0.009765625, 0.0, 0.0, 0.0)
    buttons: (0, 0)
    ---
    axes: (-0.005859375, 0.02734375, -0.009765625, -0.0234375, 0.0, 0.0)
    buttons: (0, 0)

Move the spacenavigator around to see the data change.


Wiki: spacenav_node/Tutorials/UsingTheSpacenavNode (last edited 2017-08-09 15:24:24 by AndyZe)