Robot Teleoperation and Visualization
Based on the distributed nature of ROS2, OriginBot is easy to remotely control movements.
Hint
The operating environment and software and hardware configurations are as follows:
- OriginBot Robot(Visual Version/Navigation Version)
- PC:Ubuntu (≥20.04) + ROS2 (≥Foxy)
- keyboard
- Handle(optional)
Keyboard remote control
Connect to OriginBot on a PC using SSH.
After the connection is successful, in the first terminal, start the robot chassis drive:
Then connect the second terminal and start the keyboard control node:
Hint
- The keypad control node can also be run on a PC in the same network environment.
- 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, on OriginBot, it has a set of key control functions implemented in C++ to automatically turn on and stop automatically, and the code is placed in originbot/originbot_example/originbot_teleop
The launch is as follows:
Handle remote control
Handle connection
- wired handle; Plug the USB port of the handle into the USB port of the RDK X3 on the OriginBot
- Wireless handle; Plug the wireless receiver of the handle into the RDK X3USB port on the OriginBot
After the connection is complete, run the following command on OriginBot to check whether the system recognizes the device:
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 movement
After SSH is connected to OriginBot, start the robot chassis drive in the first terminal:
Then connect the second terminal and run the handle control node:
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
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 X3 is also applicable to the PC side.
Robot visualization
After starting OriginBot, open Rviz on the PC to view the real-time pose of the bot:
You can see the change of the robot's position and posture in the odometer coordinate system:
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.
In this case, if the PC uses a virtual machine to run the Ubuntu system, in order to ensure that the robot and the Ubuntu system are on the same LAN, the network of the virtual machine needs to be set to bridge mode: