19 ALModule(broker, name),
20 access_sensor_values (ALPtr<ALMemoryFastAccess>(new ALMemoryFastAccess())),
23 setModuleDescription(
"Orebro University: NAO walking module");
27 functionName(
"setStiffness" , getName(),
"change stiffness of all joint");
28 addParam(
"value",
"new stiffness value from 0.0 to 1.0");
31 functionName(
"initPosition", getName() ,
"initialize robot position");
34 functionName(
"walk", getName() ,
"walk");
37 functionName(
"stopWalking", getName() ,
"stopWalking");
74 isDCMRunning = getParentBroker()->getProxy(
"ALLauncher")->call<
bool>(
"isModulePresent", std::string(
"DCM"));
89 dcm_proxy = getParentBroker()->getDcmProxy();
111 vector <string> joint_names(JOINTS_NUM,
"Device/SubDeviceList/");
112 joint_names[HEAD_PITCH] +=
"HeadPitch";
113 joint_names[HEAD_YAW] +=
"HeadYaw";
115 joint_names[L_ANKLE_PITCH] +=
"LAnklePitch";
116 joint_names[L_ANKLE_ROLL] +=
"LAnkleRoll";
117 joint_names[L_ELBOW_ROLL] +=
"LElbowRoll";
118 joint_names[L_ELBOW_YAW] +=
"LElbowYaw";
119 joint_names[L_HIP_PITCH] +=
"LHipPitch";
120 joint_names[L_HIP_ROLL] +=
"LHipRoll";
121 joint_names[L_HIP_YAW_PITCH] +=
"LHipYawPitch";
122 joint_names[L_KNEE_PITCH] +=
"LKneePitch";
123 joint_names[L_SHOULDER_PITCH] +=
"LShoulderPitch";
124 joint_names[L_SHOULDER_ROLL] +=
"LShoulderRoll";
125 joint_names[L_WRIST_YAW] +=
"LWristYaw";
127 joint_names[R_ANKLE_PITCH] +=
"RAnklePitch";
128 joint_names[R_ANKLE_ROLL] +=
"RAnkleRoll";
129 joint_names[R_ELBOW_ROLL] +=
"RElbowRoll";
130 joint_names[R_ELBOW_YAW] +=
"RElbowYaw";
131 joint_names[R_HIP_PITCH] +=
"RHipPitch";
132 joint_names[R_HIP_ROLL] +=
"RHipRoll";
133 joint_names[R_HIP_YAW_PITCH] +=
"RHipYawPitch";
134 joint_names[R_KNEE_PITCH] +=
"RKneePitch";
135 joint_names[R_SHOULDER_PITCH] +=
"RShoulderPitch";
136 joint_names[R_SHOULDER_ROLL] +=
"RShoulderRoll";
137 joint_names[R_WRIST_YAW] +=
"RWristYaw";
153 ALValue stiffnessCommands;
156 if ((stiffnessValue < 0) || (stiffnessValue > 1))
165 stiffnessCommands.arraySetSize(3);
166 stiffnessCommands[0] = std::string(
"jointStiffness");
167 stiffnessCommands[1] = std::string(
"Merge");
168 stiffnessCommands[2].arraySetSize(1);
169 stiffnessCommands[2][0].arraySetSize(2);
170 stiffnessCommands[2][0][0] = stiffnessValue;
174 unsigned int stiffness_change_time = 1000;
177 stiffnessCommands[2][0][1] =
dcm_proxy->getTime(stiffness_change_time);
179 catch (
const ALError &e)
189 catch (
const ALError &e)
194 qi::os::msleep(stiffness_change_time);
195 qiLogInfo (
"module.oru_walk",
"Execution of setStiffness() is finished.");
206 unsigned int init_time = 1200;
209 ALValue initPositionCommands;
211 initPositionCommands.arraySetSize(6);
212 initPositionCommands[0] = string(
"jointActuator");
213 initPositionCommands[1] = string(
"ClearAll");
214 initPositionCommands[2] = string(
"time-separate");
215 initPositionCommands[3] = 0;
216 initPositionCommands[4].arraySetSize(1);
217 initPositionCommands[5].arraySetSize(JOINTS_NUM);
218 for (
int i = 0; i < JOINTS_NUM; i++)
220 initPositionCommands[5][i].arraySetSize(1);
223 for (
int i = 0; i < LOWER_JOINTS_NUM; i++)
233 initPositionCommands[4][0] =
dcm_proxy->getTime(init_time);
235 catch (
const ALError &e)
244 dcm_proxy->setAlias(initPositionCommands);
246 catch (
const AL::ALError &e)
251 qi::os::msleep(init_time);
252 qiLogInfo (
"module.oru_walk",
"Execution of initPosition() is finished.");
void setStiffness(const float &)
Set stiffness of joints.
void initJointAngles(ALValue &)
#define ORUW_THROW(message)
void walk()
Construct and initialize all necessary classes and register callback function.
void initFastWrite(const vector< string > &)
Initializes variables, that are necessary for fast sending of parameters to DCM.
#define ORUW_THROW_ERROR(message, error)
ALPtr< DCMProxy > dcm_proxy
double ref_joint_angles[LOWER_JOINTS_NUM]
void stopWalkingRemote()
An interface function that is called remotely to stop the execution.
void initWalkCommands()
Initialize commands, that will be sent to DCM.
ALPtr< ALMemoryProxy > memory_proxy
void stopWalking(const char *)
Unregister callback and log a message.
void initFastRead(const vector< string > &)
Initializes variables, that are necessary for fast reading of data from memory.
oru_walk(ALPtr< ALBroker > broker, const string &name)