POST No. 2406807
Robotis OP2 Framework missing function for reading control table values?
2018-05-16 00:36:05 pipsqueaker


I have been attempting to write a program to read the gyroscope on our Darwin v2, however it appears that there is no function with the signature int ReadByte( int address, int *pValue, int *error ) which is what the documentation indicates I would use to read the data.

The source for CM730.h contains no declaration of a method with the above signature. However, it does include declarations for an alternative version of ReadByte, with the signature int ReadByte( int id, int address, int *pValue, int *error ).

Note: I understand that the repository I just linked is not managed by Robotis: however it reflects the code currently on my robot, and I am unable to find an official git repository for the robotis-op package (please consider creating a git repository of some sort. Sourceforge is slow and painful to use)

Unfortunately, that version would seem to be for reading data from the motors- not from the control board itself.

Oddly-enough, the control-board specific version of WriteByte and WriteWord are declared- it's just the read ones which are missing.

I feel like I must be missing something, but I have grep'd the entire repository and found nothing. I was hoping somebody could enlighten me on this.

According to my ReleaseNote.txt, the version of the code I have is 1.7.0

2018-05-16 00:36:05
2018-05-17 09:05:51 Will Son


Thank you for waiting while I'm getting response from the OP2 developer.

Below is the translated message from him.


If you are using Robotis Framework and trying to read Gyroscope, you can refer to MakeBulkReadPacket() function in Framework/src/CM730.cpp file.

The function reads 30 bytes from Address 24(P_DXL_POWER) and Gyroscope is read with BulkRead instruction.

The example of using Gyroscope value from BulkRead instruction can be found in the Process() function in Framework/src/motion/MotionManager.cpp file.

if(buf_idx < GYRO_WINDOW_SIZE)
if(m_CM730->m_BulkReadData[CM730::ID_CM].error == 0)
fb_gyro_array[buf_idx] = m_CM730->m_BulkReadData[CM730::ID_CM].ReadWord(CM730::P_GYRO_Y_L);
rl_gyro_array[buf_idx] = m_CM730->m_BulkReadData[CM730::ID_CM].ReadWord(CM730::P_GYRO_X_L);


if(m_CM730->m_BulkReadData[CM730::ID_CM].error == 0)
MotionStatus::FB_GYRO = m_CM730->m_BulkReadData[CM730::ID_CM].ReadWord(CM730::P_GYRO_Y_L) - m_FBGyroCenter;
MotionStatus::RL_GYRO = m_CM730->m_BulkReadData[CM730::ID_CM].ReadWord(CM730::P_GYRO_X_L) - m_RLGyroCenter;
MotionStatus::RL_ACCEL = m_CM730->m_BulkReadData[CM730::ID_CM].ReadWord(CM730::P_ACCEL_X_L);
MotionStatus::FB_ACCEL = m_CM730->m_BulkReadData[CM730::ID_CM].ReadWord(CM730::P_ACCEL_Y_L);
fb_array[buf_idx] = MotionStatus::FB_ACCEL;
if(++buf_idx >= ACCEL_WINDOW_SIZE) buf_idx = 0;

As CM-740 reads necessary information with BulkRead therefore ReadByte() is not used anymore.

One of the reasons is that all Read functions require to wait for the Status Packet so it is difficult to use it within 8ms cycle Process() function.

It is designed to read information using BulkRead and write functions that are not required to wait for RxPacket can be used.

Thank you.

2018-05-17 09:05:51
웹에디터 시작 웹 에디터 끝