Live Stream Receiver icon Live Stream Receiver Play live web video and audio streams inside ARC from Chrome/Firefox, streaming directly to ARC camera control; network configuration may be needed. Try it →
Asked

RPLIDAR Script Data Not Updating

I am using the RPLIDAR skill in ARC. The scan view is working correctly and I can see real-time obstacles in the UI.

However, I cannot access usable scan statistics from scripts:

$LidarNearestDistance always returns 0 $LidarFurthestDistance always returns 0 Only angle-based values (degrees) appear to update in script variables

My questions:

Does this skill support exporting real-time scan data (nearest distance / furthest distance or full point cloud) to script-accessible global variables? If yes, what setting or mode must be enabled to activate this? If not, what is the intended method for implementing obstacle detection in scripts using this skill?

I am building a mobile robot (wheelchair platform) and need reliable obstacle detection for navigation. The LiDAR will be mounted centrally at ~80-90 cm height.



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skills (view all robot skills)
Estimate pose odometry from movement distance for robots without encoders, calibrated by speed. Suited for DIY navigation; pose drifts with lidar.
Rplidar by Slamtec
Slamtec Lidar driver for ARC; scans 360° and publishes distance data to NMS for mapping, obstacle avoidance, and navigation.

ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

Yes - the RPLidar skill does expose scan data to ARC, but there’s an important distinction:

  • UI rendering of the scan can work even when
  • global variables for scan stats are not enabled the way you expect

What to check first

Open the RPLidar skill settings using the kebab menu (three lines in the top-right of the skill window) and look for:

  • Enable UI Scan Render - this only affects the display
  • Set variables with location data - this is the key option if you want scan points exported to variables
  • Use NMS - enable this only if another navigation skill needs the data through the Navigation Messaging System

If "Set variables with location data" is not checked, the skill may still render scans in the UI, but you won’t get the richer scan data in script-accessible globals.

About the variables you mentioned

The RPLidar skill can expose variables such as:

  • minimum distance
  • maximum distance
  • corresponding degrees
  • scan status

However, if $LidarNearestDistance and $LidarFurthestDistance are staying at 0, that usually means one of these is happening:

  1. Those are not the actual variable names used by the skill in your project
  2. The skill is not configured to publish variables
  3. You’re expecting full point-cloud access from globals, which this skill doesn’t provide directly

Intended method for obstacle detection

For obstacle detection in scripts, the usual approach is:

  • Use the RPLidar skill to detect obstacles
  • Use ControlCommand() or navigation skills to consume the scan data
  • Or use the NMS pipeline if you want autonomous navigation behavior

For a mobile robot / wheelchair platform, the recommended ARC architecture is:

  • RPLidar skill for scan acquisition
  • The Better Navigator or another NMS-compatible navigation skill for decision-making
  • Optional custom script to react to obstacle ranges or zones

If you need direct script logic

If your goal is simple obstacle detection, you usually don’t need a full point cloud in script. A better pattern is:

  • read the lidar’s published nearest obstacle values
  • define a danger threshold
  • stop or slow the robot when obstacles are too close

Example pattern:

var nearest = getVar("$LidarNearestDistance", 0);

if (nearest > 0 && nearest < 80) {
    Movement.stop();
}

If that variable never updates in your project, I’d recommend confirming the exact variable names in the RPLidar config page, since the skill may publish differently named globals depending on settings.

Important note for your build

Since this is a wheelchair platform, I’d strongly recommend not relying on a single sensor variable alone for safety-critical obstacle avoidance. Use:

  • lidar
  • physical bumpers / e-stop
  • conservative speed limits
  • a layered stop condition in ARC

Next step

Can you tell me:

  1. The exact variable names shown in the RPLidar configuration page
  2. Whether Set variables with location data is enabled
  3. Whether you are using NMS or just scripting directly

If you want, I can help you write a JavaScript obstacle-monitor script for ARC that uses the lidar data safely.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.