Acquire images after robot has rotated - need help

asked 2020-09-16 09:26:43 -0600

jimc91 gravatar image

updated 2020-09-16 09:29:00 -0600

Hi All,

I am looking for a bit of advice on some work I want to complete.

I am using ROS Kinetic, Ubuntu 16.04LTS and the Turtlebot3 waffle-pi with a raspberry pi3 camera.

I have written a python script to acquire images every 8 seconds. Once the image is acquired and saved, I am rotating the robot 5 degrees clockwise, but I am doing this manually (using teleop keys) and I would like this to be all done through code.

Here is my current python code to acquire images:

from time import sleep
from picamera import PiCamera

camera = PiCamera()

camera.start_preview()

camera.resolution = (2592, 1944)
camera.framerate = 15

sleep(2)

for filename in camera.capture_continuous('img{counter:03d}.jpg'):
    print('Captured %s' % filename)
    sleep(8) # wait 8 secs per image

What I would like to do is;

  • run this script once (not every 8 seconds)
  • once the image is acquired, a message/command is sent to the Remote PC to run the code to rotate the robot 5 degrees clockwise
  • Once the rotation is complete, send a message/command to the robot to acquire another image (or to run the python script)
  • And repeat for 360 degrees

So I assume that my next step is to create the code/package to rotate the robot 5 degrees? But I am unsure how to send messages to the robot or remote PC when each script is complete.

Any advice/guidance is very much appreciated.

edit retag flag offensive close merge delete