Drone Collision icon Drone Collision Add HC-SR04 ultrasonic sensors with an EZ-B to AR Parrot Drone v1/v2 for collision detection and avoidance Try it →
Asked

Tiny Yolo2 Not Triggering Camera Scripts

Working with a ROBOTIS Darwin Mini (OpenCM9.04) connected to ARC by USB (freshly flashed with the ARC-compatible firmware from /Hardware/17530). Servos (XL-320) move fine from Auto Position and basic scripts, so the control link looks solid. I’m trying to trigger an Auto Position action when Tiny Yolo2 sees a person through my laptop webcam. I added Camera Device and Tiny Yolo2 robot skills, started the Camera Device stream at 1280x720, and checked Active in Tiny Yolo2. The Tiny Yolo2 log shows detections like "person (0.84)" consistently, and the bounding boxes draw correctly in the Camera Device view.

Where I’m stuck: the Camera Device On Tracking Start script never fires from YOLO detections, and the $CameraObject_____ variables don’t seem to populate. My On Tracking Start script is very simple:

if ($CameraObjectName = "person")
  ControlCommand("Auto Position", "Action", "Wave")
endif

Clicking Test inside the script editor runs the Wave action, so the action/control names are right. If I switch Camera Device to Face tracking, On Tracking Start fires as expected when it sees a face. With Tiny Yolo2 active, I have Camera Device "Enable Tracking" checked. I tried Tracking Type = Object (also tried Auto), different Minimum Confidence values (0.3-0.7), and toggling multi-object, but still no script execution from YOLO. I’m connected via USB (not Bluetooth), so latency shouldn’t be the issue.

Is there a specific combination of Camera Device settings required for Tiny Yolo2 to populate the $CameraObject variables and trigger the On Tracking Start script, or am I pointing my script to the wrong event for YOLO-based object detections?



Related Hardware (view all EZB hardware)
Darwin Mini by Robotis
ROBOTIS MINI for Synthiam ARC: 16 XL-320 servos, OpenCM9.04 controller, 3D-printable frame and Bluetooth/firmware setup tips.
USB / Bluetooth
Servos 16
Camera
Audio
UART
I2C
ADC
Digital

Related Robot Skills (view all robot skills)
Camera Device by Synthiam
Use PC or robot cameras for vision tracking: color, QR, glyph, face, object, motion; record video/data, control servos and movement, run scripts
Tiny Yolo2 by Synthiam
Real-time TinyYolo object detection for ARC Camera Device: tracks 20 classes, populates camera variables, triggers tracking scripts, 30+ FPS in HD.

ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

Yes - for Tiny Yolo2, the camera detection is expected to flow through the Camera Device tracking pipeline, but there are a couple of important gotchas:

What’s likely happening

1) On Tracking Start fires only when tracking transitions from not tracking to tracking

If Tiny Yolo2 is continuously seeing person, the script may only fire once per tracking session unless the camera loses tracking and regains it.

If you want it to re-trigger, you may need to clear the last detection memory or use a different trigger strategy.

2) The $CameraObject_____ variables are set by the Camera Device tracking system

For Tiny Yolo2 to populate those variables, Camera Device must be the active camera skill receiving the detections, and the Tiny Yolo2 skill must be attached to that same Camera Device instance.

From what you described, that part sounds correct, but the most common issue is that the Camera Device tracking mode is not set to the right object-tracking mode for YOLO detections.


Things to check

In Camera Device

Open the skill’s kebab menu (three lines / menu icon) and verify:

  • Object Tracking is enabled
  • Tracking Scripts are enabled
  • The camera is actually using the same Camera Device instance that Tiny Yolo2 is attached to
  • No other tracking type is interfering

Tiny Yolo2 detections generally rely on the camera being in Object Tracking mode, not Face or Color tracking.

In Tiny Yolo2

Make sure:

  • Active is checked
  • It is attached to the correct Camera Device
  • The model is loaded successfully in the log
  • The detection confidence threshold is not too high

Your script is probably using the wrong variable check

This line:

if ($CameraObjectName = "person") ControlCommand("Auto Position", "Action", "Wave")
endif

is EZ-Script style, but with ARC scripting I’d recommend switching to JavaScript or Python.

Also, for Tiny Yolo2, the object name may be in an indexed array-style variable depending on how many detections are present. If only one object is detected, it’s often safer to inspect:

  • $CameraObjectCount
  • $CameraObjectName_1
  • $CameraObjectCenterX_1
  • $CameraObjectCenterY_1

If your setup is populating multiple detections, the variables may be appended with _1, _2, etc.


Try this JavaScript in the Camera Device tracking start script

var name = getVar("$CameraObjectName_1", "");

print("Detected: " + name);

if (name == "person") {
  ControlCommand("Auto Position", "Action", "Wave");
}

If that doesn’t print anything, try checking the count first:

var count = getVar("$CameraObjectCount", "0");
print("CameraObjectCount=" + count);

var name = getVar("$CameraObjectName_1", "");
print("CameraObjectName_1=" + name);

Important note about Tiny Yolo2 and script triggering

Sometimes Tiny Yolo2 is working correctly for detection, but the tracking event only fires when the Camera Device itself changes tracking state. In that case:

  • Tiny Yolo2 sees the person continuously
  • the object remains tracked
  • On Tracking Start does not re-fire

If you want behavior every time a person is detected, consider using:

  • a script tied directly to the Tiny Yolo2 detection event, or
  • a polling script that checks $CameraObjectCount / $CameraObjectName_1 on a timer

  1. Set Camera Device to Object Tracking
  2. Keep Tracking Scripts enabled
  3. Start Tiny Yolo2 and confirm detections
  4. Use this script to verify variables:
print("IsTracking=" + getVar("$CameraIsTracking", "0"));
print("Count=" + getVar("$CameraObjectCount", "0"));
print("Name1=" + getVar("$CameraObjectName_1", ""));
  1. If the values are blank, the issue is not the camera - it’s the object tracking handoff between Tiny Yolo2 and Camera Device.

One more thing to verify

If you’re using the Camera Device skill’s On Tracking Start script, make sure you configured it in the skill’s settings through the kebab menu and not in a separate script window. The Camera Device has its own tracking scripts section.


Best next step

Can you check these two things and let me know what you get?

  1. What do these print inside the Camera Device tracking script?

    • $CameraIsTracking
    • $CameraObjectCount
    • $CameraObjectName_1
  2. In Camera Device, is the tracking mode currently set to Object Tracking, and is Tiny Yolo2 attached to that same exact camera instance?

If you want, I can help you write a small ARC JavaScript script that triggers Wave only when the detected YOLO object is person, with a cooldown so it doesn’t spam the action.


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.