ラベル ロボットプラットフォーム の投稿を表示しています。 すべての投稿を表示
ラベル ロボットプラットフォーム の投稿を表示しています。 すべての投稿を表示

2012年11月15日木曜日

Moving Control Flowchart and Moving Mode of 4 legged robot

The below figure is a flowchart of moving control.
Moving control is able to call as a 'Moving Control Service'.
This flowchart is a part of RDCS.




My 4 legged robot has 5 moving modes.

(1) On board mode
    This mode is to move mounting a harvesting machine and other working machines.
    An importance function of this mode is to move with keeping machines in a horizontal position.
(2) Walking mode
    This mode is to walk  with  loading a  package(20Kg).
(3) Traction mode
    This mode is to tractor other robot and carts.
        sample --> http://robot009.blogspot.jp/2012/10/prototype-robot-movie.html
(4) Climb and down stairs mode
    This mode is to climb up stairs and to down stairs with a light load package
(5) ike-ike mode
    This mode is to accomplish on the irregular ground.

My 4 legged robot automatically adjust its moving  mode to the situation.

I have built up a prototype robot to validate the above functions.
At the result, I've found many issues, improvements and bugs, so I'm improving away off.
On the other hand, I feel increasingly confident that RDCS is  beneficial.
(RDCS is a robot development platform.)


"Requester"  is " upper level programs or services of RDCS.
"RDCS Servicer"  is common functions of RDCS such as "4D Space Database",  Space recognition", "Obstruction Detection" and other functions.

RDCS: Robot Distributed Cooperative System
             --> http://robot009.blogspot.jp/2012/09/update-rdcs.html

私が開発している4脚 歩行 ロボットは5つの移動モードを持っています。
農作業の様々場面で、活動する為にはこれらの複数のモードが必要です。
私のロボットは、分散コンピューティングの考え方を基本にしています。
つまり、計算リソースは、必要に応じて組合わせる事ができます。
下の図は、RDSCのMoving Controlのフローです。
詳しい説明はしませんが、こんな感じです。
開発しながら、Documentを、残さないと大変なことになるので、、、
学者風に説明すれば、かなりの量の論文が書けます。
特に、自己再帰的に、4脚を制御して、路面に合わせて最適な接地位置を選択する
機能なんか、とっても面白い、論文になります。
4脚ロボットは、かなり面白いです。また、応用の範囲が大変広いです。

そのひとつが、Actuatorです。逆に開発しなくてよかったなぁと思います。
しかし、最近は、昼間は本職(農業)で、夕方からロボット開発で、毎晩遅くまでやっています。
でも、すげー楽しいです。
特に、4脚歩行のmotion データの自動作成プログラムや、空間認識プログラムは、錆付いた脳みその、お掃除に最適です。

英語の内容と違った内容になってしまった。まぁ、いいかぁ





By the way, I am a farmer. (*^^)v
This morning, I sprinkled the lactobacillus on the ground of my farm.
I use the lactobacillus to improve the microbial environment of the soil in my farm.
This picture is the shot of  pouring the home fermentation lactobacillus out of the bottle to the water pot. To sprinkle the lactobacillus on the farm, I usually dilute by 1%.



この写真は、自家製の乳酸菌を作物や土に散布する為に、じょうろに移している場面です。
今朝の乳酸菌を、畑に撒く準備をしている時に、写しました。
乳酸菌を定期的に土に散布すると、土壌中の微生物環境を良い状態に保てます。
農業を始めてから乳酸菌を使い、いろいろ効能を検証してきましたが、3年間の経験から言うと、


・乳酸菌を薄めるときには、直接水道水を使わない。
 塩素が、影響して菌が死にます。
 私は、ビタミンCを使って還元した水道水を使います。


・土中の環境改善に効果がある。
  土中の環境改善により、病原菌が減り、かつ虫も減ります。
  また、土中の菌が増えるので、根の周りの環境がよくなり、
  結果的には、美味しい野菜になります。
  特に、タマネギには効果絶大です。

・防虫/殺虫効果は、単体利用では期待しないほうが良い。
 確かに、乳酸菌は酸なので、PH4程度に薄めた液は、強酸ですから
 アブラムシなどに若干の効果がありました。しかし、同時に葉面の菌を殺すことにもなります。
 私が、効果のあると認識しているのは、弱酸性にして、アルカリ性のものと、
 交互に散布する方法です。水ナスなどでは、虫がつかなくなります。
 2年続けて、露地栽培で、化学農薬を使わない水ナスを作ることができました。

 最近は、水ナスにつく虫や病原菌に化学農薬が効かないという話を聞きます。農薬で洗い流すように、農薬を丁寧に散布しているそうです。であれば、農薬の本来の意味がありません。
 数十年以上化学農薬を使い続けているので、基本的に農薬を使った営農方法に、害虫のライフ
 サイクルが、お温暖化の環境と相まって、適応しているのかもしれません。
 私も、乳酸菌を薄めた液で、ナスについたアブラムシを洗い流す時もありますが、翌日は、
 ほのかにヨーグルトのにおいがします。(営農1年目です。今は、アブラムシがつかないので
 そのような使い方はしません)

以下は、私の主観的な考えですが、、、、、
 私の方法は、葉面菌と共存できる状態で弱アルカリ性と弱酸性の両方の環境を、
 交互に人工的に発生させて
 「ここはなんか、おかしい卵をうみたくない」と”遺伝子の深いところにある部分に、生理的に感じさせている”のかもしれません。 基本的に、病原菌や虫は、中性の状態を好みます。
化学農薬に対する記憶は、遺伝子の中にはないですから虫は避けないのではないでしょうか?避けなければ、生き残った虫は、耐性を持ってしまうのは、考えられることです。
また、化学農薬の多くは、中性ではないでしょうか?

農薬で洗い流すような撒布方法をするのであれば、ロボットでは無理だと思います。この方法は、葉を一枚一枚洗う為に、高圧で散布する農薬を被ることになります。
しかし、葉面に霧状の散布をするのであれば、ロボット的な作業工程を組み立てることができます。

アブラ虫を寄り付かせない為には、防虫テープが、大変効果を発揮します。
確か、農業試験場の実験報告もあります。
私は、ナスやトマトハウスの周りにも、張っています。
テープで囲まれた内側に虫を捕捉するテープを張り、1週間程度様子を見ると、
テープで囲んだ箇所と、囲んでないところでは、見た目で効果が比較できます。
地上から0.5m、1m、1.5mの間隔で張れば十分です。
風に吹かれて、ユラユラすると、光が乱反射されて、虫が方向感覚を失うそうです。

化学農薬利用のドグマにはまり込んでいる、農業現場です。
ここには、TPPは関係ありません。

ロボットの話から、、、脱線しました。

Peace!

2012年10月30日火曜日

Design a motion of 4 legged robot


I have designed a motion of 4 legged robot using following document.
This document describes a motion pattern and how to move each legs, heels and body.
I have been testing effective walking of 4 legged robot for a half month.
I have gathered data and wrote the document. And I have  coded the walking program of 4 legged robot.



Peace!

2012年10月8日月曜日

A new robot on 4 legs. (prototype)

Now, I'm developing a 4 legs robot. The pictures are a prototype 4 legs robot.
The prototype robot is half size model.
4本脚ロボットを開発しています。写真は、そのプロトタイプです。

30cm ruler in lower side

I grow organic tomatoes in the greenhouse.  And in the greenhouse, an aisle is narrow (40cm) and uneven ground.

 There are several robot moving methods  that are wheels, caterpillar, 4 legs and others. I have considered  which is the best moving method in the 'farm' and 'greenhouse'.
I decided to develop a 4 legs robot, first of all.

私は、化学農薬などを使わないオーガニック トマトを農業ハウスで栽培しています。
ハウス内は、通路も狭く、また平ではありません。

ロボットの移動方法には、車輪、キャタピラー、4本脚、それ以外の方法もあります。
最初に、4本脚のロボットを作る事に決めました。


The selection points are below:
(1) A function of holding on the level ( a height level requirement )
My forming robot have to move on the application which are an actuator, pruner machine,,,
Therefore a robot need to hold these applications on the level in order to exercise their capacities.
A wheel and caterpillar machin are difficult to hold on the level.
But 4 legs moving system is easy to realize  my height level requirement, nothing any other parts.
I'm going to research and to develop for putting into practical use.


peace!

2012年10月3日水曜日

Performance testing Xtion on Raspberry Pi
Using a capturing server

Raspberry Pi is a good machine. But it don't have a capacity for 3D processing.  For this test, I use a Raspberry Pi as a capturing service (server).  And MacMini is 3D Processing service and viewing.
My test environment diagram is below.

Raspberry Piは、3D処理をするには性能がたりません。従って、Xtionを使ったcaputuring setverとして使い、空間認識などの処理をMacminiで処理します。そのテストをしました。
テストは、RDCS環境を使いまいた。RDCSは、分散コンピューティングをベースにしたロボットプラットフォームです。その機能を使ってテストをしました。
Micminiでpoint cloud処理をしています。さすがに瞬間的な処理です。


 Capturing Service        3D recognizing service
   Xtion
    Raspberry Pi                Mac MIni
----------------------------------------------------  Coordinator Layer
---------------------------------------------------- (Service Control)
             |                                |
----------------------------------------------------      Cooperative Layer
---------------------------------------------------- (Communication Control)

A performance testing was executed on RDCS.

RDCS is a robot platform based on a distributed computing model.
A lots of robot function (hardware, software) is connected by  "Cooperative Control" and "Coordinator".
"Cooperative Control" is a network communication control.  The control  connects computer , actuator, sensor and other robot device.
"Coordinator" offers robot required software. "Coordinator" integrates a lot robot software on RDCS.

This test flow is :

(1) 3D recognized service requests a data set ( image and depth ) to Capturing service.
(2) Capturing service on Raspberry Pi execute to capture image and depth.
(3) 3D recognized service receive a couple of capturing data.
(4) 3D processing and viewing

RESULT (sec)
(1)      0-1
(2)     8-10 (include the time which is Xtion initialize and terminate)
                   A Capture time is 1-2 sec.
(3)      0-1
(4)      0-1


This result means that a single robot don't have all function in it.
Therefore, it's able to develop a lightweight and low cost robot.
There are a lot of kinds wrok in farm. And my farm is large. Thus I need  a lot of robot. To do that,  I have to develop a low cost and multi-function robot.
My robots are structured by base robot and add-in function in order to realize a multi-function of robot.
And these robots have to been set up by commercialized product and builded  by component-based.

Now I'm developing a core component of robot  using 2 or 3 Raspberry Pi.
A core component of robot is structured by  6 components which are robot platform(RDCS), space recognition, obstacle detection, moving, fail-safe and recovery.
An effectivity of RDCS which I have developed was  confirmed by this testing.


この結果は、1台のロボットに全ての機能を集約しなくても良い事を示しています。
従って、軽量なかつ低価格のロボットを作る事ができます。
ロボットプラットフォーム、障害物検知、通信、移動、フェイルセーフと回復機能を持ったシンプルなロボットを、Raspberry Piを2、3個使って作れば良いと思います。その上に、アクチュエータなどのロボットのパーツを載せればよのではないでしょうか?
私の開発している、RDCSのアーキテクチャーの有効性を確認できました。




                                                     3D point cloud

Peace!

2012年9月28日金曜日

Performance testing Xtion on Raspberry Pi
Capturing RGB

Yesterday, I had done a performance testing.
A test program attached this post.
It's a processing time  from capturing  a  RBG data via OpenNI -Xtion  to writing a formated data.

A test path is below.
Xtion -> OpenNI (RGB, Depth) -> OpenCV (conversion format, writing) -> SD-card

(1)Capturer : 640x480, RGB24
(2)Pieces of writing format type are bmp, dib, jpd, jp2, png, pbm, pgm, ppm, ras, and tiff.

RESULT
(1) It's take 15-20 sec from capturing to writing SD-card.
        processing             time (sec)
     Initialize OpenNI            : 4 - 5
     Capture depth & RBG  : 0 - 1
     Merge                           : 3 - 4
     Convert & save            : 4 - 5
     Terminate                     : 4 - 5
     ( Processing time on MacMini (i5 2.5GHz 8G) is 2sec. )
   
(2) Processing time depends data format a little.
     Jpeg format is faster than png, 2-3 seconds.
(3) There aren't a difference  of processing time between clock speed 700MHz and 800MHz.

Next performance testing is a following process.
Capture (Raspberry Pi) ---  depth & RGB  (UDP) --> Receive (other machine).
This test use a function of Cooperative control of RDCS.

Peace!

/*****************************************************************************************
        Sample snapshot & save  program   (No Warranty)
******************************************************************************************/
OpenNI  1.5.4
Sensor  5.1.2.1
OpenCV 2.4
Xtion Pro Live

(1) Raspberry Pi  800MHz and 700MHz
Arch Linux arm 3.2.27-8-ARCH+
gcc (GCC) 4.7.1 20120721
It need a compiler option "-mcpu=arm1176jzf-s".

(2) Macmini
Darwin Kernel Version 12.2.0
llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658)

(3) Windows
No test.

//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include <XnOS.h>
#include <opencv2/opencv.hpp>
#include <XnCppWrapper.h>
#include <fstream>
#include <iostream>
#include <string>
#include <cstring>

#include <stdio.h>
//#include <stdlib.h>
#include <time.h>
#include <math.h>

using namespace std;
using namespace xn;
using namespace cv;
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define SAMPLE_XML_PATH "../../Config/SamplesConfig.xml"

//#define PR1(A)
//#define PR2(A, B)
#define PR1(A) std::cout << A << endl;
#define PR2(A, B) std::cout << A << ":" << B << endl;
#define ER1(A) std::cout << A << endl;
#define ER2(A, B) std::cout << A << ":" << B << endl;

//---------------------------------------------------------------------------
// Globals
//---------------------------------------------------------------------------
XnStatus nRetVal = XN_STATUS_OK;

float* g_pDepthHist;
XnRGB24Pixel* g_pTexMap = NULL;
unsigned int g_nTexMapX = 0;
unsigned int g_nTexMapY = 0;
XnDepthPixel g_nZRes;

Context g_context;
xn::ScriptNode g_scriptNode;
xn::DepthGenerator g_depth;
xn::ImageGenerator g_image;
xn::DepthMetaData g_depthMD;
xn::ImageMetaData g_imageMD;


cv::Mat colorArr[3];
cv::Mat colorImage;

const XnRGB24Pixel* pImageRow;
const XnRGB24Pixel* pPixel;

void printTime(const char *msg) ;

//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------

/************************************************************************
*** Callback glutIdle
*************************************************************************/
void printTime(const char *msg) {
time_t timer;
struct tm *date;
char str[256];

timer = time(NULL);
date = localtime(&timer);
PR2(msg, asctime(date));
}
/************************************************************************
*** main
*************************************************************************/

int main(int argc, char* argv[])
{
XnStatus rc;
EnumerationErrors errors;
IplImage bgrIpl;
cv::Mat bgrImage;
int i, iFrame, iClean;
int iCnt = 0;

char framenumber[10];
std::stringstream ss;
std::string str_frame_number;



// -------------------------------------------------------------------------
// check argument.
// -------------------------------------------------------------------------
if (argc != 4) {
PR1("argument error. output file, format (jpg, png), count.");
return 1;
}
iFrame = atoi(argv[3]);
if (iFrame < 1 || iFrame > 100) {
ER1("frame 1-100.");
return 1;
}
if (!(strcmp(argv[2], "bmp") == 0 ||
strcmp(argv[2], "dib") == 0 ||
strcmp(argv[2], "jpg") == 0 ||
strcmp(argv[2], "jp2") == 0 ||
strcmp(argv[2], "png") == 0 ||
strcmp(argv[2], "pbm") == 0 ||
strcmp(argv[2], "pgm") == 0 ||
strcmp(argv[2], "ppm") == 0 ||
strcmp(argv[2], "ras") == 0 ||
strcmp(argv[2], "tiff") == 0
)) {
ER1("format error.");
return 1;
}

// -------------------------------------------------------------------------
// set up OpenNI camera.
// -------------------------------------------------------------------------
// read a device configuration file and initialyze
rc = g_context.InitFromXmlFile(SAMPLE_XML_PATH, g_scriptNode, &errors);
if (rc == XN_STATUS_NO_NODE_PRESENT){
XnChar strError[1024];
errors.ToString(strError, 1024);
ER1(strError);
return (rc);
}else if (rc != XN_STATUS_OK){
ER2("Open failed ", xnGetStatusString(rc));
return (rc);
}

// Searches for an existing created node of a specified type and returns a reference to it.
rc = g_context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_depth);
if (rc != XN_STATUS_OK){
ER1("No depth node exists! Check your XML.");
return 1;
}

// Searches for an existing created node of a specified type and returns a reference to it.
rc = g_context.FindExistingNode(XN_NODE_TYPE_IMAGE, g_image);
if (rc != XN_STATUS_OK){
ER1("No image node exists! Check your XML.");
return 1;
}

PR1("first genelation*******************");
g_depth.GetMetaData(g_depthMD);
g_image.GetMetaData(g_imageMD);
PR1("***********************************");

// Hybrid mode isn't supported in this sample
if (g_imageMD.FullXRes() != g_depthMD.FullXRes() || g_imageMD.FullYRes() != g_depthMD.FullYRes()){
ER1 ("The device depth and image resolution must be equal!");
return 1;
}

// RGB is the only image format supported.
if (g_imageMD.PixelFormat() != XN_PIXEL_FORMAT_RGB24){
ER1("The device image format must be RGB24");
return 1;
}

// Texture map init
g_nTexMapX = (((unsigned short)(g_depthMD.FullXRes()-1) / 512) + 1) * 512;
g_nTexMapY = (((unsigned short)(g_depthMD.FullYRes()-1) / 512) + 1) * 512;
g_pTexMap = (XnRGB24Pixel*)malloc(g_nTexMapX * g_nTexMapY * sizeof(XnRGB24Pixel));

g_nZRes = g_depthMD.ZRes();
g_pDepthHist = (float*)malloc(g_nZRes * sizeof(float));

rc = g_context.WaitAnyUpdateAll();
if (rc != XN_STATUS_OK){
ER2("Read failed ", xnGetStatusString(rc));
return 1;
}
// -------------------------------------------------------------------------
// main routine.
// -------------------------------------------------------------------------

for (i = 0; i < iFrame; i++) {
printTime("start generation");
g_depth.GetMetaData(g_depthMD);
g_image.GetMetaData(g_imageMD);
printTime("end generation");
}

printTime("start output");
g_depth.GetAlternativeViewPointCap().SetViewPoint(g_image);
pImageRow = g_imageMD.RGB24Data();

colorArr[0] = cv::Mat(g_imageMD.YRes(), g_imageMD.XRes(),CV_8U);
colorArr[1] = cv::Mat(g_imageMD.YRes(), g_imageMD.XRes(),CV_8U);
colorArr[2] = cv::Mat(g_imageMD.YRes(), g_imageMD.XRes(),CV_8U);

printTime("create new matrix");
PR2("g_imageMD.YRes", g_imageMD.YRes());
for (int y = 0; y < g_imageMD.YRes(); y++){
pPixel = pImageRow;
uchar* Bptr = colorArr[0].ptr<uchar>(y);
uchar* Gptr = colorArr[1].ptr<uchar>(y);
uchar* Rptr = colorArr[2].ptr<uchar>(y);
for(int x=0; x < g_imageMD.XRes() ;++x , ++pPixel){
Bptr[x] = pPixel->nBlue;
Gptr[x] = pPixel->nGreen;
Rptr[x] = pPixel->nRed;
}
pImageRow += g_imageMD.XRes();
}
printTime("start merge");
cv::merge(colorArr, 3, colorImage);

printTime("start save");
sprintf(framenumber,"%s.%s",argv[1], argv[2]);
ss << framenumber;
ss >> str_frame_number;
std::string str_aux = str_frame_number;
bgrIpl = colorImage;
cvSaveImage(str_aux.c_str(), &bgrIpl);
printTime("end output");
//g_context.Shutdown();

return 0;
}

2012年9月21日金曜日

Developing Robots on Raspberry Pi
 Raspberry Piを使ったロボット開発の考え方


I use Raspberry Pi as robot controllers based on Robot Distributed Computing System  (RDCS). RDCS is an architecture to develop a robot system efficiently and simply.
An agricultural work is a combination of variety of tasks. In large farms, only one robot cannot execute many agricultural tasks. Therefore, we have to control many robots and sensors. For this purpose, we designed  RDCS that is a new robot system architecture. RDCS offer one cohesive integrated control for robots, sensors and variety  of agriculture informations.
RDCS have a databese called 4DS.  4DS is a 4 Dimension database. 4 Dimension data is a very important data for agriculture. 4DS  manage   variety information to require for agricutural production . For example,  geospatial data, growing data, cost data, other many data.
Robots use 4DS information as self-control data, and store a variety of data that is scanned  by robots in work.


Raspberry Pi は、いろいろな所で取り上げられているので、ここでは私のrobot開発における利用方法の概要を記述します。

私のロボットは、「分散コンピューティング上にハードウェアを置く」と、いう考え方で作っています。
これは、これまでのハード中心のロボット作りとは、考え方がまったくことなります。しかし、実際の農場での運用を考えると、そのような考え方に立脚しないと展開できないと考えています。robotが、単機能として物を運ぶ、果実を収穫すると言うのは、大事な機能です。しかし、農場では様々な仕事があり、かつそれぞれの仕事が連動しています。そのような状況のなかで、複数のロボットやセンサーなどを使う為には、全体を統合的に制御できるarchitectureが必要になります。

その分散コンピューティングのノードコンピュータとして、Raspberry Piを位置づけています。これまでは、H8などのマイコンボードをLegacy PCで制御するような構造になっていたと思います。マイコン+Legacy PCをRaspberry Piで置き換える考え方です。それにより、ロボット開発には多くのメリットがあります。軽量化、原価低減、電源の最小化などなど多くの効果が期待できます。これまでも、ARMベースの低価格コンピュータが販売されていましたが、一気に1/3の価格になってしまいまいた。また、GPIOがあるのでデバイスに直接につなげます。
ロボット開発において、軽量化は大変重要です。私は、これまで、Dell mini9を使っていましたが、それにしても2Kg程度あります。それがバッテリー込みで、500g位になります。収穫用のactuatorは、ロボットシステム全体からみると、ひとつのApplicationとして独立していますが、Actuator専用にRaspberry Piを割当てる事も容易にできます。

システム構造です。まだ、案レベルで、実装しながら変更します。
上の図は、私のRobot Distributed Computing Model (RDCM)の構造図です。
この構造モデルに従って、全ての機能が実装されます。この図では、ControllerにARMのCPUを使うこと以外は、デバイスの規定はありません。従って、柔軟に組合わせることができます。
また、このArchitectureでは、他のコンピュータシステムと連携させることができます。例えば、農業生産管理システムとの連携も、簡単にできます。distributed computingモデルを基本にしているという事は、そのような意味です。
これまでの、ロボットは、ロボット中心の考え方をしていますが、私のロボットは、業務で人間と同等の役割を担う事を前提にしています。従って、role-definitionがあります。それらを延長した形で、私のロボットはWork Control Definition(WCD)に基づいて動きます。

温度センサーにしても、「温度を計測する」roleに基づいて役割を実行して、全体業務に貢献します。これは、別な意味で重要で、定義された役割を実行するので、それは、同一の経営体のなかであれば、どこでもいいわけです。もちろん、そのための作り方はあるわけですが、STMの評価ボード、XBee、温度センサーと単三電池を組みわせれば良いだけです。市販のおんどxxなどに比べれば、格安にかつ自由度の高い構成がとれます。

Raspberry Piは、そのような中で、Nodo Computerとして重要な役割を担っています。しかし、Raspberry Piがないと動かないわけでありません。

私のように、640KBの世界で3D-CADプログラムを開発していた人間から見れば、256MBのメモリーの世界は、はかりしれない可能性を持ちます。

人は、欲張りになりすぎました。これはコンピュータの世界だけでなく、全てす。
もっと、Simplifyに、構造化して認識することが大切です。

Simplify、いい言葉です。
ところで、Raspberry PiのOSは、Arch Linuxです。SimplifyなOSです。私は、Raspberry PiでGUIは使いません。Raspberry Piにはその必要性がありません。画像を見たければ、distributed computing上のAndroidで見れば十分です。
Simplifyです。