/* initialize */ int event_init(){ int i, k; hb_init(ofile,SHMSIZE); init_hist(); evt_time(); /* clear scalers */ k = nscalers*nmodes; scaler = (int*)malloc(sizeof(int)*k); for(i=0; i<k; i++) scaler[i] = 0; /* clear analyzed blocks */ ablk = 0; cblk = 0; return 0; }
// ********************** Software Initialization ************************** void init_software(void){ // ********************************************* // Standard board initialization. Do not modify. // ********************************************* asched_init(schedule,1); error_init(dn_error_transmit, asched_get_timestamp, BOARD_UI); //* dn_error_transmit hb_init(9, dn_blue_heartbeat, asched_get_timestamp); //heartbeat // ********************************************* // Put user initialization code below here. // ********************************************* ui_led_init(); ui_sync_led_init(asched_get_timestamp); //sync led lcd_init(asched_tick); msimu_init(MSIMU_EULER_ANGS_ANG_RATE); rcx_init(1,1,0,0); // rcx_init(1,1,1,1); song_set(alma_mater, 26); }
// ********************** Software Initialization ************************** void init_software(void){ // ********************************************* // Standard board initialization. Do not modify. Unless you dare. // ********************************************* asched_init(main_schedule,1); error_init(dn_error_transmit, asched_get_timestamp, BOARD_MCH); hb_init(9, dn_blue_heartbeat, asched_get_timestamp); //heartbeat // ********************************************* // Put user initialization code below here. // ********************************************* adci_init(ADCI_NULL, ADCI_NO_FILTER, ADCI_NULL, ADCI_NULL); //batt voltage on adcx_init(); adcx_add_config( ADCX_CH_P4N5, ADCX_GAIN_2); //motor current adcx_add_config( ADCX_CH_P2N3, ADCX_GAIN_2); //battery current qdc_tmr0_init ( 60000000, //Count frequency of timer 0 in cycles per second 2048, //Pulses per revolution per channel (1X) of CAP01 encoder 1.0, //Gear ratio to obtain output shaft angle/rate, if desired, for CAP01 encoder. 0.0005, //Time per call to qdc_tmr0_cap01_rate_update in seconds 4, //Maximum exponential smoothing coefficient exponent for cap01. See instructions. 4, //Minimum exponential smoothing coefficient exponent for cap01 192, //Pulses per revolution per channel (1X) of CAP23 encoder 66.0, //Gear reduction ratio to obtain output shaft angle/rate, if desired, for CAP23 encoder 0.0005, //Timer per call to qdc_tmr1_cap23_rate_update in seconds 4, //Maximum exponential smoothing coefficient exponent for cap23 See instructions. 4 //Minimum exponential smoothing coefficient exponent for cap23 ); //Motor controller setup and initialization mc_init ( 12.0, 5.0, -5.0, 4.0, -4.0, 3.1, 10.0, 0.0, // **** TEST CODE **** lower Kp //220.0, 20.0, 0.0, 250, 4, 20.0, MC_NORMAL, &dn_get_raw_motor_current, &dn_get_shaft_pos_rads, &dn_get_motor_vel_rads ); ae_init_encoder(AE_1,4590,94,8192); //abs encoder for hip angle is on J3 mc_set_stiffness(0.0); mc_set_dampness(0.0); mc_set_command_current(0.0); }
/********************* Software Initialization **************************/ void init_software(void){ // ********************************************* // Standard board initialization. Do not modify. Unless you dare. // ********************************************* asched_init(main_schedule,1); error_init(dn_error_transmit, asched_get_timestamp, BOARD_MCFO); hb_init(9, dn_blue_heartbeat, asched_get_timestamp); //heartbeat // ********************************************* // Put user initialization code below here. // ********************************************* adci_init(ADCI_NULL, ADCI_NO_FILTER, ADCI_NULL, ADCI_NULL); //batt voltage on adcx_init(); adcx_add_config(ADCX_CH_P4N5, ADCX_GAIN_2); //motor current adcx_add_config(ADCX_CH_P2N3, ADCX_GAIN_2); //battery current adcx_add_config(ADCX_CH_0, ADCX_GAIN_1); //left outer heel strike adcx_add_config(ADCX_CH_1, ADCX_GAIN_1); //right outer heel strike //Initialize incremental encoder position and rate calculations. //Put setup, smoothing/filtering, and calibration values here qdc_tmr0_init ( 60000000, //Count frequency of timer 0 in cycles per second 512, //Pulses per revolution per channel (1X) of CAP01 encoder -34, //Gear ratio to obtain output shaft angle/rate, if desired, for CAP01 encoder. 0.0005, //Time per call to qdc_tmr0_cap01_rate_update in seconds 4, //Maximum exponential smoothing coefficient exponent for cap01. See instructions. 4, //Minimum exponential smoothing coefficient exponent for cap01 2048, //Pulses per revolution per channel (1X) of CAP23 encoder -1.0, //Gear reduction ratio to obtain output shaft angle/rate, if desired, for CAP23 encoder 0.0005, //Timer per call to qdc_tmr1_cap23_rate_update in seconds 4, //Maximum exponential smoothing coefficient exponent for cap23 See instructions. 4 //Minimum exponential smoothing coefficient exponent for cap23 ); //Initialize motor controller mc_init ( 12.0, 8.0, -2.0, 6.0, -1.0, 3.1, 10.0, 0.0, // **** TEST CODE **** Kp test //220.0, 20.0, 0.0, 300, 4, 20.0, MC_BACKWARDS, &dn_get_raw_motor_current, &dn_get_motor_pos_rads, &dn_get_motor_vel_rads ); //Initialize the absolute encoder module ae_init_encoder ( AE_2, 6562, 186, 8192 ); ls_init_switch(2, dn_get_p0); // id:0, left ankle ls_init_switch(2, dn_get_p1); // id:1, right angle ls_init_switch(10, dn_get_raw_right_hs); // id:2, right heel strike ls_init_switch(10, dn_get_raw_left_hs); //id:3, left heel strike mc_set_stiffness(0.0); mc_set_dampness(0.0); mc_set_command_current(0.0); }