• See RobotX GUI for the first version of the GUI.

picture 3

Quick Setup

picture 4

Virtual Joystick to /joy topic

  • See Joy Package

Test joystick with turtlesim

picture 0

  • remap /turtle1/cmd_vel topic
ros2 run turtlesim turtlesim_node --ros-args --remap /turtle1/cmd_vel:=/cmd_vel
  • check if remap was successful
ros2 topic info /turtle1/cmd_vel
  • publish sample message to cmd_vel
ros2 topic pub /cmd_vel geometry_msgs/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.0}}"
  • Control turtle with joystick

  • Update CMakeLists.txt

install(
  DIRECTORY config
  DESTINATION share/${PROJECT_NAME}/
)

Emergency Stop Publisher

  • Enable emergency stop via GUI
    • Pressing the β€˜Emergency Stop’ button sends a β€˜killed’ message to /control_mode topic
const eStopButton = document.getElementById('eStopButton');
 
const e_stop_publisher = new ROSLIB.Topic({
    ros: ros,
    name: "/control_mode",
    messageType: "std_msgs/String"
});
 
function sendEStop() {
    const message = new ROSLIB.Message({
        data: "killed"
    });
    e_stop_publisher.publish(message);
    console.log("Sent kill command")
}
 
eStopButton.addEventListener('click', sendEStop);

index.js

Robot Vehicle statusLabel

  • Test status indicator
 ros2 topic pub robot_state std_msgs/Int8 "{data: 3}"

Xbox Controller

picture 5

Map Layer- Buoys

  • Add gps_to_coords.py file
greenhorn_gui/
β”œβ”€β”€ CMakeLists.txt
β”œβ”€β”€ package.xml
β”œβ”€β”€ gps_to_coords.py         
β”œβ”€β”€ gui/
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ index.js
β”‚   └── style.css
β”œβ”€β”€ launch/
β”‚   β”œβ”€β”€ light_buoy_sim_launch.py
β”‚   └── websocket.launch.py
β”œβ”€β”€ light_buoy_sim/
β”‚   └── light_buoy_publisher.py
└── server/
    └── app.py
  • Make it executable
chmod +x gps_to_coords.py
  • Create gps_to_coords_launch.py file in launch folder

gps_to_coords_launch.py

import launch
from launch import LaunchDescription
from launch.actions import Node
def generate_launch_description():
    return LaunchDescription([
        Node(
            package='greenhorn_gui',
            executable='gps_to_coords.py',  # Use the Python file as executable
            name='gps_to_coords_node',
            output='screen'
        )
    ])
  • Run the launch file
ros2 launch greenhorn_gui gps_to_coords_launch.py