Skip to content

A Futaba RS405CB servo motor library. Only supports on UNIX.

License

Notifications You must be signed in to change notification settings

SatoshiShimada/futaba_RS405CB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

A library for Futaba RS405CB servo motor.

Only supports serial communication. No supports PWM control.

Usage

git clone https://github.com/satoshishimada/futaba_RS405CB
cd futaba_RS405CB
make
sudo chmod a+rw /dev/ttyUSB0
./serial [Servo ID]

The description of all supported method are in RS405CB.h.

Examples

Print current angle

#include <iostream>
#include "RS405CB.h"

int main(int argc, char *argv[])
{
    RS405CB servo("/dev/ttyUSB0", 115200);
    constexpr int id = 1;

    std::cout << "Angle: " << servo.getAngle(id);

    return 0;
}

Move motor

#include <iostream>
#include "RS405CB.h"

int main(int argc, char *argv[])
{
    RS405CB servo("/dev/ttyUSB0", 115200);
    constexpr int id = 1;

    servo.setTorque(id, true);
    servo.setAngle(id);

    return 0;
}

Setting ID and baudrate

#include <iostream>
#include <unistd.h> // for sleep() function
#include "RS405CB.h"

int main(int argc, char *argv[])
{
    RS405CB servo("/dev/ttyUSB0", 115200);
    constexpr int id = 1;
    constexpr int new_id = 2;

    servo.setID(id, new_id);
    servo.setBaudrate(new_id, BAURATE_9600);
    servo.storeDataToROM(new_id);
    sleep(2);

    return 0;
}

Reference

License

MIT License

About

A Futaba RS405CB servo motor library. Only supports on UNIX.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published