jrl-umi3218 / mc_openrtm

Interface between OpenRTM and mc_rtc
BSD 2-Clause "Simplified" License
3 stars 10 forks source link

Create InPort for reading motor temperature #17

Closed rohanpsingh closed 2 years ago

rohanpsingh commented 2 years ago

Currently, I do nothing with the received data (waiting for reply on https://github.com/isri-aist/hrg-soft-environment/issues/20#issuecomment-1154731581).

gergondet commented 2 years ago

Hi @rohanpsingh

Would you still consider this a draft?

rohanpsingh commented 2 years ago

Hi @gergondet This is an important functionality that we need and definitely must be merged. However, there is a problem in the current implementation that I must fix. (specifically, this is apparently not the correct way to map from bodystat to mc-rtc)

I plan to work on this over the next few days~!

gergondet commented 2 years ago

specifically, this is apparently not the correct way to map from bodystat to mc-rtc

Assuming m_motorTempNames and m_motorTempIn have the same lengths that should work?

gergondet commented 2 years ago

Assuming m_motorTempNames and m_motorTempIn have the same lengths that should work?

From the issue in HRP4CR private repo I see what you mean now: you could have less joint sensors than readings because some joints are filtered by the module.

In that case what you should do is create a mapping (but really it's an std::vector<size_t>) from the sensors' name index to the reference joint order index then use that when you fetch the temperature in the OpenRTM data vector so:

motorTempIn[m_motorTempNames[i]] = m_motorTempIn.data[i];

becomes:

motorTempIn[m_motorTempNames[i]] = m_motorTempIn.data[m_motorTempToRJOIndex[i]];
rohanpsingh commented 2 years ago

Thanks, I tested this on the robot, and it worked fine. I think we can merge this PR now.