GithubHelp home page GithubHelp logo

abhinav-prajapati / ros2_arduino_bridge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshnewans/ros_arduino_bridge

0.0 0.0 0.0 301 KB

Adapting ros_arduino_bridge for PI-Robot

C++ 72.13% C 27.87%

ros2_arduino_bridge's Introduction

Arduino Motor Controller

This code turns an Arduino into a motor controller! It provides a simple serial interface to communicate with a high-level computer (e.g. running ROS), and generates the appropriate PWM signals for a motor driver, to drive two motors.

This is a fork of the original code, with some changes, and removal of the ROS nodes (see this repo for an alternative). Check out README-orig.md for the original README.

As I only have need for a subset of the functionality, I have no idea what does and doesn't work, beyond what is detailed below. Feedback/improvements are welcome (though no promises on how quickly I'll respond). I currently only use the L298N driver, and the Arduino encoder mode.

TODO

  • Finish this README

Functionality

The main functionality provided is to receive motor speed requests over a serial connection, and provide encoder feedback. The original code has provisions for other features - e.g. read/write of digital/analog pins, servo control, but I've never used them.

The main commands to know are

  • e - Motor responds with current encoder counts for each motor
  • r - Reset encoder values
  • o <PWM1> <PWM2> - Set the raw PWM speed of each motor (-255 to 255)
  • m <Spd1> <Spd2> - Set the closed-loop speed of each motor in counts per loop (Default loop rate is 30, so (counts per sec)/30
  • p <Kp> <Kd> <Ki> <Ko> - Update the PID parameters

Gotchas

Some quick things to note

  • There is an auto timeout (default 2s) so you need to keep sending commands for it to keep moving
  • PID parameter order is PDI (?)
  • Motor speed is in counts per loop
  • Default baud rate 57600
  • Needs carriage return (CR)
  • Make sure serial is enabled (user in dialout group)
  • Check out the original readme for more

TODO (maybe)

  • Document PID tuning
  • Make the speed input counts per second
  • Add/test more driver boards
  • Add/test other functionality

ros2_arduino_bridge's People

Contributors

mikeferguson avatar joshnewans avatar waynegramlich avatar fibird avatar yellow-sky 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.