Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Port Handlers and other minor suggestions #72

Open
KurtE opened this issue Jul 23, 2021 · 1 comment
Open

Custom Port Handlers and other minor suggestions #72

KurtE opened this issue Jul 23, 2021 · 1 comment

Comments

@KurtE
Copy link

KurtE commented Jul 23, 2021

I am starting to play again with Dynamixel servos, and am in the process of trying to convert using some code that uses my version of the old Bioloid library (https://github.com/kurte/bioloidserial) to a current Robotis Servo library. And I wish to have this work on both OpenCM/OpenCR as well as with some other processors, in particular with Teensy boards (PJRC) such as the T4.1.

As per previous discussions, at least at the time, non-Arduino/Robotis brand hardware changes were not supported in other libraries such as the Dynamixel SDK library so working with this library now.

Some simple suggestions for this library.

a) https://emanual.robotis.com/ - Under the Software tab should include a link to this library. The only place you find details is if you go to the https://emanual.robotis.com/docs/en/parts/interface/dynamixel_shield/ page...

b) To use with Teensy boards, In most cases I will probably need to use a Custom Port handler. So started playing with example.
Suggestion: Change private to protected... That is:

class SerialPortHandler : public DXLPortHandler
{
  public:
    SerialPortHandler(HardwareSerial& port, const int dir_pin = -1);

    virtual void begin() override;
    virtual void end() override;
    virtual int available(void) override;
    virtual int read() override;
    virtual size_t write(uint8_t) override;
    virtual size_t write(uint8_t *buf, size_t len) override;

    virtual void begin(unsigned long baud);
    virtual unsigned long getBaud() const;

  protected:
    HardwareSerial& port_;
    const int dir_pin_;
    unsigned long baud_;
};

Then your example sketch does not have to replicate both the port_ and dir_pin_ variables. That is you would not need those two variables defined in your NewSerialPortHandler, nor would your constructor have to set them.

c) still wish at times that the port handler write functions had a way to say this completes my data or not. That way you don't have to buffer up all of the data into some secondary buffer, just to do one write, to minimize how many times you set/clear the IO pin and or do flush operations.

d) Wish that there were some of the ControlTableItem data that was public and not private. That is suppose I want to setup code that uses SyncWrite to output the GOAL_POSITION for the servos. Sometimes I will be building for a Hex robot that uses AX servos (Protocol 1). Sometimes I will build for XL-430 servos (Protocol 2). Right now I have to do my own detect of servo type and have my own information for which register it is and the length of it...

Sorry I know that this is more than one thing... But thought I would mention all of this now which I was thinking about it.

Kurt

@ROBOTIS-Will
Copy link
Collaborator

Hi @KurtE

Thank you for your meaningful suggestions that can expand the use of D2A library.
Please expect some delays on reviewing and working on this as my team is preparing some other incoming updates for other project.
We should be able to start working on this from mid-September, but please feel free to create a PR, and @ROBOTIS-David will test the changes and merge for the next release.

  • Create sub items on Arduino IDE for DYNAMIXEL2Arduino (and possible DYNAMIXEL Shield?)
  • Make hardware related variables protected instead of private
  • Reporting successful TX status in the write function
  • Public Control Table item

We may need to discuss more about some of these items later for thorough understanding of use case.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants