by hudac » Fri May 16, 2014 9:03 am
by hudac
Fri May 16, 2014 9:03 am
Hey.
I'm writing code to the DarwinOp. I'm trying to turn off torque of a MX28 from inside the code.
This action is possible; actioneditor's main() do the exactly same thing in their code with the function OnOffCmd():
This is their function:
void OnOffCmd(CM730 *cm730, bool on, int num_param, int *list)
{
if(num_param == 0)
{
for(int id=JointData::ID_R_SHOULDER_PITCH; id<JointData::NUMBER_OF_JOINTS; id++)
cm730->WriteByte(id, MX28::P_TORQUE_ENABLE, (int)on, 0);
}
else
{
for(int i=0; i<num_param; i++)
{
if(list[i] >= JointData::ID_R_SHOULDER_PITCH && list[i] <= JointData::ID_HEAD_TILT)
cm730->WriteByte(list[i], MX28::P_TORQUE_ENABLE, (int)on, 0);
}
}
ReadStep(cm730);
DrawStep(7);
}
I'm trying to imitate this action. I copied the exactly same code (without ReadStep() and DrawStep()). I initialized cm730 as in the actioneditor main(). I called an action with m_action->Start() so the MX28's will be with torque on
and then I tried to call to OnOffCmd() with the following parameters: OnOffCmdtest(&(cm730), false, 0, NULL);
-> It supposed to turn off all engines (like in the action editor, when you write the command: "off" but nothing happened and the MX28's was not shut down.
The strange thing is that other commands of WriteByte() do succeed. such as:
WriteByte(CM730::ID_CM, CM730::P_DXL_POWER, 0, 0)
It does turn off the cm730.
Can you help me? Do you need any further information such as my initialization code and my main() ?
Thanks!
hudac.
Hey.
I'm writing code to the DarwinOp. I'm trying to turn off torque of a MX28 from inside the code.
This action is possible; actioneditor's main() do the exactly same thing in their code with the function OnOffCmd():
This is their function:
void OnOffCmd(CM730 *cm730, bool on, int num_param, int *list)
{
if(num_param == 0)
{
for(int id=JointData::ID_R_SHOULDER_PITCH; id<JointData::NUMBER_OF_JOINTS; id++)
cm730->WriteByte(id, MX28::P_TORQUE_ENABLE, (int)on, 0);
}
else
{
for(int i=0; i<num_param; i++)
{
if(list[i] >= JointData::ID_R_SHOULDER_PITCH && list[i] <= JointData::ID_HEAD_TILT)
cm730->WriteByte(list[i], MX28::P_TORQUE_ENABLE, (int)on, 0);
}
}
ReadStep(cm730);
DrawStep(7);
}
I'm trying to imitate this action. I copied the exactly same code (without ReadStep() and DrawStep()). I initialized cm730 as in the actioneditor main(). I called an action with m_action->Start() so the MX28's will be with torque on
and then I tried to call to OnOffCmd() with the following parameters: OnOffCmdtest(&(cm730), false, 0, NULL);
-> It supposed to turn off all engines (like in the action editor, when you write the command: "off" but nothing happened and the MX28's was not shut down.
The strange thing is that other commands of WriteByte() do succeed. such as:
WriteByte(CM730::ID_CM, CM730::P_DXL_POWER, 0, 0)
It does turn off the cm730.
Can you help me? Do you need any further information such as my initialization code and my main() ?
Thanks!
hudac.