Skip to content

Robot remote control and visualization

Based on the distributed characteristics of ROS2, OriginBot can easily achieve remote control movement.

Hint

The operating environment and software and hardware configurations are as follows:

  • OriginBot Pro
  • PC:Ubuntu (≥22.04) + ROS2 (≥humble)
  • keyboard
  • Handle(optional)

Keyboard remote control

Connect to OriginBot via SSH on the PC.

image-20220822145951303

After the connection is successful, start the robot chassis driver in the first terminal:

ros2 launch originbot_bringup originbot.launch.py

image-20220915160922458

Then connect the second terminal and start the keyboard control node:

ros2 run teleop_twist_keyboard teleop_twist_keyboard

image-20220822150039457

Hint
  1. The keypad control node can also be run on a PC in the same network environment.
  2. If the robot starts the automatic parking function, the robot will automatically stop after releasing the button for 0.5 seconds, and if the automatic parking function is turned off, the robot will not automatically stop after releasing the button, and must click "K" to control the parking. The parameter configuration of the automatic parking function is located in the originbot.launch.py, see the chassis configuration parameter description for details.

In addition, OriginBot has a set of key control functions for automatic opening and automatic parking implemented in C++. The code is placed in originbot/originbot_example/originbot_teleo The launch is as follows:

ros2 run originbot_teleop originbot_teleop
teleop_autostop.jpg

Handle remote control

Handle connection

  • wired handle; Plug the USB port of the handle into the USB port of the RDK X5 on the OriginBot
  • Wireless handle; Plug the wireless receiver of the handle into the RDK X5 USB port on the OriginBot

After the connection is complete, on the OriginBot side, use the following command to confirm whether the system has successfully identified it:

ls /dev/input/

image-20220915155821318

If the "JS0" device is recognized, the handle is successfully recognized.

If you can't recognize the driver of the handle that has been installed in the official image of OriginBot, please reinstall the following feature packs and restart the attempt:​ ​

sudo apt install ros-foxy-teleop-twist-joy        # Install the drive pack for the handle
sudo apt install ros-foxy-joy-linux               # Install the drive pack for the handle
sudo modprobe -a joydev                           # Load driver
sudo apt install joystick                         # Install test tools
jstest /dev/input/js0                             # Test command

Remote Control Sports

After successfully connecting to OriginBot through SSH, start the robot chassis driver in the first terminal:

ros2 launch originbot_bringup originbot.launch.py

image-20220915160922458

Then connect the second terminal and run the handle control node:

ros2 launch originbot_bringup joy_teleop.launch.py

image-20220915160908896

After the startup is successful, you can use the joystick to control the movement of OriginBot:

  • Normal speed operation: Press and hold L1 and toggle the left joystick of the handle to control the robot movement
  • Fast Run: Press and hold R1 and toggle the left joystick of the handle to control the robot movement

image-20220915161205396

Hint

The handle control node can also run on the PC side in the same network environment, at this time, you need to connect the receiver of the handle to the PC side, and install the corresponding driver function package, the above operation of the controller in RDK X5 is also applicable to the PC side.

Robot Visualization Display

After starting OriginBot, open Rviz on the PC to view the real-time pose of the bot:

ros2 launch originbot_viz display_robot_tf.launch.py

You can see the change of the robot's position and posture in the odometer coordinate system: img

Hint

Make sure that the Ubuntu+ROS2 system has been installed on the PC, and the download and compilation of the originbot_desktop code repository have been completed. In addition, you can use "ros2 run rviz2 rviz2" to start Rivz2 separately, manually configure the Fixed Frame to select the odom(odometer coordinate system),and add the TF display through the "Add" button, you can also achieve a similar effect.

If you use a virtual machine to run the Ubuntu system on the PC, you need to set the virtual machine's network to bridge mode to ensure that the robot and the Ubuntu system are in the same LAN:

Configure the VM network

图片1