I used the recognition property of the camera. The code is very simple, first it's be necessary initialize the camera: camera = robot.getDevice('camera') camera.enable(timestep) camera.recognitionEnable(timestep) Seccond, in the main loop get the number of objects and the position of ball (any): while robot.step(timestep) != -1: # Get the number of objects and properties object num_obj = camera.getRecognitionNumberOfObjects() obj = camera.getRecognitionObjects()
# If detect some object.. if num_obj > 0: # Ball following elif status_arm == 1: P = Kp * (obj[0].get_position_on_image()[0] - setPoint)
I used P to calculate the steering of the front wheels, in my case with Kp = 0.04
Hi Draker, after I try to export my parts in OBJ format from TinkerCad. I still can't find a way to import them to webot do perform my simulation. May I know where did you refer the way to do it ? I would like to refer to it to continue my own project Thank you.
Yaay! My friend is an amazing designer. Weldone!
Your work is amazing. I liked it
Thanks a lot!
amazing, can you share the code how to image processing does?
I used the recognition property of the camera. The code is very simple, first it's be necessary initialize the camera:
camera = robot.getDevice('camera')
camera.enable(timestep)
camera.recognitionEnable(timestep)
Seccond, in the main loop get the number of objects and the position of ball (any):
while robot.step(timestep) != -1:
# Get the number of objects and properties object
num_obj = camera.getRecognitionNumberOfObjects()
obj = camera.getRecognitionObjects()
# If detect some object..
if num_obj > 0:
# Ball following
elif status_arm == 1:
P = Kp * (obj[0].get_position_on_image()[0] - setPoint)
I used P to calculate the steering of the front wheels, in my case with Kp = 0.04
Hi Draker, may I know how did you import your Tinkercad design to Webots and make it as robot? Is the file in STL format? Thank you.
I did import from tinkercad in OBJ format, every mobile part
@@DrakerDG ah ic, OK I got it. Thank you so much 🙏
Hi Draker, after I try to export my parts in OBJ format from TinkerCad. I still can't find a way to import them to webot do perform my simulation. May I know where did you refer the way to do it ? I would like to refer to it to continue my own project Thank you.