dh4d:darwinopframework

Action disabled: source

All Seed Robotics products support the Dynamixel protocol and implement a Control Table that follows much of the organization of an MX series servo (MX series using Dynamixel Protocol V1: same memory mapping for key features such as goal position, speed, present position speed, temperature, ID , etc).
Extensions are made to the table to accommodate Seed Robotics specific features.

This means that, out of the box, it is compatible with most Dynamixel compatible frameworks, in particular those designed to work with MX or AX series servos.
For XM series servos, although these implement a different mapping of the control table it is still possible to connect and control the Seed Robotics hands on the same bus as XM servos.

In the particular case of the Darwin-OP framework, it is possible to control the hands through the framework like the servos.

Note: Depending on whether you wish to use Roboplus Motion or just use plain code to control all the IDs, the code to be added is slightly different.
We've commented the code below to explain the code to enable in each case.
For Roboplus Motion compatibility, because it can only use a maximum of 25 joints, we will only add 2 IDs(joints) for each hand to the JointData enum.
If won't be using Roboplus Motion, then you may add all joints to the JointData enum. Also note that, even if you keep some joints out of the JointData enum to have compatibility with Roboplus MOtion, you may still access these joints by hard coding their ID or keeping their IDs in a separate enum or macro.

Open the file [Darwin-OP Framework path]/Framework/include/JointData.h

Locate the JointData public Enum and add the lines identified below:

class JointData  
{
public:
	enum
	{
		ID_R_SHOULDER_PITCH     = 1,
		ID_L_SHOULDER_PITCH     = 2,
		ID_R_SHOULDER_ROLL      = 3,
		ID_L_SHOULDER_ROLL      = 4,
		ID_R_ELBOW              = 5,
		ID_L_ELBOW              = 6,
		ID_R_HIP_YAW            = 7,
		ID_L_HIP_YAW            = 8,
		ID_R_HIP_ROLL           = 9,
		ID_L_HIP_ROLL           = 10,
		ID_R_HIP_PITCH          = 11,
		ID_L_HIP_PITCH          = 12,
		ID_R_KNEE               = 13,
		ID_L_KNEE               = 14,
		ID_R_ANKLE_PITCH        = 15,
		ID_L_ANKLE_PITCH        = 16,
		ID_R_ANKLE_ROLL         = 17,
		ID_L_ANKLE_ROLL         = 18,
		ID_HEAD_PAN             = 19,
		ID_HEAD_TILT            = 20,

If you have an RH4D unit, add the lines in the box below:

/* ########### SEED ROBOTICS CODE ADDITION BEGINS ############ */
      /************* For RHD4 use the lines below */
		ID_R_HAND_VID       	=   21,
		ID_L_HAND_VID       	=   22,
		ID_R_HAND_ELBOW        	=   23,
		ID_L_HAND_ELBOW        	=   24, 
		ID_R_HAND_WRIST 	=   25,
		ID_L_HAND_WRIST 	=   26,
/* 		If you are using Roboplus Motion the lines bellow CAN'T be enabled or otherwise the framework will 
		override the values of the Virtual ID, even though Roboplus has not set anything for them.
		If you are NOT using Roboplus Motion and wish to have full control of all IDs then uncomment 
		the lines below. */
/*		ID_R_HAND_INDEX           	=   27,
		ID_L_HAND_INDEX           	=   28,
		ID_R_HAND_THUMBS          	=   29,
		ID_L_HAND_THUMBS          	=   30,         */
/* ########### SEED ROBOTICS CODE ADDITION ENDS ############ */

If you have an RH2D unit, add the lines in the box below:

/* ########### SEED ROBOTICS CODE ADDITION BEGINS ############ */
       /************* For RH2D use the lines below */
		ID_R_HAND_WRIST        	=   21,
		ID_L_HAND_WRIST        	=   22, 
		ID_R_HAND_FINGERS 	=   23,
		ID_L_HAND_FINGERS 	=   24,
/* 		If you are using Roboplus Motion the lines bellow CAN'T be enabled or otherwise the framework will 
		override the values of the Virtual ID, even though Roboplus has not set anything for them.
		If you are NOT using Roboplus Motion and wish to have full control of all IDs then uncomment 
		the lines below. */
/*	        ID_R_HAND_VID       	=   25,
		ID_L_HAND_VID       	=   26,         */
/* ########### SEED ROBOTICS CODE ADDITION ENDS ############ */

Finally, make sure to keep, the line “NUMBER_OF_JOINTS” as the last line of the enum as shown; otherwise the Framework will not work correctly.

		NUMBER_OF_JOINTS
	};

This extra delay is useful to allow time for the hands to perform all the initialization tasks before the framework starts sending commands.

In file Linux/Framework/src/CM730.cpp, locate the function CM730::DXLPowerOn() and change to:

bool CM730::DXLPowerOn()
{
	if(WriteByte(CM730::ID_CM, CM730::P_DXL_POWER, 1, 0) == CM730::SUCCESS)
	{
		if(DEBUG_PRINT == true)
			fprintf(stderr, " Succeed to change Dynamixel power!\n");
		
		WriteWord(CM730::ID_CM, CM730::P_LED_HEAD_L, MakeColor(255, 128, 0), 0);
		//m_Platform->Sleep(300); %%//%% about 300msec
		m_Platform->Sleep(3300); // SEED ROBOTICS 3300 ms – add 3 seconds to allow time to initialize the Hands
	}
}

The main change is in line m_Platform→Sleep. 3300 miliseconds includes a very large safety margin for booting the hands; if this delay is too much for you, you can bring down a little although our recommendation would be to be on the safe side and keep it at 3300.

In the file Linux/project/roboplus/main.cpp change the following lines:

Line 365: Replace: if(id >= JointData::ID_R_SHOULDER_PITCH && id ⇐ JointData::ID_HEAD_TILT)

with: if(id >= JointData::ID_R_SHOULDER_PITCH && id < JointData::NUMBER_OF_JOINTS)

VERY IMPORTANT: note that we change from ‘⇐’ to just ‘<’ because NUMBER_JOINTS will always be “LAST_ID+1”

This is a major gotcha that causes misbehavior: the way the Makefiles are designed does not track changes to .h files and as a consequence will not rebuild the files that depend on the header we just edited. Therefore we need to manually force a full recompile by following these steps:

Go to the root of your Darwin framework (typically /darwin or /robotis) and type the following:

find . -name “*.o” -type f -delete

This will delete all previously compiled “.o” files in the framework and will force their recompile when running make later on.

You must now run make for all the projects under the Darwin framework.

If you have your own code using the framework you should all delete all the “.o” files and run make to for the recompile using the our modified header file.

And you're done! The framework should now recognize and be able to communicate with the Seed Robotics hands.
If you have firmware version 11 or earlier there is a known COMM saturation issue that may cause the hand to become unresponsive. If that's case, please red on.

IMPORTANT: the explanation below does not apply to units with the latest EROS architecture.

The Darwin OP framework, when running a pre recorded motion using the Action class, operates on the bus at a very high frame rate and with very long SYNC WRITE commands. At times this can saturate the COMM port on the Seed Robotics firmware. This happens due to timing issues between the COMM and the internal timers that manage the hand.

When the COMM is saturated on the hand, the commands are received incomplete and therefore, the hand firmware can't understand them and the hand appears un responsive.

In this case, using your code, we recommend intercalating the Action class calls with manual calls to CM730→WriteWord and setting the target position manually.

Here is some example code:

// Enable torque. Use CM730 class to enabled torque, DON'T use MotionManager class because of the same issue above
CM730->WriteByte(MX28::P_TORQUE_ENABLE, JointData::ID_R_HAND_VID, 1, error)
CM730->WriteByte(MX28::P_TORQUE_ENABLE, JointData::ID_L_HAND_VID, 1, error)
// stand up; (best practice: close gripper first to protect the fingers)
CM730->WriteWord(MX28::P_GOAL_POSITION_L, JointData::ID_R_HAND_VID, 4095, error) // close R GRIP
CM730->WriteWord(MX28::P_GOAL_POSITION_L, JointData::ID_L_HAND_VID, 4095, error) // close L GRIP
Action::GetInstance()->Start([index of get up motion]);''

Update March 27th: this issue does not occur with the new EROS Architecture. Customers who may be experiencing this issue are recommended to update to the new EROS Architecture at no additional charge (only shipping costs may apply). EROS brings a large array of advantages, so if you'd like to take advantage of this offer, please get in touch with support@seedrobotics.com

Copyright © 2015-2023 Seed Robotics Ltd

  • dh4d/darwinopframework.txt
  • Last modified: 2017/08/23 16:02
  • by Pedro Ramilo