Skip to main content

Robotics Programming with TensorFleet

Welcome to the TensorFleet robotics documentation! This section covers ground robot control, sensor integration, and autonomous behaviors using both JavaScript and Python.

What You'll Learn

  • Robot Movement: Control ground robots via velocity commands
  • Obstacle Avoidance: Use LiDAR for autonomous navigation
  • Computer Vision: Object detection with YOLO

Language Support

All robotics examples are available in both JavaScript and Python:

LanguageRuntimeROS LibraryBest For
JavaScriptBun / Node.jsroslibWeb integration, rapid prototyping
PythonPython 3.8+roslibpyData science, ML integration

Both languages connect to your robot via rosbridge WebSocket - no local ROS installation required.

Quick Start

Prerequisites

  • TensorFleet VS Code Extension installed
  • Active TensorFleet VM with a robot simulation
  • Simulation View open in the sidebar

JavaScript Setup

# Install Bun (recommended)
curl -fsSL https://bun.sh/install | bash

# Install dependencies
bun install

Python Setup

# Install uv (recommended) or use pip
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create virtual environment and install dependencies
uv venv
uv pip install -r requirements.txt

Tutorials

TutorialDescriptionLanguages
Robot MoverBasic velocity control and movement sequencesJS + Python
Obstacle AvoiderLiDAR-based autonomous obstacle avoidanceJS + Python
Vision YOLOObject detection with YOLO on camera feedJS + Python

Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│ Your Local Machine │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────────────────────┐ │
│ │ JavaScript │ │ Python │ │
│ │ (Bun) │ │ (uv/pip) │ │
│ │ │ │ │ │
│ │ roslib.js │ │ roslibpy │ │
│ └──────┬──────┘ └──────────────┬──────────────┘ │
│ │ │ │
│ └───────────┬───────────────────┘ │
│ │ │
│ WebSocket Connection │
│ │ │
└──────────────────────┼───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ TensorFleet VM │
├──────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ rosbridge │◄──▶│ ROS 2 │◄──▶│ Gazebo │ │
│ │ (port 9091) │ │ │ │ Simulation │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└──────────────────────────────────────────────────────────────┘

Key ROS Topics

TopicTypeDescription
/cmd_vel_rawgeometry_msgs/TwistVelocity commands
/scansensor_msgs/LaserScanLiDAR scan data
/camera/image_rawsensor_msgs/ImageCamera feed
/camera/image_annotatedsensor_msgs/ImageAnnotated output

Configuration

Both JavaScript and Python templates support environment variable configuration:

VariableDefaultDescription
CMD_VEL_TOPIC/cmd_vel_rawVelocity command topic
SCAN_TOPIC/scanLiDAR scan topic
IMAGE_TOPIC/camera/image_rawCamera input topic
LINEAR_SPEED0.2Forward speed (m/s)
ANGULAR_SPEED0.5Turning speed (rad/s)

VS Code Panels

Use these TensorFleet panels while developing:

  • Simulation View: See your robot in Gazebo
  • Image Panel: View camera feed and detections
  • Teleops Panel: Manual robot control
  • Raw Messages: Debug ROS topic data

Next Steps

Start with the Robot Mover tutorial to learn basic movement control, then progress through obstacle avoidance and vision.


The robotics templates demonstrate the same concepts in both JavaScript and Python, letting you choose the language that best fits your project.