GithubHelp home page GithubHelp logo

ros_servo's Introduction

ROS_servo

2020 robot system homework 2

rosとpigpioを用いてサーボモータを動かします。


動作環境

OS : ubuntu 20.04 server

ROS : Noetic


使用したもの

Raspberry Pi4 model B 4GB × 1

Futaba S3003 (サーボモータ) × 1

*Futaba S3003のデータシート

オスメスジャンパーピン × 3


回路図

回路図

servo motor PIN 番号
赤(Vcc) : 2 (5V)
黒(GND) : 39 (GND)
白(pulse) : 7 (GPIO 4)

・Vccは5Vのピンであればどこでも問題ありません。

・GNDはGNDのピンであればどこでも問題ありません。

・GPIOに関してはこのパッケージではGPIO 4 のみ対応しております。

*GPIOを変更したい場合はscript内にあるservo_motor.py の5行目のGPIO_PINの数字を変更することでGPIOを変更することができます。


デモ動画

servo

上の画像をクリックすると動画が再生されます


インストール方法

本パッケージ

$ cd ~/catkin_ws/src
$ git clone https://github.com/Hiroki-Noguchi0001/ROS_servo.git
$ cd ~/catkin_ws
$ catkin_make
$ source ~/.bashrc

pigpio

こちらのサイトを参考しました

$ wget https://github.com/joan2937/pigpio/archive/master.zip
$ unzip master.zip
$ cd pigpio-master
$ make
$ sudo make install

unzipがインストールされていない場合は

$ sudo apt install unzip

でインストールしてください。


使用方法

上記の手順で本パッケージとpigpioをインストールした後

$ roscd servo
$ cd scripts
$ chmod +x pulse.py
$ chmod +x servo_motor.py
$ sudo pigpiod
$ roslaunch servo motor.launch

以上のコマンドを入力してください。

roslaunch servo motor.launchを実行後、サーボモータが約45°ずつ回転します。

回転角度の限界(初期位置から約180°)に到達すると初期位置に戻ります。

プログラムを終了する際は ctrl + c で終了してください。


ライセンス

pigpio : The Unlicense

ros_servo's People

Contributors

hiroki-0001 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.