teleops is a Java module designed for the teleoperation of robotic arms within the ROS2 (Robot Operating System 2) environment.
teleops was originally inspired by teleop_twist_keyboard.
Tested OS: Linux, Windows.
teleops allows users to interact with robot arm in one of two ways:
In all further steps, the current latest VERSION of teleops can be found in GitHub repository
In case of Gradle/Maven/... users can add a dependency to teleops as follows:
dependencies {
implementation "io.github.pinorobotics:teleops:<VERSION>"
}
teleops, as many other Java libraries, has a dependencies. These dependencies need to be present in the classpath in order for it to work from JShell.
To build the classpath, users can use any of the Java package managers (depresolve, jbang, ...). Such package managers help to resolve all dependencies of a Java library automatically, by downloading them from Maven Central to the local Maven repository.
Run JShell with all teleops dependencies added to the classpath (using "depresolve" as a package manager):
To use teleops command it first needs to be downloaded from the release folder and extracted:
Inside you will find:
By default teleops is configured to send all commands to MoveIt2 Servo. Users can change this by specifying "twistTopic" or "jogTopic" options.
Options:
The following example demonstrates how to operate Panda arm with teleops through MoveIt2 Servo.
Open terminal and start MoveIt2 Servo, using the default launch file for the chosen ROS release (Jazzy or Humble). This should open RViz with the Panda arm displayed.
To operate Panda arm from Java, import the necessary teleops classes and create instance of TeleopsClient. Call methods like "move()" to control the robot arm:
import pinorobotics.teleops.*;
import id.jros2client.*;
var jrosClient = new JRos2ClientFactory()
.createClient();
var client = new TeleopsClientFactory()
.createClient(
jrosClient,
"panda_link0",
List.of(
"panda_joint1",
"panda_joint2",
"panda_joint4",
"panda_joint5",
"panda_joint6",
"panda_joint7",
"panda_finger_joint1",
"panda_joint3",
"panda_finger_joint2"));
// MoveIt2 Servo needs to be started first (see https://moveit.picknik.ai/humble/doc/examples/realtime_servo/realtime_servo_tutorial.html#launching-a-servo-node)
new MoveItServoClient(jrosClient).startServo();
// Cartesian move
client.move(1,0,0);
client.move(-1,0,0);
// rotate joint 1
client.move(0,10,0,0,0,0,0,0,0);
Monitor the Panda arm's movements in RViz.
To move Panda arm directly from the terminal run teleops command:
Use the provided keyboard keys to send move commands in Cartesian space and rotate joints as needed:
Keys w, s - move along x axis Keys a, d - move along y axis Keys q, e - move along z axis Press '0', '1', ... to rotate joints.
Monitor the Panda arm's movements in RViz.