Go Down

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

HermannSW

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.

Hermann.

HermannSW

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:
https://www.youtube.com/watch?v=PA_yZfTGfQA&feature=youtu.be

I did record a 10s 640x480@90fps video during running of blink.pwm with Raspberry camera as well:
https://www.youtube.com/watch?v=d60dTVNc870&feature=youtu.be

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.

HermannSW

Automatic camera calibration works, details in this posting:
https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=189661&p=1231151#p1231151

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

HermannSW

Lately I did make huge progress in getting (5$) Raspberry v1 camera video capturing beyond 90fps, up to 750fps
(with robot moving at 5m/s target speed 90fps would give a frame only every 5.6cm):
https://github.com/Hermann-SW/raspiraw



This is still work in progress although the many commits on github already. The latest stretched 640x480_s mode at 180fps might be interesting. Because only every other line gets captured, perhaps a derived 320x240 mode with full fov will be the better choice at 180fps (a frame every 2.8cm). Or taking only every 4th row for stretched mode 320x240_s at 360fps.


Next will be work on curve feature extraction on frames taken at high framerates
(Otsu's method does not help, kernels seem promising):
https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=189661#p1248555



The current plan is that (5$) Pi Zero will analyze the frame, determine length, slope and x-offset of first staight line segment of curve, whether starting curve will go left/right and its curvature, ... and send only this small amount of data over to the Arduino Due on the back of caterpillar robot. That will then feed this information into Arduino playground PIDLibrary for doing high speed line following motor control.


HermannSW

2.5 years have passed, I learned a lot about Raspberry cameras (I made Raspberry v1/v2 cameras do high framerate capturing with up to 750fps/1007fps), on servo and stepper PT camera systems, last year I made v1 camera do global external shutter captures and was able to capture 109m/s airgun pellet inflight multiple times in a single frame.

1.5 years ago I did buy another caterpillar robot platform, that comes with 330rpm gear motors and is even slower than the platform reported in this thread. But I replaced the two 330rpm gear motors with same form factor 1500rpm gear motors, but suffered from Chinese only assembly instructions even using Google translate. The 1500rpm gear motors will allow for >5m/s, while current thread platform motors maximally allowed for 2.4m/s.

A month ago I found a youtube T101 assembly instruction video and built my two robots. No Arduino (Due) anymore, Pi only (ZeroW for control by Wifi joystick, Pi3A+ with 4 cores for autonomous driving based on live video frame processing).

The currently maximal speed I measured inhouse for raspcatbot is 2.73m/s or 9.8km/h speed at that moment (only 80% power, motors, Pi and onboard 10W light are powered from 4S 1300mAh 95C(!) lipo). This is from a Raspberry v2 camera capturing scene from side at 100fps framerate, with 200µs shutter time, scene lighted by 5000lm led from side). Until line following algorithm will work, I made rapcatbot a "cable car", so it keeps track forcefully:

Associated youtube video:
https://www.youtube.com/watch?v=hp7pdkDZ9dg&feature=youtu.be



raspcatbot has bright light lighting the scene, so it can follow line even in dark room:



Last year I got good connection to Lee, CEO of Arducam, and he provided quite some sample cameras to me for testing (0.3/1.0/2.0MP monochrome global shutter and 13/16MP color rolling shutter cameras). I do go with the 25.99$ ov7251 monochrome global shutter camera for autonomous robot camera controlled line following. I mounted the camera tilted, so it provides forward view from 5cm ahead up to more than 1m:



I do normalize 320x240 frames at 204fps framerate, and then use threshold=80 for b&w image of course to determine the line:



Finally, this is raspcatbot backward direction drive, without onboard light at that time.
Animation plays at 20fps, 10× slower than real:



I started "raspcatbot" thread a month ago, currently contains 43 postings mostly from myself:
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=267999


P.S:
I do power the 12V 1500rpm motors with 16.8V with fully loaded 4S lipo, works fine.
Jacked up I did measure free running motor speed as >1800rpm with laser tachometer:



P.P.S:
I used Arduino IDE for (ESP32 based) "Wifi joystick" to control slow 330rpm raspcatbot:
https://esp32.com/viewtopic.php?f=19&t=14803

The ramp that current thread caterpillar robot was never able to drive uphill was no problem anymore:
https://www.youtube.com/watch?v=6zQk2KKF3mM&feature=youtu.be


Go Up