Diferencia entre revisiones de «ArduSnake: Arduino Modular Snake Robots Library»

De WikiRobotics
Saltar a: navegación, buscar
(Example 1: Hello world)
(Example 1: Hello world)
Línea 26: Línea 26:
 
** If using Arduino connect the servo to pin 8
 
** If using Arduino connect the servo to pin 8
 
** If using skymega, connect the servo number 2 (see figure 1)
 
** If using skymega, connect the servo number 2 (see figure 1)
* Upload the example to the board
+
* Upload the example to the board. The servo will oscillate, as shown in the video
  
 
{| {{Tablabonita}}
 
{| {{Tablabonita}}
Línea 32: Línea 32:
 
| [[Archivo:DSC04907.JPG|300px|]]
 
| [[Archivo:DSC04907.JPG|300px|]]
 
|}
 
|}
 +
 +
The source code of the example is:
 +
 +
<font color="#A020F0">#include &lt;Servo.h&gt;</font>
 +
<font color="#A020F0">#include &lt;Oscillator.h&gt;</font>
 +
//-- If using arduino comment it out
 +
<font color="#A020F0">#include </font><font color="#666666">"skymega.h"</font><font color="#A020F0"></font><br>
 +
//-- Declare an oscillator
 +
Oscillator osc; <br>
 +
<strong><font color="#4169E1">void setup()</font></strong>
 +
{
 +
  //-- Attach the oscillator to the servo
 +
  //-- For arduino, use the pin number instead of SERVO2 (for example 8)
 +
  osc.attach(SERVO2);
 +
} <br>
 +
<strong><font color="#4169E1">void loop()</font></strong>
 +
{
 +
  osc.refresh();
 +
}
  
 
==== Example 2: Setting the oscillator parameters ====
 
==== Example 2: Setting the oscillator parameters ====

Revisión del 04:50 13 abr 2012

Ardusnake-logo.png

Introduction

Ardusnake is an Arduino Library for generating easily the locomotion of modular snake robots. It is based on sinusoidal oscillators which drive the servos.

Architecture

ArduSnake Architecture (click para ampliar)

The ArduSnake library comprises the following layers:

  • Oscillators: This layer is in charge of oscillating the servos sinusoidally. Just with these oscillations the locomotion of worm, snakes and other modular robots can be achieved.
  • Worm: It offers an easy API for the locomotion of worm robots (locomotion in 1D) (alpha stage)
  • Snake: Locomotion of snake modular robots (in 2D) (Future work, not yet implemented)
  • User Application: The user can use the previous layers for the locomotion of the robot.

Tutorial

Figure 1: How to connect the servo to the Skymega board for running the "hello world" example

The first step is to install the ArduSnake library. Please follow these instructions .

Oscillators Layer

Example 1: Hello world

This example just makes a servo oscillate, using the default parameters

  • Open the example oscillator_test1 from File/examples/ArduSnake. The example works directly with the Skymega board. If you are using an Arduino, you have to comment and uncomment some parts of the code (see below)
  • Attach the servo
    • If using Arduino connect the servo to pin 8
    • If using skymega, connect the servo number 2 (see figure 1)
  • Upload the example to the board. The servo will oscillate, as shown in the video
300|250</youtube> DSC04907.JPG

The source code of the example is:

#include <Servo.h>
#include <Oscillator.h>
//-- If using arduino comment it out
#include "skymega.h"
//-- Declare an oscillator Oscillator osc;
void setup() { //-- Attach the oscillator to the servo //-- For arduino, use the pin number instead of SERVO2 (for example 8) osc.attach(SERVO2); }
void loop() { osc.refresh(); }

Example 2: Setting the oscillator parameters

Example 3: Oscillation of two servos

Example 4: A mini-wave

Download

ArduSnake-001.zip ArduSnake sources. Version 001

Installation

The current version is being developed under Arduino 22 IDE. It may work with newer version, but I have not tried it.

  • Download the library: ArduSnake-001.zip
  • Uncompress it in your working directory
  • Copy the folder ArduSnake under the sketchbook/libraries arduino folder (it is located in your home directory)
  • If you are using the skymega board instead of an Arduino, copy the folder skymega under /home/sketchbook/libraries
  • Launch the Arduino 22 IDE
  • The menu Ardusnake containing some example should be accesible now from the File/Examples menu

Changelog

Ardusnake 001:

  • Initial version
  • The oscillator layer is working
  • Some examples on how to use the oscillator layer written
  • The worm layer is still in alpha stage (Do not use it yet)
  • The snake layer has no been started

Authors

License

150px This library is under the GPL v3.0 license

Git repository

Publications

More information

News

  • 15/Feb/2012: This page is created