Nothing Special   »   [go: up one dir, main page]

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

Newer Dynamixel models not properly supported in ROS2 branches #376

Open
sven-hoek opened this issue Aug 29, 2023 · 2 comments
Open

Newer Dynamixel models not properly supported in ROS2 branches #376

sven-hoek opened this issue Aug 29, 2023 · 2 comments

Comments

@sven-hoek
Copy link

1. How to setup? (ex, U2D2, OpenCR,...)

Connected to the Dynamixels via RS485 over a USB->RS485 converter (Waveshare), then RS485 to TTL via Dynamixel Communication Bridge.

2. Which Dynamixel have you used? and how many? (Please describe below format to all connected Dynamixels)

  • XC330-288T
  • ID 10
  • 115200 baud
  • Protocol Version 2.0

3. Write down the commands you used in order

I'm using the workbench as a library, calling

m_dynamixel_workbench.setCurrentControlMode(joint.dxl_id, &log)

Where joint.dxl_id is my Dynamixel's ID, of course.

5. Please, describe detailedly what difficulty you are in

I'm on branch ros2 (using it in Humble). When I want to switch to Current Control Mode, nothing happens (no comms on the bus). Replacing the call to setCurrentControlMode() with a call to setExtendedPositionControlMode() in the same place, it successfully changes to the Extended Position Control Mode. So I went into the workbench's code and saw that the checks don't include the XC330 models and probably just need to be added as in 99f377b :

else if (index == CURRENT_CONTROL_MODE)
{
if (!strncmp(model_name, "XM", strlen("XM")) ||
!strncmp(model_name, "XH", strlen("XH")) ||
!strncmp(model_name, "MX-64-2", strlen("MX-64-2")) ||
!strncmp(model_name, "MX-106-2", strlen("MX-106-2")) ||
!strncmp(model_name, "RH", strlen("RH")))
{
result = writeRegister(id, "Operating_Mode", CURRENT_CONTROL_MODE, log);
}
}

It looks like commit c9e4c75 adds some support to the ROS2 branches but misses the above mentioned checks/

The master branch has commit 99f377b which seems to add full support for them -> can it possibly be cherry-picked onto the ROS2 branches?

The issue #278 (more than 3 years old by now) could be sort of related and would possibly be resolved when resolving this issue.

@sven-hoek
Copy link
Author

Similarly, the selection of the current conversion factor in convertCurrent2Value() and convertValue2Current() doesn't have the correct conversion factor for some models, at least not for the one mentioned above. The latter seems to be fixed on the master branch, but not on the ROS2 branch:

int16_t DynamixelWorkbench::convertCurrent2Value(uint8_t id, float current)
{
float CURRENT_UNIT = 2.69f; //Unit : mA, Ref : http://emanual.robotis.com/docs/en/dxl/x/xm430-w350/#goal-current102
model_info = getModelInfo(id);
if (model_info == NULL) return false;
if (getProtocolVersion() == 1.0f)
{
return (current / CURRENT_UNIT);
}
else if (getProtocolVersion() == 2.0f)
{
if (strncmp(getModelName(id), "PRO-L", strlen("PRO-L")) == 0 ||
strncmp(getModelName(id), "PRO-M", strlen("PRO-M")) == 0 ||
strncmp(getModelName(id), "PRO-H", strlen("PRO-H")) == 0)
{
CURRENT_UNIT = 16.11328f;
return (current / CURRENT_UNIT);
}
else if (strncmp(getModelName(id), "PRO-PLUS", strlen("PRO-PLUS")) == 0)
{
CURRENT_UNIT = 1.0f;
return (current / CURRENT_UNIT);
}
else
{
return (current / CURRENT_UNIT);
}
}
return (current / CURRENT_UNIT);
}

float DynamixelWorkbench::convertValue2Current(uint8_t id, int16_t value)
{
float current = 0;
float CURRENT_UNIT = 2.69f; //Unit : mA, Ref : http://emanual.robotis.com/docs/en/dxl/x/xm430-w350/#goal-current102
model_info = getModelInfo(id);
if (model_info == NULL) return false;
if (getProtocolVersion() == 1.0f)
{
current = (int16_t)value * CURRENT_UNIT;
return current;
}
else if (getProtocolVersion() == 2.0f)
{
if (strncmp(getModelName(id), "PRO-L", strlen("PRO-L")) == 0 ||
strncmp(getModelName(id), "PRO-M", strlen("PRO-M")) == 0 ||
strncmp(getModelName(id), "PRO-H", strlen("PRO-H")) == 0)
{
CURRENT_UNIT = 16.11328f;
current = (int16_t)value * CURRENT_UNIT;
return current;
}
else if (strncmp(getModelName(id), "PRO-PLUS", strlen("PRO-PLUS")) == 0)
{
CURRENT_UNIT = 1.0f;
current = (int16_t)value * CURRENT_UNIT;
return current;
}
else
{
current = (int16_t)value * CURRENT_UNIT;
return current;
}
}
current = (int16_t)value * CURRENT_UNIT;
return current;
}

@soham2560
Copy link

any update on this?

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