
2021-07-08 12:36:16 dchang16
Hello, I am trying to control a multi-axis motors using OpenCR and MX-106 using ROS and arduino IDE, but I would like to get some help since I have some problems.
[ In the Korean version of my account (robotis.com/service), I had some issue in my membership registration, so I inevitably post on the English version of the site. Therefore, even if you reply in Korean, I can reply. ]
Briefly about the current system I am working on, the OpenCR arduino version of DynamixelSDK c++ code and ROS Serial has been used.
And, the status of MX-106 is read (using GroupBulkRead) and the motor set-values are updated every 4ms from the python code outside the arduino via ROS topic or service node.
In the arduino code, those values are subscribed and sync-written to the motors (using GroupSyncWrite).
For ROS setup, WSL1 allows to connect to the arduino serial node and the each command of motor set-values is updated every 4ms through topic or service node in a different python program.
Regarding this system, I have two different questions.
1)
For some reason, the arduino DynamixelSDK c++ codes (protocol version 2) didn't work for the most part (at least, all the code I tested).
I wonder if there is another compatibility part with the MX motor that I am not aware of.
Even, in the case of protocol version 1.0, the example code seems to work only when the baudrate is set to 1000000.
2) I would like to use GroupBulkRead and GroupSyncWrite as class member object.
In all arduino examples, GroupBulkRead and GroupSyncWrite instances seems works globally as follows:
dynamixel::GroupBulkRead _groupBulkRead(portHandler, packetHandler);
For example,
Since I use the arduino c++ class, the class header file is as follows:
dynamixel::PortHandler* portHandler;
dynamixel::PacketHandler* packetHandler;
dynamixel::GroupBulkRead* groupBulkRead;
dynamixel::GroupSyncWrite* groupSyncWrite;
In the cpp file, in Init() in my class, I would like to use as follows (new or malloc()):
portHandler = dynamixel::PortHandler::getPortHandler(DEVICE_NAME);
groupBulkRead = new dynamixel::GroupBulkRead(portHandler, packetHandler);
groupSyncWrite = new dynamixel::GroupSyncWrite(portHandler, packetHandler, ADDR_MX_GOAL_POSITION, LEN_MX_GOAL_POSITION);
I was wondering if there could be any special problems when used them like this in terms of interal memory inside Dynamixel SDK.
_______________________________________________________________________________________________________________________
안녕하세요, 저는 OpenCR 보드와 MX-106 모터들을 ROS와 arduino IDE를 사용하여 제어하려고 합니다. 몇 가지 문제점이 있어 도움을 받고자 글을 남깁니다.
(아 사실, 한국말 버전 사이트에서 회원 가입이 잘 안 되어서, 부득이하게 영어 버전 사이트에 글을 올리는데 사실 한글로 답을 주셔도 제가 확인할 수 있습니다.)
제가 구성하고 있는 시스템에 대해 간단히 설명을 드리면, 현재 DynamixelSDK c++ code example의 일부들을 사용하여 custom class로 만들어서 ROS node와 연결하고 arduino IDE를 통해 코드가 compile됩니다.
arduino 코드에서는, MX-106 모터들의 상태를 읽고 (이 때, GroupBulkRead 사용), 원하는 모터값들은 ROS message로 구독되고 모터에 전달됩니다 (이 때, GroupSyncWrite 사용).
WSL1를 사용해서 arduino serial node를 open했고, 모터 설정 값들의 각 명령은 다른 파이썬 프로그램의 주제 또는 서비스 노드를 통해 4ms마다 업데이트됩니다.
이 시스템과 관련하여 두 가지 다른 질문이 있습니다.
1)
어떤 이유로 arduino DynamixelSDK c++ 코드(프로토콜 버전 2)는 대부분(적어도 내가 테스트한 모든 코드)에서 작동하지 않았습니다.
혹시 제가 모르는 MX 모터와 호환되는 부분이 또 있는지 궁금합니다.
프로토콜 버전 1.0의 경우에도 baudrate가 1000000으로 설정된 경우에만 예제 코드가 작동하는 것 같습니다.
2) 저는 GroupBulkRead 및 GroupSyncWrite를 클래스 멤버 개체로 사용하고 싶습니다.
모든 arduino 예제에서 GroupBulkRead 및 GroupSyncWrite 인스턴스는 다음과 같이 전역적으로 사용되는 것 같습니다.
dynamixel::GroupBulkRead _groupBulkRead(portHandler, packetHandler);
예를 들면, 저는 arduino C++ 클래스 헤더에서는 아래와 같이,
dynamixel::PortHandler* portHandler;
dynamixel::PacketHandler* packetHandler;
dynamixel::GroupBulkRead* groupBulkRead;
dynamixel::GroupSyncWrite* groupSyncWrite;
cpp 파일에서 제 클래스의 Init()에서 다음과 같이 사용하고 싶습니다 (new or malloc()).
portHandler = dynamixel::PortHandler::getPortHandler(DEVICE_NAME);
groupBulkRead = new dynamixel::GroupBulkRead(portHandler, packetHandler);
groupSyncWrite = new dynamixel::GroupSyncWrite(portHandler, packetHandler, ADDR_MX_GOAL_POSITION, LEN_MX_GOAL_POSITION);
이렇게 사용하면 SDK 내부의 메모리 관련하여 특별한 이슈가 없는지 궁금합니다.