- Raspberry Pi 5 (main computing unit)
- Teensy Microcontroller
- 7-inch Raspberry Pi Touchscreen Module
- Two Arduino Joystick Modules
- Emergency Stop Button
- Three Additional Control Buttons
[Joysticks & Buttons] -> [Teensy] --Serial--> [Raspberry Pi] --ROS2--> [Robot Systems]
A custom ROS2 touchscreen controller with dual joysticks, designed for remote operation of robotic systems, specifically developed for projects like a Dalek-inspired robot.
The concept design illustrates the physical layout of the controller, showcasing:
- 7" Raspberry Pi touchscreen
- Left and right joysticks
- Control buttons
- Emergency stop button
- Teensy microcontroller
- Raspberry Pi 5 computing unit
The block diagram details the system's data flow and component interactions:
- Input components (joysticks, buttons)
- Teensy for input processing
- Raspberry Pi running ROS2 node
- Touchscreen display
- Connect joysticks and buttons to Teensy
- Connect Teensy to Raspberry Pi via USB/Serial
- Mount in enclosed case
// teensy_input_controller.ino
void setup() {
Serial.begin(115200); // Match baudrate in ROS2 node
pinMode(JOYSTICK_X, INPUT);
pinMode(JOYSTICK_Y, INPUT);
pinMode(EMERGENCY_STOP, INPUT_PULLUP);
}
void loop() {
int leftX = analogRead(LEFT_JOYSTICK_X);
int leftY = analogRead(LEFT_JOYSTICK_Y);
bool emergencyStop = digitalRead(EMERGENCY_STOP);
// Construct serial message
String message = String(leftX) + "," +
String(leftY) + "," +
String(emergencyStop);
Serial.println(message);
delay(50); // Polling interval
}
# ros2_serial_node.py
import rclpy
import serial
class JoystickSerialNode:
def __init__(self):
self.serial_port = serial.Serial('/dev/ttyACM0', 115200)
self.pub_joystick = self.create_publisher(Joy, 'dalek_teleop')
def read_serial_data(self):
data = self.serial_port.readline().decode().strip()
x, y, emergency_stop = map(int, data.split(','))
joy_msg = Joy()
joy_msg.axes = [x/1023.0, y/1023.0] # Normalize
joy_msg.buttons = [emergency_stop]
self.pub_joystick.publish(joy_msg)
def main():
rclpy.init()
node = JoystickSerialNode()
rclpy.spin(node)
pip install pyserial
sudo apt install ros-humble-joy
- Calibrate joystick ranges in Teensy firmware
- Ensure consistent serial communication parameters
- Map input ranges to ROS Joy message standards
- Verify serial port connection
- Check Teensy firmware upload
- Validate ROS2 topic publishing