The Better Navigator icon The Better Navigator — Hector SLAM navigation with NMS pose and obstacle data for room mapping, waypoints, and autonomous obstacle-avoiding routes. Try it →
Asked
1 Participant
XV11 LIDAR on Six false hits

XV11 LIDAR On Six False Hits

Running a Six Hexapod (EZ-Robot) with an EZ-B v4 over Wi-Fi and an onboard Windows mini PC via USB to a GetSurreal XV-11 LIDAR controller. I installed the Teensy Serial Driver, selected COM7 in the XV11 LIDAR robot skill (by CochranRobotics), hit Start Lidar, and I can see the map drawing and $LIDARDistance updating in Variable Watcher. The issue is when the Six walks forward using Auto Position actions, the front legs swing into the XV-11’s view and I get sudden drops in the front sector (roughly 330-30 deg) to ~120-180 mm, which triggers my obstacle-stop logic even in an open hallway. I tried raising the LIDAR ~40 mm, narrowing the open angles in the skill to 300-60 deg, and added a simple filter to ignore distances < 50 mm, but the leg returns are still well above that and cause false stops.

Here’s the current EZ-Script I’m using to monitor the forward ARC and stop the gait:

# compute min distance in forward sector 330..359 and 0..30
$min = 9999
for ($i = 330; $i <= 359; $i++)
  if ($LIDARDistance[$i] > 50 and $LIDARDistance[$i] < $min)
    $min = $LIDARDistance[$i]
  endif
next
for ($i = 0; $i <= 30; $i++)
  if ($LIDARDistance[$i] > 50 and $LIDARDistance[$i] < $min)
    $min = $LIDARDistance[$i]
  endif
next

if ($IsSwinging = 0 and $min < 400)
  ControlCommand("Auto Position", "Stop")
endif

I toggle $IsSwinging in each Auto Position frame’s script, but timing isn’t perfect and some leg echoes still slip through. Is there a recommended way in ARC to filter or gate XV11 readings so Six ignores its own moving legs-angle masking, additional smoothing, or an integration approach-and what’s the best practice to sync sampling with Auto Position gait frames?



Related Hardware (view all EZB hardware)
Six Hexapod by EZ-Robot
Synthiam ARCx controls Six Hexapod with Auto Position gaits, joystick, voice, AI, vision tracking, and browser access.
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skills (view all robot skills)
Create servo frames and actions to animate gaits and gestures with automatic motion planning, software ramping, movement panel, import/export
XV Lidar Bridge by Retro Robot Chaos
Neato XV LIDAR integration for ARC with live radar, 8-zone obstacle detection, NMS support, calibration, and scan watchdog monitoring

ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

Yes - the better ARC approach is to gate the LIDAR during gait motion and use a small history filter, rather than trying to "trust" raw front-sector readings while the legs are inside the scan plane.

What you’re seeing is very common on hexapods: the robot’s own legs briefly appear as obstacles, especially in the forward arc. For Six, the best practice is:

1) Don’t stop on a single low reading

Use a debounce / persistence filter:

  • require the obstacle to be present for N consecutive scans
  • or require the minimum distance to stay below threshold for X ms

This prevents one bad leg echo from stopping the gait.

2) Use a gait-state gate

Instead of setting $IsSwinging inside individual frame scripts, drive the filter from the movement state:

  • when Auto Position is moving, treat forward-sector LIDAR as untrusted
  • only enforce stop logic during the stance / safe phase
  • or hold the last valid forward distance during the swing phase

If your gait is frame-based, the cleaner pattern is to set a global like:

  • $GaitActive = 1 when walking starts
  • $GaitActive = 0 when walking stops

Then let your obstacle script decide what to do based on that state.

3) Mask the robot body mechanically and in software

Mechanical masking is still useful:

  • mount the LIDAR higher
  • tilt it slightly upward if possible
  • narrow the trusted forward wedge further

But software masking is usually better than trying to tune the sensor geometry forever.

4) Sample on a timer, not inside frame scripts

The most stable integration is:

  • let Auto Position run the gait
  • run a separate timed script that samples LIDAR every 50-100 ms
  • only act on values after filtering

That keeps sensing independent from animation timing.


A proven ARC pattern

Use a scan buffer and only stop if the filtered minimum stays low for multiple samples.

Here’s a JavaScript example you can adapt in ARC:

// LIDAR obstacle filter for Six
// Requires XV11 LIDAR skill publishing $LIDARDistance or equivalent.
// Adjust array access if your skill exposes distances differently.

var thresholdMm = 400;
var consecutiveHitsNeeded = 3;
var hitCountVar = "$LidarHitCount";
var gaitVar = "$GaitActive";

// Read forward sector distances from your variables here
// Example assumes you already have an array of forward distances:
var minDist = 9999;

// Replace this with however your XV11 skill exposes readings
// Example pseudo-loop:
for (var i = 0; i < 360; i++) {
  var d = getVar("$LIDARDistance[" + i + "]", 9999);
  if (d > 50 && d < minDist) {
    minDist = d;
  }
}

var gaitActive = getVar(gaitVar, 0);

// Ignore self-echoes while gait is active if you want to be aggressive:
if (gaitActive == 1) {
  // Keep a softer threshold or require more persistence
  if (minDist < thresholdMm) {
    var hits = getVar(hitCountVar, 0);
    hits++;
    setVar(hitCountVar, hits);
    print("LIDAR hit count: " + hits + " minDist=" + minDist);
    
    if (hits >= consecutiveHitsNeeded) {
      ControlCommand("Auto Position", "AutoPositionStop");
      print("Stopped: persistent obstacle detected.");
    }
  } else {
    setVar(hitCountVar, 0);
  }
} else {
  // Normal mode: stop faster when not walking
  if (minDist < thresholdMm) {
    ControlCommand("Auto Position", "AutoPositionStop");
    print("Stopped: obstacle detected.");
  }
}

Better sync method with Auto Position

If you want tighter coordination, use action scripts only to set state flags, not to make the decision directly.

For example:

  • Start of Walk action: set $GaitActive = 1
  • Stop action: set $GaitActive = 0

Then your obstacle-check script runs independently and reads that state.

That is much more reliable than flipping $IsSwinging inside every frame, because frame scripts can be delayed, skipped, or out of phase with sensor timing.


If you want a cleaner "ARC-native" setup

The best structure is:

  1. Auto Position for the gait
  2. XV11 LIDAR for sensing
  3. Script skill on a timer for filtering
  4. Use ControlCommand("Auto Position", "AutoPositionStop") only after the filter confirms a real obstacle
  5. Optionally publish your filtered distance to a custom global variable like $FrontClearanceMm

That gives you a much more robust system than reacting directly to raw sensor data.


Important note about your current logic

Your current approach:

if ($IsSwinging = 0 and $min < 400) ...

is too fragile because:

  • it depends on perfect frame timing
  • it assumes the leg echoes always line up with swing phases
  • it reacts to a single minimum value instead of a trend

A filtered state machine is the standard solution here.


My recommendation for Six specifically

For a hexapod, I’d do this:

  • define a trusted forward zone only when the robot is in a known stance phase
  • require 3 consecutive low readings before stopping
  • ignore readings below a minimum distance threshold that are likely self-echoes unless they persist
  • run the LIDAR check from a timer script, not inside frame scripts

If you want, I can help you build a complete ARC JavaScript filter script for the XV11 skill you’re using, including the exact variable names and a timed checker that works alongside Auto Position.
What is your overall goal with Six - just safe forward walking, or do you want full autonomous obstacle avoidance and turning too?

Also, questions like this are often easiest to refine with ARC’s AI Assistant right inside the script editor: https://synthiam.com/Products/AI-Assistant

I am a customer support AI and still learning. Please verify important answers in our support documentation. For advanced AI features, use the AI Script Agent built into ARC.