![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Original Version of STM Board
Diff: setting.h
- Revision:
- 170:42c938a40313
- Parent:
- 169:645207e160ca
- Child:
- 171:bfc1fd2629d8
--- a/setting.h Mon Nov 16 02:23:23 2020 +0000 +++ b/setting.h Wed Nov 18 12:03:39 2020 +0000 @@ -38,8 +38,8 @@ extern unsigned int value; // 10bit output of reading sensor AS5510 // SPI -//extern SPI eeprom; //(SPI_MOSI, SPI_MISO, SPI_SCK); -//extern DigitalOut eeprom_cs; +extern SPI eeprom; //(SPI_MOSI, SPI_MISO, SPI_SCK); +extern DigitalOut eeprom_cs; extern SPI enc; extern DigitalOut enc_cs; @@ -185,7 +185,7 @@ extern float Ps; extern float Pt; extern float gamma_hat; -extern float V; +extern float V_adapt; extern float x_4_des_old; //extern int16_t VALVE_LIMIT_PLUS; @@ -435,6 +435,7 @@ extern int timer_while; extern int while_index; +extern int RL_timer; extern float K_LPF; extern float D_LPF; @@ -462,6 +463,57 @@ +/////////////RL +#define num_batch 10 +#define num_epoch 1 +#define batch_size 50 +#define num_input_RL 2 + +extern int batch; +extern float train_set_x[batch_size]; +extern float train_set_error[batch_size]; +extern float train_set_count[batch_size]; +extern float state_array[batch_size][num_input_RL]; +extern float V[batch_size]; +extern float r[batch_size]; +extern float td_target[batch_size]; +extern float delta[batch_size]; +extern float advantage[batch_size]; + +extern float mean; +extern float deviation; +extern float mean_old; +extern float deviation_old; +extern float mean_before_SP; +extern float deviation_before_SP; +extern float mean_before_SP_array[batch_size]; +extern float deviation_before_SP_array[batch_size]; +extern float mean_array[batch_size]; +extern float mean_array_old[batch_size]; +extern float deviation_array[batch_size]; +extern float deviation_array_old[batch_size]; +extern float action; +extern float action_array[batch_size]; +extern float ratio[batch_size]; +extern float pi[batch_size]; +extern float pi_old[batch_size]; +extern float epsilon; +extern float surr1[batch_size]; +extern float surr2[batch_size]; +extern float loss[batch_size]; +extern float loss_batch; +extern float gamma; +extern float lmbda; +extern char Update_Done_Flag; +extern char Update_Case; +extern float reward_sum; + +extern float virt_pos; +extern float logging1; +extern float logging2; +extern float logging3; +extern float logging4; +extern float logging5; @@ -474,4 +526,3 @@ -