Go Down

Topic: Cheap caterpillar robot platform restrained at custom office (Read 8254 times) previous topic - next topic


Back on getting Arduecat working, after having learned a lot on taking 90fps or higher framerate videos from Raspberry camera and process with gstreamer pipeline and/or raspiraw.

I did experiment on what a good camera position would be from a forward ground range perspective. This prototype position gave 4-90cm range:

This is normal view with light:

And this is complete darkness view, lighted only by 3W infrared LED attached to Raspberry camera, no big difference:

I created a fixed mount for the camera of Lego pieces, two being screwed to robot platform with 2 screws each. This time the visible forward range was even 4-115cm:

Next step: recabling Pi Zero and Raspberry Due -- this time servo controlling camera gradient will be controlled from Raspberry Pi Zero and not Arduino Due. Quite some space left on robot after mounting Arduino Due with motor controller at back of robot platform with just two screws.



Few days ago I did start recabling, lipo, step-down converter and Pi Zero W:

While that is not needed later for autonomous robot driving, gstreamer udp pipeline allows to stream 320x240 video with 48fps wirelessly to laptop (right click the image to see the gstreamer pipeline details).

Today I refreshed my knowledge on how to control SG90 servo motor from Raspberry. The SG90 needs 5V connected to VCC, and 3.3V from GPIO18 PWM control line is enough to control. While controlling via "gpio" commands can be done as normal user, doing PWM with wiringPi library in C requires to be run via sudo (Sys mode allowing to run as "pi" user is not fast enough for PWM). This is the code I used:
Code: [Select]
pi@raspberrypi03:~ $ cat blink.pwm.c
#include <wiringPi.h>

int main (void)
  wiringPiSetupGpio();                 // with wiringPi lib with GPIO numbering
  pinMode (18, PWM_OUTPUT);            // PWM on GPIO18
  pwmSetMode(PWM_MODE_MS);             // mark space PWM mode
  pwmSetClock(192); pwmSetRange(2000); // 50Hz

  for (;;)
    pwmWrite (18,  80); delay (1000);
    pwmWrite (18, 150); delay (1000);
  return 0;
pi@raspberrypi03:~ $

First I did test that with a separate SG90, then I cabled the SG90 on the robot:

This smartphone video (with audio) shows the running blink.pwm:

I did record a 10s 640x480@90fps video during running of blink.pwm with Raspberry camera as well:

Main reason was to measure how long it takes for the servo to move between 80 and 150 position: roughly 20 frames or 0.22s.

Next step: self calibration of camera tilt using camera and servo motor.


Automatic camera calibration works, details in this posting:

After calibration ended a single b/w frame (used in calibration) gets written to SD card:

Go Up