Level1_MotorNode/motor_control_node/command.cpp
//================================================================================================//
// Wheel velocity command                                                                         //
//   Argument : *str - received character array, ptr - the last pointer of the character array    //
//   Return   : none                                                                              //
//================================================================================================//
Wheel velocity command
Argument : *str - received character array, ptr - the last pointer of the character array
Return   : none
Wheel velocity command Argument : * str - received character array ptr - the last pointer of the character array Return : none
void read_wheel_vel_cmd(char *str, uint8_t ptr, long *omega_cmd_x10) {
  if (ptr == 22) {
    if (str[0] == 'v' && str[1] == 'e' && str[2] == 'l') {
      if (str[20] == 'e' && str[21] == 'n' && str[22] == 'd') {
        if (str[3] == ',' && str[7] == ',' && str[13] == ',' && str[19] == ',') {
          if (str[8] == '+')       omega_cmd_x10[0] =   ((int16_t)str[ 9] - 48) * 1000 + ((int16_t)str[10] - 48) * 100 + ((int16_t)str[11] - 48) * 10 + ((int16_t)str[12] - 48);
          else if (str[8] == '-')  omega_cmd_x10[0] = -(((int16_t)str[ 9] - 48) * 1000 + ((int16_t)str[10] - 48) * 100 + ((int16_t)str[11] - 48) * 10 + ((int16_t)str[12] - 48));
          if (str[14] == '+')      omega_cmd_x10[1] =   ((int16_t)str[15] - 48) * 1000 + ((int16_t)str[16] - 48) * 100 + ((int16_t)str[17] - 48) * 10 + ((int16_t)str[18] - 48);
          else if (str[14] == '-') omega_cmd_x10[1] = -(((int16_t)str[15] - 48) * 1000 + ((int16_t)str[16] - 48) * 100 + ((int16_t)str[17] - 48) * 10 + ((int16_t)str[18] - 48));
        }
      }
    }
  }
}
void read_wheel_vel_cmd ( char * str , uint8_t ptr , long * omega_cmd_x10 ) { if ( ptr == 22 ) { if ( str [ 0 ] == ' ' && str [ 1 ] == ' ' && str [ 2 ] == ' ' ) { if ( str [ 20 ] == ' ' && str [ 21 ] == ' ' && str [ 22 ] == ' ' ) { if ( str [ 3 ] == ' ' && str [ 7 ] == ' ' && str [ 13 ] == ' ' && str [ 19 ] == ' ' ) { if ( str [ 8 ] == ' ' ) omega_cmd_x10 [ 0 ] = ( ( int16_t ) str [ 9 ] - 48 ) * 1000 + ( ( int16_t ) str [ 10 ] - 48 ) * 100 + ( ( int16_t ) str [ 11 ] - 48 ) * 10 + ( ( int16_t ) str [ 12 ] - 48 ) ; else if ( str [ 8 ] == ' ' ) omega_cmd_x10 [ 0 ] = - ( ( ( int16_t ) str [ 9 ] - 48 ) * 1000 + ( ( int16_t ) str [ 10 ] - 48 ) * 100 + ( ( int16_t ) str [ 11 ] - 48 ) * 10 + ( ( int16_t ) str [ 12 ] - 48 ) ) ; if ( str [ 14 ] == ' ' ) omega_cmd_x10 [ 1 ] = ( ( int16_t ) str [ 15 ] - 48 ) * 1000 + ( ( int16_t ) str [ 16 ] - 48 ) * 100 + ( ( int16_t ) str [ 17 ] - 48 ) * 10 + ( ( int16_t ) str [ 18 ] - 48 ) ; else if ( str [ 14 ] == ' ' ) omega_cmd_x10 [ 1 ] = - ( ( ( int16_t ) str [ 15 ] - 48 ) * 1000 + ( ( int16_t ) str [ 16 ] - 48 ) * 100 + ( ( int16_t ) str [ 17 ] - 48 ) * 10 + ( ( int16_t ) str [ 18 ] - 48 ) ) ; } } } } }
Wheel velocity command
Argument : *str - received character array, ptr - the last pointer of the character array
Return   : none
Wheel velocity command Argument : * str - received character array ptr - the last pointer of the character array Return : none