int sysMotorget(int motor) { #ifdef VSIMU return get_motor_val(motor); #endif #ifdef VREAL // char buffer[256]; int k,kx; motor=1+(motor&1); kx=(int)get_motor_position(motor); /* k=(int)get_motor_position(motor); if (kmotor[motor]!=k) { kmotor[motor]=k; kvmotor[motor]++; } kx=kvmotor[motor]; */ // sprintf(buffer,"getmotor %d pos %x / %x\r\n",motor,k,kx); // if(motor==2) // consolestr(buffer); return kx; #endif }
void param_set_hook(volatile msg_set_param_t *msg ) { int32_t foo; switch(msg->param_id) { case IMC_PARAM_LOCATION :// also set the position of the encoder. set_enc_value((int32_t)((float)msg->param_value * enc_tics_per_step)); path_imc(get_motor_position() * enc_tics_per_step); // keep the controller from moving us back to where we were. break; } }