Getting Started - right after you assembled your RAPIRO

Hello everyone, I wanted to post a tutorial and or create a WIKI with what should be done one you assembled the Robot and uploaded the default file.
This is the most basic stuff i got. I myself am very new to Arduino/Raspberry when it comes to robotics and general development so any help would be greatly appreciated.
I haven't attached a Raspberry PI nor a camera yet - i have yet to adjust all the servos correctly so it's perfect.. - so i attached Rapiro to my usb port of my computer running windows 7 and I sent the command via the installed arduino IDE.
i'm sure you can mount the raspberry pi and send those commands via ssh.
for further informations, the only link i got for now was this awesome tutorial on raspberry Pi official site

Also this blog was very helpfull here is the part that i edited, but for further information, go to the side. I only aim to make a summary on the basic of the robot.

I found this japanese site, with the help of google translate, i managed to find some very useful informations.
The default sketch contain all the basics to make the robot a bare minimum of stuff.
If you know about arduino, reading the sketch should let you understand what the robot can do.
Make sure you set arduino IDE with ARDUINO UNO as Rapiro's board is compatible with that.
to access some of the basic commands, simply open the arduino IDE, open the serial monitor window and set the baud to 57600.
on the command line, enter :
#M1 - robot will move forward
#M2 - robot will move backward
#M3 - robot will turn right
#M4 - robot will turn left
#M5 - robot will raise his hand and wave the left hand. LED will become green and flashing
#M6 - robot will lower his left hand. LED will become Yellow
#M7 - robot will move both arm and contract his hands. LED will become Blue
#M8 - robot will wave goodbye with his left arm. LED will become RED.
#M9 - robot will raise its right arm and move its waist. LED will become BLUE
#M0 - robot will go to initial position
CAPS LOCK is important when you input a command via the serial monitor..
Reading through the //Rapiro.ino source code.
Each movement of the preset (# M1 ~ # M9), consists of pattern of 8 frames.
Each frame is defined values ​​uint8_t type sixteen (motion).
This can be changed modifying the number of frame per pattern.MAXFN
Lets take #M0 for example:

uint8_t motion[MAXMN][MAXFN][16]={
{ // 0 Stop
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0,255, 10},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0},
{ 90, 90, 0,130, 90,180, 50, 90, 90, 90, 90, 90, 0, 0, 0, 0}

I put numbers so you can visualy make sense of what a pattern is, and what a frame contain.
Movements consist of pattern. Pattern are made of frames. Each frame contrain the rotation angle of every servo, the values of the RGB LED and a Time to perform the action.

Head horizontal rotation angle (Head yaw) (left) 180 <---> 0 (right)
Hip horizontal rotation angle (Waist yaw) (left) 180 <---> 0 (right)
Right shoulder up and down angle (R Shoulder yaw) (bottom) 0 <---> 180 (above)
Open right shoulder angle (R Shoulder pitch) (closed) 90 <---> 180 (open)
Right hand opening and closing angle (R Hand grip) (closed) 50 <---> 110 (open)
Left shoulder up and down angle (L Shoulder yaw) (bottom) 180 <---> 0 (top)
Open left shoulder angle (L Shoulder pitch) (closed) 90 <-> 0 (open)
Left hand opening and closing angle (L Hand grip) (closed) 130 <---> 70 (open)
Right foot horizontal rotation angle (R Foot yaw) (left) 0 <---> 180 (right)
Twist angle of the right foot ankle (R Foot pitch) () 0 <---> 180 (outside)
Left foot horizontal rotation angle (L Foot yaw) (left) 0 <---> 180 (right)
Twist angle of the left foot ankle (R Foot pitch) (within) 180 <---> 0 (outside)
Red component of the eye (R) 0 <---> 255
Green component of the eye (G) 0 <---> 255
Blue component of the eye (B) 0 <---> 255

Serial Input command accepted the following commands,
"# M" other than, also accepts "# P", "# Q", "# C".

You can see them in the void loop

void loop() {
switch( {
case 'M'
case 'P'
case 'Q'

Here are some other helpful commands that can be used to control the LED and each servos individually.

//LED CODE sample

#PR000G255B000T010 //MAX GREEN COLOR
R,G,B values between 0 and 255
T is the time component to get to desired color

Sxx refers to one of the 12 motors (from S00 to S11),
A000 up to A180 is the angle where to servo incline,
Txxx is the time to perform the movement.
you can combine two commands, i tried more but it didn’t work..

#PS00A000T010#PS00A180T010 - full head movement from side to side
#PS01A000T010#PS01A180T010 - Waist
#PS02A000T010#PS01A180T010 - r Shoulder
#PS03A000T010#PS03A180T010 - r Arm
#PS04A000T010#PS04A180T010 - r HAND
#PS05A000T010#PS05A180T010 - l Shoulder
#PS06A000T010#PS06A180T010 – l Arm
#PS07A000T010#PS07A180T010 – l hand
#PS08A000T010#PS08A180T010 - r Foot yaw
#PS09A000T010#PS09A180T010 - r Foot pitch
#PS10A000T010#PS10A180T010 - l Foot yaw
#PS11A000T010#PS11A180T010 - l Foot pitch

Edit : i added the google doc link so you can add comments and i will update the file and post wich as much information that we gather. so please any constuctive comments are welcome!

Edit 2: Added a screen shot of the limbs to servo table

posted by djakku on 2014-02-22 11:29

Thank you very much!

posted by shota.ishiwatari on 2014-02-22 21:54

Thank you for your effort to summarize this. I have modified the original sample Arduino sketch so that it is possible to add more movements (#M10, #M11 and so on). Additionally there is now a "HALT" command [#H, digitalWrite(POWER, LOW);] to switch off the servos, in case you only want to play with the Raspberry Pi board. I'm still looking for a way to share the code. Maybe we will have an official wiki page in the future to gather all information and sample code.

posted by stefba_b on 2014-03-04 17:02

can you post the code here embed it in < code > tags < /code >


Thank you both for the information very useful to us still getting a grasp on the Arduino side of this.

posted by on 2014-03-04 17:33

The owner of make-muda blog is making tremendous progress and great work. Although its in Japanese, Google translate make a pretty good job for grasping his ideas.
He recently made a ODT sheet to generate new poses.
Now he only replace the existing one but maybe with you sketch, more can be done.

I also agree that we definitely need a wiki for rapiro.
I hope Shota will hear out request.. Otherwise we might need to maintain one outselve..but that would divide the community

posted by djakku on 2014-03-04 23:03

My attempt to adopt the code for more than 10 motions can be found at (MS Onedrive). Send #M00, #M01, ..., #M10 and so on over the serial connection to choose your motion. MAXMN has to be adopted to the actual number of movements in your sketch. At the moment I have only added one additional motion. So MAXMN = 11. But it should be easy to add own motions to the sketch just by copy&paste the matrices which define the motions and change the values.
Entering #H will stop all servos.
The code might still have bugs. Take it as example for own programming experiments.
Kind regards!

posted by stefba_b on 2014-03-05 04:39

I entered #H to stop the servos, but how can you start them again?
after #H, #M... doesn't work..

Sorry, after reading your comment, i realise that now the commands should be #M00, #M01, and so on..
also there seem to be a bug in the original sketch pointed out by this thread :

I don't know how bad it the bug, but the sooner we fix it, the better..

posted by djakku on 2014-03-06 00:08

I've corrected the mentioned bug in my code now. Above link is still valid.
The bug might lead to an unpredictable behaviour of Rapiro if you enter a value for #PSxx larger than MAXSN.

posted by stefba_b on 2014-03-06 04:49

Great job! now i can use the robot without have to hear to sound of the servos all the time!

posted by djakku on 2014-03-06 22:25

djakku that is fantastic thank you.

posted by on 2014-03-06 23:35

Hi everyone,
After posts from djakku on 2014-02-22 11:29 then stefba_b on 2014-03-04 17:02 and djakku on 2014-03-04 23:03 we look forward to share contents on a wiki But which one ? we are proposing mediawiki (like wikipedia) if everybody agree to talk english on it ;
P.S. we are a not for profit org (NFP) focusing to use Rapiro on Raspberry and Arduino as platforms for good training at school or university... or in house (if it don't disturb the animal ;-)

posted by 4Cercles on 2014-03-08 07:37

Mediawiki sounds good. I think that we have first to clear if Shota Ishiwatari is planning to set up an official Wiki page or something like that.

posted by stefba_b on 2014-03-08 17:23

I thinks it's ok to start one and if shota decide to host one, we could always merge everything then redirect the site to the "official" one.. :)

posted by djakku on 2014-03-10 11:22

i threw this and the original up on github so its easier to wget and move to your pi:

posted by evilbluechicken on 2014-03-15 14:12

I update the google drive doc with this table, i found it very userful to testing and adjusting my servos

posted by djakku on 2014-03-16 04:40

( Allowed tags: <b> <s> <code> <blockquote> <img> . Automatic URL link.)

Uploaded image is placed to the bottom of the post. To add multiple images, make post once then edit the post.

Read Terms of Service upon submitting. 投稿する前に利用規約をお読みください。