Coder Social home page Coder Social logo

ros_steppermotors_topic_control's Introduction

ROS & Arduino - Control Stepper motors

Requirements

  • Arduino IDE with rosserial_arduino installed (and Teensy plugin if you use the Teensy board)
  • Arduino board (I used a Teensy 3.5)
  • 3 stepper motors (I used NEMA 17)
  • 3 motor drivers (I used A4988 but you can also use DRV8825 by making the appropriate changes in code)
  • 3 electrolytic capacitors (at least 47μF)
  • Some LED's (I used one RGB LED)
  • Power Supply (I used a 12V 8.5A)

Instructions

  1. Enter the ROS environment source /opt/ros/<distro>/setup.bash
  2. Start ROS master roscore
  3. Upload .ino file to arduino (Make sure you have installed rosserial_arduino) and run it.
  4. In a new terminal run rosrun rosserial_python serial_node.py /dev/ttyACM0 . Make sure to specify the correct port (same port you used in the Arduino IDE to upload the code)
  5. In a new terminal interact with your Arduino program through ROS topics.
    e.g. rostopic pub motor2/start std_msgs/Empty --once will execute once the following method
void startMotor2(const std_msgs::Empty& toggle_msg)

whereas rostopic pub motor1/start std_msgs/Int8 15 --once will execute once the following method

void startMotor1(const std_msgs::Int8& rpm)

by passing as an argument an rpm of 15

  1. You can see all available topics by running in a terminal rostopic list

ros_steppermotors_topic_control's People

Contributors

karadalex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ros_steppermotors_topic_control's Issues

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.