Code Monkey home page Code Monkey logo

dynamixel2arduino-rtos's Introduction

DYNAMIXEL2Arduino Build Status

Summary

This is the Dynamixel motor control code with Dynamixel2Arduino API on RTOS system.

It consist of 2 thread, serial-write & serial-read.

You can publish the command with arguments as string, and subscribe the motor states from OpenRB-150.

Environments

  • MCU : OpenRB-150

  • Arduino IDE (2.3.2)

  • Library

    Dynamixel2Arduino (0.7.0)

    FreeRTOS_SAMD21 (2.3.0)

Protocol of serial-communication

  • STX → '/'
  • CTX → ';'
  • split → ','
  • Substances
    • Read (PC to MCU) : Function name and its arguments
    • Write (MCU to PC) : motor state
      (/ID, hardware_error, Moving, PresentPosition, PresentVelocity, PresentCurrent;)

Description

  • Serial Write

    MCU(OpenRB-150) send the motor states by serial-communication

    • Normal mode - using readControlTableItem() from Dynamixel2Arduino API.
    • Sync mode - using SyncRead() from Dynamixel2Arduino API.
  • Serial Read

    MCU(OpenRB-150) receive the protocol by serial-communication

    • Normal mode & Sync mode are the same
    • You can send command one by one, or send tehm all at once(syncWrite()).

Code

Normal mode

Serial read use Dynamixel2Arduino class member function (using readControlTableItem API)

Demo

👉🏻 [code] (https://github.com/Bigyuun/Dynamixel2Arduino-RTOS/blob/master/examples/RTOS/RTOS_readControlTableItem/RTOS_readControlTableItem.ino)

configuration

  • RTOS_readControlTableItem.ino
  • definition.hpp

Dynamixel2Arduino Class https://emanual.robotis.com/docs/en/parts/controller/openrb-150/


Sync mode & Fast Sync mode

Serial read use Dynamixel2Arduino Master class member > function

Demo

configuration

  • RTOS_sync_read.ino
  • definition.hpp
  • control_table.hpp

Dynamixel2Arduino Master Class https://emanual.robotis.com/docs/en/parts/controller/openrb-150/

Usage

Serial Write (MCU to PC)

  • Form
    /motor_id, errcode, MOVING, PresentPosition(degree), PresentVelocity, PresentCurrent;

    → e.g. /1,0,0,87.912003,0.000000,0.000000;

    Arduino Serial Monitor

Serial Read (PC to MCU)

  • Form

    /Function name(Dynamixel2Arduino), arg1, arg2, ...;

  • Dynamixel2Arduino API

    • For using ‘dxl.setOperatingMode(1, OP_POSITION)’

      → /setOperatingMode,1,3;

      Arduino Serial Monitor

    • Sync Write Function

      → /syncWrite,{target_name},{target_value_of_motor_#1},{target_value_of_motor_#2}, ... ;

      e.g. /syncWrite,poisition,1000,3000;

    • Torque On & Off of all motors

      → /torqueOnAll;

      → /torqueOffAll;

  • Other custom function

    • Monitoring as protocol

      If you want to see without protocol, you can send

      → /monitorOn;

      Arduino Serial Monitor

    • Monitoring as User

      Else if you want to see the motor states with protocol, you can send

      → /monitorOff;

      Arduino Serial Monitor

    • Task information

      If you want to check the task information about each multi-thread, you can send

      → /task;

      Arduino Serial Monitor

Serial and Direction Pin definitions of ROBOTIS controllers

  • When running DYNAMIXEL without DYNAMIXEL Shields on OpenCM9.04, OpenCR or custom boards, you might need to change the Serial and DYNAMIXEL Direction Pin.

  • We provide the information below to make it easier to define Serial and Direction pins for specific hardware.

    Board Name Serial Direction Pin Note
    OpenCM9.04 Serial1 28 Uploading Arduino Sketch will erase the factory firmware. The firmware can be recovered with DYNAMIXEL Wizard 2.0
    OpenCM485EXP Serial3 22
    OpenCR Serial3 84 OpenCR has an FET switch to control power supply to DYNAMIXEL. (Reference link)
    OpenRB-150 Serial1 (-1)Automatic -

How to add new DYNAMIXEL model.

  • For the convenience of the user, Dynamixel2Arduino API hardcodes some information in the control table and stores it in flash.
  • To do this, you need to add code to some files. In this regard, please refer to PR#3 and PR#7

How to create custom PortHandler Class

  • Please refer to port_handler.h
  • Create a new class by inheriting PortHandler as public. (Like SerialPortHandler and USBSerialPortHandler)

dynamixel2arduino-rtos's People

Contributors

robotis-will avatar robotis-david avatar honghyun79 avatar robotis-ashe avatar bigyuun avatar mikkelam avatar yewon24 avatar opusk avatar hancheol-cho avatar legacymecha avatar sonelu avatar

Stargazers

 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.