Asked

Sharp IR Collision Detection Configuration Issue

I have a question about the Sharp IR Collision Robot Skill.

I'm conducting a small test on my robot using the Sharp 5V Analog GP2Y0A02YK0F IR sensor. I've configured the Sharp IR Collision Skill with the following settings:

  • Analog Port: ADC7
  • Interval: 1000ms
  • Collision Detected Condition: "Greater than" 28

Could someone explain why the collision detection for this sensor is set to trigger on values "Greater than" 28 as opposed to "Less than," which is commonly used with ultrasonic sensors? I haven't noticed any updates to this skill that would clarify this.

Additionally, I'm using the "Sharp IR Radar" Skill with these configured settings:

  • Port: ADC7
  • Interval: 500ms
  • Servo Port: 0.20
  • Minimum Position: 15
  • Maximum Position: 260
  • Increment Speed: 10
  • Only Scan When Moving Forward: Checked
  • Control Movement Panel: Checked (I'm using the servo Movement Panel for my drive wheels)
  • Reverse Before Turn: Checked
  • Minimum Distance Before Turn: 31
  • Turn Delay: 10ms
  • Reverse Delay: 20ms

With these settings, my question is: Why does the robot stop when it detects an object at a far distance rather than waiting until it is closer, like near a wall? Additionally, when the robot does stop, it neither reverses nor turns. What might I be missing in my configuration that could solve this issue?


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

Author Avatar
PRO
Canada
#1  

Short answer - it’s not a bug: Sharp IR sensors report a voltage that increases as an object gets closer, so the Collision and Radar skills trigger on a larger ADC value (Greater than) when something is near. Ultrasonic distance sensors return a distance value where smaller numbers mean closer, so those use Less than.

Below I explain why you’re seeing the robot stop "far away," why it may not be reversing/turning, and give stepbystep troubleshooting + recommended settings and a quick ADC test script so you can calibrate the thresholds for your GP2Y0A02YK0F.

Why "Greater than" (not "Less than")

  • The Sharp GP2Y0A02YK0F outputs an analog voltage that increases as an object gets closer (higher voltage -> higher ADC reading).
  • ARC’s ADC readings for the ADC.get()/skill use are 0-255. For Sharp IR, a closer object = larger ADC value, therefore collision detection should be set to "Greater than X."
  • Ultrasonic sensors typically produce a numeric distance in cm (larger number = farther), so those use "Less than X" to detect close objects. Different sensor types, different comparison.

Why your robot stops at a far distance

  • Your Collision skill trigger is set to Greater than 28. That means as soon as ADC7 > 28 the skill considers a collision - that may correspond to a far distance for your sensor.
  • The Sharp IR Radar "Minimum Distance Before Turn" is 31 - close to 28. If your ADC values for objects at far distances are already >28, the Collision/Radar will stop/trigger early. You need to calibrate the ADC thresholds to values that correspond to the physical distance you want.

Why it doesn’t reverse or turn Possible causes:

  1. Movement Panel capability mismatch - the Radar/Collision "Control Movement Panel" actions only work if the Movement Panel skill you added supports the commands the Radar skill calls (reverse, turn). Verify the Movement Panel skill you added exposes reverse/turn functions for ARC to call.
  2. Timing values too small - your Turn Delay 10ms and Reverse Delay 20ms are extremely short. The movement commands may be issued but the time is too short for the robot to actually move. Use values in the hundreds of milliseconds (e.g., 300-800ms) for testing.
  3. Threshold mismatch/order - collision may stop the Movement Panel but the Radar’s reverse/turn logic has its own thresholds (Minimum Distance Before Turn = 31). If collision triggers at >28 but Radar requires >31 to perform turn/reverse logic, you’ll get a stop without a follow-up reverse/turn.
  4. "Only Scan When Moving Forward" - if the robot is not recognized as "moving forward" by the Movement Panel, Radar may not run the scan/avoid routine. Verify the robot is actually sending movement state.

Stepbystep troubleshooting & recommended changes

  1. Calibrate raw ADC values:
    • Run a small ADC monitor script (place it in a JavaScript script control). This will show what ADC7 reports at various distances so you know proper thresholds.
// ADC monitor for ADC7. Press STOP to end the script.
while (true) {
  var v = ADC.get(ADC7);        // returns 0 - 255
  print("ADC7 = " + v);
  sleep(200);                   // update every 200 ms
}
  • Hold a target at known distances (e.g. 10 cm, 30 cm, 60 cm, 150 cm) and note ADC readings. Use those numbers to set your Collision and Radar thresholds.
  1. Set collision/radar thresholds from measurements:

    • In Sharp IR Collision: set Collision Detected Condition to Greater than the ADC value measured at the distance you want the robot to consider a "collision." If you want the robot to stop at 30 cm, use the ADC value you measured at 30 cm (maybe +/ a couple counts for tolerance).
    • In Sharp IR Radar: set Minimum Distance Before Turn to the ADC value measured where you want to start backing up/turning (likely larger than the Collision stop threshold if you want a backup/turn sequence).
  2. Increase delays so you can see motion:

    • Change Turn Delay and Reverse Delay from 10/20 ms to something like 300-800 ms while testing. That gives motors time to physically turn/reverse.
  3. Verify Movement Panel compatibility:

    • Open the Movement Panel skill you added (Project -> Add Skill -> Movement Panels if not present) and confirm which commands it supports (forward, reverse, left, right, stop).
    • The Radar/Collision "Control Movement Panel" requires a Movement Panel skill that accepts reverse/turn commands. If you used a custom servo Movement Panel that only supports forward/stop, Radar cannot make it reverse/turn. Try the Differential/Servo Movement Panel that supports these actions or configure your Movement Panel to support reverse and turn.
  4. Ensure names match and Control Movement Panel is enabled:

    • Open the Sharp IR Radar settings (click the three lines/hamburger on the skill window -> Configure).
    • Make sure "Control Movement Panel" is checked and the Movement Panel name selected is the same as the Movement Panel instance in your project. The skill must be able to find and call the Movement Panel by name.
  5. Test manual movement commands

  6. Re-test with adjusted thresholds and delays:

    • After calibration and increasing delays, run the robot and watch ADC printout to confirm when the thresholds are hit and the expected Reverse/Turn actions occur.

How to configure skills (kebab/hamburger)

  • Open the robot skill window (Sharp IR Collision or Radar).
  • Click the threelines/hamburger icon at the top-right to open Configure or Help.
  • In Configure you’ll set Board Index, Port (ADC7), Condition, Interval, and movement options. Use the Help (?) to open that skill’s manual for exact behavior and ControlCommand names.

Helpful links

Quick recommended starting settings (after you calibrate ADC):

  • Sharp IR Collision: Condition = Greater than [ADC value measured at desired stop distance]
  • Sharp IR Radar: Minimum Distance Before Turn = [ADC value slightly higher than stop, if you want backup+turn sequence]
  • Turn Delay = 300 ms, Reverse Delay = 400 ms (adjust for your robot)
  • Interval = 200-500 ms for responsive behavior (lower interval = more frequent readings)

Next steps I can help with

  • If you run the ADC monitor script above and paste the raw ADC values you saw at e.g. 10 cm, 30 cm, 60 cm and 150 cm, I’ll tell you specific threshold numbers to use for Collision and Radar.
  • If reverse/turn still don’t run after adjusting delays and thresholds, tell me which Movement Panel skill you’re using and its configured ports - I’ll check compatibility and the correct ControlCommand names you may need.

Would you like me to walk through running the ADC calibration and then set the exact thresholds to use?


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.