PRO
jp15sil24
Germany
Asked
How To Make A Camera Chases A Ball
I am using a servo and movement tracking with the Roli Rover to chase a ball. It works quite well, but if the ball moves outside the camera's view range, Roli stops. I would like the camera to move and try to locate the ball when it goes out of view. How can I achieve this?
Related Hardware (view all EZB hardware)
Roli Rover
by EZ-Robot
Roli WiFi planetary rover kit, customizable with 13 ez-bit ports for add-ons, built to traverse varied surfaces. Sold by EZ-Robot
Wi-Fi / USB
Servos
24
Camera
Audio
UART
3
I2C
ADC
8
Digital
24
Related Robot Skills (view all robot skills)
Test
by Klerg
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
Camera Click Servo
by Synthiam
Interactive camera control for ARC: click-to-center and edge hotspots to pan/tilt servos, adjustable fine-tune and multi-camera support.
Requires ARC
v12

i got the error message by running the script that the ControlCommand with parameter SetPosition 45,90 is not supported .I attach some photos, it may help for solving my problem..
@Athena @DJ_Sures . Many thanks, it is working now. I just added more positions for the variable "var". 45-90-135 was too fast. Now the scan object is smoother.
Excellent! Glad to hear DJ was helpful to get this working for you
Great to hear. I have an idea for the script addition. It current runs forever until the object is detected. Maybe it only needs to run for 5 seconds or something.
@athena can you alter the script so it runs for 5 seconds? Also add more 11 positions to the array.
Sure, DJ! Let's enhance the script to run for 5 seconds and add more positions to the array for a smoother scan. Here's the updated script:
Explanation:
duration = 5000milliseconds).$ObjectTrackingDetected == 1) and exits the function if the object is found.How to Use:
This should make the camera's search for the ball smoother and more efficient. If you encounter any issues, please let me know!
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.
@athena i removed following text otherwise we got an error with a variable not found: if (getVar("$ObjectTrackingDetected") == 1) { return; // Exit the function if the object is detected } . i will play a little bit with tilt servo just for fun .thx again
I'm glad to hear you're making progress! If you encountered an error with the variable not found, it might be because the
$ObjectTrackingDetectedvariable wasn't set up in your project. However, removing that part is fine if it works for you.If you want to add some fun with the tilt servo, you can modify the script to include both pan and tilt movements. Here's an updated version that includes tilt movements:
Explanation:
How to Use:
This should add some fun by making the camera move in both pan and tilt directions while searching for the ball. If you have any more questions or need further assistance, feel free to ask!
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.