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

Need clear information about joint states #85

Open
ekorudiawan opened this issue May 5, 2020 · 5 comments
Open

Need clear information about joint states #85

ekorudiawan opened this issue May 5, 2020 · 5 comments

Comments

@ekorudiawan
Copy link

I use Darwin OP3 robot which uses XM430-W350 Dynamixel servo. I want to read current data in Ampere using ROBOTIS-Framework.
As I know, I can subscribe present joint states in topic

/robotis/present_joint_states

This topic publishes position, velocity, and effort. Is the effort contains value of joint torque? Because the servo motor doesn't have torque sensor, or it is just approximation?

In devices folder, there is XM430-W350.device that lists all information of the motor. I found a scaling factor

torque_to_current_value_ratio = 149.795386991

Where this value comes from?
How can I convert effort value in joint states to current (in Ampere)?

@onjinwook
Copy link

Hi, I'm Jin.

if you want to read the effort, you need to do something.

  1. check this link -> OP3.robot
    : you may find and add "BULK READ ITEMS" -> prensent_current

After that you make use of "torque_to_current_value_ratio" in framework.
*ps : The" torque_to_current_value_ratio value" is an actual measurement and may not be accurate.

Regards,
Jin.

@ekorudiawan
Copy link
Author

ekorudiawan commented May 7, 2020

check this link -> OP3.robot
: you may find and add "BULK READ ITEMS" -> prensent_current

I am done with this, here an example reading

---
header: 
  seq: 880
  stamp: 
    secs: 25
    nsecs: 196000000
  frame_id: ''
name: - head_pan
- head_tilt
- l_ank_pitch
- l_ank_roll
- l_el
- l_hip_pitch
- l_hip_roll
- l_hip_yaw
- l_knee
- l_sho_pitch
- l_sho_roll
- r_ank_pitch
- r_ank_roll
- r_el
- r_hip_pitch
- r_hip_roll
- r_hip_yaw
- r_knee
- r_sho_pitch
- r_sho_roll
position: [8.420455125346393e-05, -0.0036501271747759745, -0.5074470885658897, -0.021233422276620395, -0.0005806854408909601, -0.9877315103525266, 0.02190427963862085, 0.006478857119786241, 1.2347772174846146, -0.2624526561998568, 1.3985380369619849, -0.505774797156783, 0.024472363280158227, 0.0006823349379478927, -0.9868821049928496, -0.021583271204584698, -0.007204199157222924, 1.2324199986224231, 0.2625453673115734, 1.3992656564533164]
velocity: [0.012730165317048889, 0.006602381264101093, 0.031290642219176754, -0.1671884450877372, 0.0012968547747411532, 0.012262565514619156, 0.03416588217015005, 0.0027814892795186043, 0.08419838527850326, 0.014732007522410162, -0.009373388961215968, 0.06461045145225715, 0.12410907878294766, 0.0014696812823669601, 0.028675257190019912, -0.009886637881570931, -0.00015261822575412913, 0.05049065780656754, -0.0047445688506732725, 0.010304926419331981]
effort: [-0.0003574316151899737, 0.01828303354011407, 0.27393444414847146, -0.23760928455174302, 0.005819751340796486, 0.265826754705234, 0.1535365403074973, 0.009660529969401921, -0.601800504936767, 0.007786059116590138, -0.022840644861021886, 0.19194477979218583, 0.07354303810855889, -0.00680874408325316, 0.22416885356322247, -0.16837590038334405, 0.026744237372655633, -0.4855997182856786, -0.008613453302279694, -0.02991980491987789]

My question, what is unit in effort value?
Is it an approximation of torque in Nm? Or it represents an "electric current" in Ampere?
If it is just approximation of torque value, how to scale this value to get actual "electric current"?

Actually, I want to read "electric current" data not "torque" data

@onjinwook
Copy link

onjinwook commented May 8, 2020

Hi,
Nm is right.

There are two ways to obtain it.

  1. <2.69 mA> per unit for XM430-w350 . =>
value = torque * torque_to_current_value_ratio
current = value * current_unit
  1. There is a method to obtain from the process function of motion_module inside the framework.
    you can use "motion module" (it can be read with the "bulk read" in "robotis_controller").
    check it -> THORMANG example
    but be careful. THORMANG uses different DXL( -> 1mA per unit )

Regards,
Jin.

@ekorudiawan
Copy link
Author

Are you sure about this?

1. <2.69 mA> per unit for XM430-w350 . => 2.69 * effort = current.

Check file XM430-W350.device

[type info]
torque_to_current_value_ratio   = 149.795386991

[control table]
   126 | present_current          | 2      | R      | RAM    | 0             | 1193        | N

Then check dynamixel.cpp

double Dynamixel::convertValue2Torque(int16_t value)
{
  return (double) value / torque_to_current_value_ratio_;
}

In function above you scale the "value" to "torque". "Value" in range 0-1193. So "torque" is equal to

torque = value / torque_to_current_value_ratio

From the datasheet, I got scaling unit for current = 2.69 mA

So, if I want to get "current" then I have to multiply "value" with "current_unit" right?
Then the final equation could be

value = torque * torque_to_current_value_ratio
current = value * current_unit

Is my equation above correct?

@onjinwook
Copy link

HI,

I'm sorry about it.
I got a misstake.

you right.

You find a way like below.

value = torque * torque_to_current_value_ratio
current = value * current_unit

That is great.

I'll change my comment as soon as possible.

Regards.
Jin

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