コード例 #1
0
ファイル: cmd-motor.c プロジェクト: owenlu552/turner-ip2.5
void cmdSetPIDGains(unsigned char type, unsigned char status, unsigned char length, unsigned char *frame){
	int Kp, Ki, Kd, Kaw, ff;
	int idx = 0;

	Kp = frame[idx] + (frame[idx+1] << 8); idx+=2;
	Ki = frame[idx] + (frame[idx+1] << 8); idx+=2;
	Kd = frame[idx] + (frame[idx+1] << 8); idx+=2;
	Kaw = frame[idx] + (frame[idx+1] << 8); idx+=2;
	ff = frame[idx] + (frame[idx+1] << 8); idx+=2;
	pidSetGains(0,Kp,Ki,Kd,Kaw, ff);
	Kp = frame[idx] + (frame[idx+1] << 8); idx+=2;
	Ki = frame[idx] + (frame[idx+1] << 8); idx+=2;
	Kd = frame[idx] + (frame[idx+1] << 8); idx+=2;
	Kaw = frame[idx] + (frame[idx+1] << 8); idx+=2;
	ff = frame[idx] + (frame[idx+1] << 8); idx+=2;
	pidSetGains(1,Kp,Ki,Kd,Kaw, ff);

	//Send confirmation packet
	radioConfirmationPacket(RADIO_DEST_ADDR, CMD_SET_PID_GAINS, status, 20, frame);  
      return; //success
}
コード例 #2
0
ファイル: cmd.c プロジェクト: eschaler/roach
 unsigned char cmdSetPIDGains(unsigned char type, unsigned char status, unsigned char length, unsigned char *frame) {
    int Kp, Ki, Kd, Kaw, ff;
    int idx = 0;

    Kp = frame[idx] + (frame[idx+1] << 8); idx+=2;
    Ki = frame[idx] + (frame[idx+1] << 8); idx+=2;
    Kd = frame[idx] + (frame[idx+1] << 8); idx+=2;
    Kaw = frame[idx] + (frame[idx+1] << 8); idx+=2;
    ff = frame[idx] + (frame[idx+1] << 8); idx+=2;
    pidSetGains(0,Kp,Ki,Kd,Kaw, ff);
    Kp = frame[idx] + (frame[idx+1] << 8); idx+=2;
    Ki = frame[idx] + (frame[idx+1] << 8); idx+=2;
    Kd = frame[idx] + (frame[idx+1] << 8); idx+=2;
    Kaw = frame[idx] + (frame[idx+1] << 8); idx+=2;
    ff = frame[idx] + (frame[idx+1] << 8); idx+=2;
    pidSetGains(1,Kp,Ki,Kd,Kaw, ff);

    radioSendData(RADIO_DST_ADDR, status, CMD_SET_PID_GAINS, 20, frame, 0); //TODO: Robot should respond to source of query, not hardcoded address
    //Send confirmation packet
    // WARNING: Will fail at high data throughput
    //radioConfirmationPacket(RADIO_DEST_ADDR, CMD_SET_PID_GAINS, status, 20, frame);
    return 1; //success
}
コード例 #3
0
ファイル: steering.c プロジェクト: apullin/octoroach
void steeringSetGains(int Kp, int Ki, int Kd, int Kaw, int ff) {
    pidSetGains(&steeringPID, Kp, Ki, Kd, Kaw, ff);
}
コード例 #4
0
ファイル: leg_ctrl.c プロジェクト: abuchan/octoroach
void legCtrlSetGains(unsigned int num, int Kp, int Ki, int Kd, int Kaw, int ff){
    pidSetGains(&(motor_pidObjs[num]), Kp, Ki, Kd, Kaw, ff);
}