Kinect Body Control icon Kinect Body Control Control robot servos with Microsoft Xbox 360 Kinect body tracking; map joints to upper/lower body servos with smoothing and pause control. Try it →
Asked

Ultrasonic Radar Left/Right Flipped Lattepanda

Running ARC on a LattePanda (Windows 10) using the onboard Arduino Leonardo with the EZ-Genuino_Leonardo firmware (Dec 11, 2022). Connected over USB and I did check DTR Enabled in the Connection config so the serial events fire. I’ve got an HC-SR04 on Trig=D7, Echo=D8 and a micro pan servo on D5 (servo powered from a 6V BEC, grounds tied). In the Ultrasonic Radar skill I set servo Port=D5, Trigger=D7, Echo=D8, sweep 30 to 150 with step=2. The sensor works (verified distances with the basic Ping skill), but the radar display seems mirrored: an obstacle physically on the robot’s left shows on the right side of the radar, and when I enable Movement Panel integration (H-Bridge PWM Movement Panel) the robot turns into the obstacle instead of away from it.

What I tried: swapping the min/max sweep values (150 to 30), flipping the servo horn orientation so forward is at roughly 90, toggling the servo reverse option in the skill, and re-centering the bracket so 90 is straight ahead. I can make the display look correct, but then the Movement Panel avoidance still chooses the wrong side, and vice versa. I also added a small delay between steps in my project to let echoes settle, but it didn’t change the left/right logic.

What’s the correct way to calibrate the Ultrasonic Radar skill so that the on-screen left/right matches my servo orientation and the Movement Panel’s auto-avoid turns the correct direction on a LattePanda/Leonardo setup?



Related Hardware (view all EZB hardware)
Lattepanda by DF Robot
LattePanda runs Windows and Synthiam ARC, with onboard Arduino (EZB firmware) for GPIO and direct EZ‑B v4 hardwire control with low latency.
Wi-Fi / USB
Servos 12
Camera
Audio
UART 1
I2C
ADC 5
Digital 12

Related Robot Skills (view all robot skills)
Ultrasonic Radar by Synthiam
Ultrasonic on a servo sweeps 180°; radar shows distances and obstacles, integrates with movement panels for automatic avoidance, scriptable GetPing
Stops robot movement (no steering) when an EZB-connected ultrasonic sensor detects an object within a set range; integrates with scripting and paused polling.

ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

What you’re seeing is usually servo direction calibration, not a LattePanda / Leonardo bug.

In Ultrasonic Radar, the radar display and the Movement Panel avoidance logic both use the sweep direction of the servo. So if the sweep is mirrored, the avoidance decision will also be mirrored.

What to do

1) Pick one physical "truth"

Decide what servo position = 90 means physically:

  • 90 = straight ahead
  • lower values = robot’s left
  • higher values = robot’s right

That’s the key reference.

2) Set the servo so the sweep matches that reference

In the Ultrasonic Radar skill:

  • Set the servo horn/bracket so 90 is straight ahead
  • Use Min/Max to define the scan range
  • Use Invert Servo only if the servo’s numeric direction is backwards

If your scan appears correct visually when you swap min/max, that usually means the servo direction is reversed and the display is simply following that reversed scan.

Important: don’t "fix" the display one way and the avoidance another way

If the radar display is correct but avoidance turns the wrong way, it means the servo orientation is not aligned to the skill’s left/right interpretation.

The correct fix is to make the sweep direction itself correct, not just the on-screen appearance.


  1. Temporarily disable Movement Panel control
  2. Open the radar and place an obstacle on the robot’s physical left
  3. Watch where it appears on the radar
  4. Adjust only one thing at a time:
    • Invert Servo
    • or the servo horn/bracket orientation
    • or the min/max sweep range

Goal

When the obstacle is on the robot’s left, it should appear on the left side of the radar.

Once that is correct, re-enable Movement Panel integration.


Best practice for your setup

Since you’re on a LattePanda / Arduino Leonardo and the sensor itself is working with Ping, your wiring is fine. The issue is almost certainly one of these:

  • the servo is mounted opposite to the expected sweep direction
  • the servo is centered physically, but the software sweep direction is reversed
  • the Invert Servo option is not matching the actual servo mounting

Suggestion for your exact case

Try this sequence:

  • Servo centered at 90
  • Min = 30, Max = 150
  • Invert servo = OFF
  • If mirrored, turn Invert servo = ON
  • Only if that still looks wrong, physically remount the servo horn so the sweep direction matches the robot’s left/right

If you need to swap min/max to make it look right, that often means the servo direction is still logically reversed. The radar may look right, but the avoidance logic will still be wrong because the skill is now interpreting left/right opposite to your robot.


Also check this in Movement Panel integration

For avoidance, make sure:

  • the Movement Panel is on the expected board
  • the robot’s forward direction in the Movement Panel is correct
  • the obstacle threshold and turn direction settings are sensible

If the robot turns into the obstacle after a detection, that usually means the sweep-side decision is reversed relative to the robot’s movement orientation.


Helpful docs


Quick question

When you move the sweep servo manually in the skill, does increasing the servo value move the sensor toward the robot’s left or right physically?

That answer will tell us whether the fix is:

  • Invert Servo
  • horn orientation
  • or Min/Max swap.

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.