Giter VIP home page Giter VIP logo

dynamixel2-rs's Introduction

dynamixel2 docs tests

An implementation of the Dynamixel Protocol 2.0.

This library aims to provide a easy to use but low level implementation of the Dynamixel Protocol 2.0. That means it allows you to execute arbitrary commands with arbitrary parameters.

The library does not aim to provide an easy interface to the higher level functions of a servo motor, such as moving it to a specific angle or at a specific speed. Instead, you will have to write the appropriate values to the correct registers yourself.

The main interface is the Bus struct, which represents the serial communication bus. The Bus struct exposes functions for all supported instructions such as Bus::ping, Bus::read, Bus::write and much more. Additionally, you can also transmit raw commands using Bus::write_instruction and Bus::read_status_response, or Bus::transfer_single.

The library currently implements all instructions except for the Control Table Backup, Fast Sync Read and Fast Sync Write instructions.

Optional features

You can enable the log feature to have the library use log::trace!() to log all sent instructions and received replies.

dynamixel2-rs's People

Contributors

de-vri-es avatar hgaiser avatar omelia-iliffe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dynamixel2-rs's Issues

Unneeded generic type F in sync_read functions?

Hello,

I'm new to rust and this library but giving it a go :)

I am unable to call the sync_read functions as they require a generic type F, which doesn't appear to be used in the function (only in the callback function)

pub fn sync_read<'a, F>(

If I remove it I am able to use the sync_read function without needing a generic F

Is there a reason the F is there?
I'm enjoying using your well written library and plan to extend it to include fast sync read at some point :)

Hardware Errors prevent data from being read

If a hardware error occurs it is flagged using bit 7 of the status packet error byte (https://emanual.robotis.com/docs/en/dxl/protocol2/#error)
Currently this causes the read_status_response to return a Err(MotorError) type with the raw field set to the error byte.
This behavior isn't helpful as it prevents reading data from the motor, in particular the hardware error register.

I think it should be restructured so MotorError is only return if bits 6 ~0 are set. And a new error, HardwareError type be defined, wrapping the response field.
This is non trivial as it involves wrapping the <Response<ReadBuffer, WriteBuffer> type

Keen to hear input on other implementations before I go with the first one I thought of lol

A response is not always expected when sending a packet

Sorry for another issue. Just want to say I am loving using this crate and appreciate all your work! I've learnt loads from it.

Currently, most functions (bus.write, bus.read) expect a response but a response is not always given.

bus.write bus.read
id: BROADCAST no no
status return level register = 2 yes yes
status return level register = 1 no yes
status return level register = 0 no no

I'm encountering this issue mostly when sending packets with id: packet_id::BROADCAST

My current work around is to use bus.write_instruction when I know a response won't be returned, but this is a bit low level.

A few options:

  • We add functions that don't expect responses, like write_no_response, but thats a lot more functions if we do it for every write and read fn. We could just to do it the two main ones write and read
  • We add a parameter to the functions, probably something like response: bool

What do you think?

`no_std` and use in peripherals

Hello!

I am looking at developing for a no_std environmet and I would like to use this library.
There is good flexibility with the ReadBuffer and WriteBuffer generics but its locked into using SerialPort. I know this has given greater control than just using the std::io::Read/Write traits. Would you be open to considering making the serial_port field of the bus an interface trait to allow other interface implementations?

Other barriers to no_std are the use of

  • Duration and Instant in the timeout,
  • std::io::Error,
  • Vec in various return types,
  • std::borrow::Borrow in bulk_write, can be easily switch to core::borrow::Borrow

My use case is actually developing a device/peripheral which uses the dynamixel protocol for receiving communication. As in it receives Instruction packets, parses them and responses with a StatusPacket. Similar to how the Dynamixel2Arduino Slave mode works, if you are familar with that. https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/blob/master/examples/advanced/slave/slave.ino
This could exist as a seperate crate, or if you are interested it could be added to this crate. It would add methods to received and parse Instruction Packets and methods to return a response packet. I began planning it only to realise it would reuse many of the same elements already developed for this crate (ie the instruction_id consts, the find_header method and general architecture)

Let me know what you think :) I have time to impl most of this

Async version with Tokio/smol

Hi,

First of all, thank you for this very useful crate, I was wondering if there is any plan to have asynchronous features for it.

If not do you have any suggestions on how that can be contributed?

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.