
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 Roli Rover
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 = 5000
milliseconds).$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
$ObjectTrackingDetected
variable 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.