예제 #1
0
int main(int argc, char *argv[])
{
	Network yarp;
	
	// IMPORTANT
	// TO BE ABLE TO FIND KASPAR Devices
    #ifdef USE_KASPAR_MOD
	yarp::dev::DriverCollection dev;
	#endif

	printf("SDLJSLKdjfklSJ\n");
	Property config;
	
	//config.fromCommand(argc, argv);
	//config.put("device", "KasparServos");
	config.fromConfigFile("D:/roboskin/coding/roboskin/src/modules/kasparServos/KasparRoboSkin.cfg");
	//Property options;

	//options.put("device", "fsrTouchSensor");
	//options.put("device", "remote_controlboard");
	PolyDriver dd;
	dd.open(config);
	
	/*CAUTION::::: device here should be remote_controlboard, rather than dynamixelAX12FtdiDriver*/
	//http://wikiri.upc.es/index.php/YARP_devices
	//http://eris.liralab.it/wiki/YARP_Motor_Control
	//http://eris.liralab.it/yarpdoc/d1/d88/classyarp_1_1dev_1_1RemoteControlBoard.html
	//PolyDriver dd("(device remote_controlboard) (local /client) (remote /controlboard)");
	if (!dd.isValid())
	{
		printf("Device not available.\n");
	//	Network::fini();
		return 1;
	}

	IPositionControl *pos;
	ITorqueControl *tor;
	IEncoders *enc;
	//yarp::os::Thread *th;
	if(!dd.view(pos))
    {
        printf("Problem of open pos device\n");
        return 0;
	}
pos->setRefSpeed(9, 10);
	std::cout << pos->positionMove(9, 150) << std::endl;
	/*
	// Test for SSC32 servos
	pos->setRefSpeed(6, 10);
	std::cout << pos->positionMove(6, 0) << std::endl;
	//Time::delay(1);
	//pos->setRefSpeed(3, 0.1);
	std::cout << pos->positionMove(6, 0) << std::endl;
	//Time::delay(1);
	//pos->setRefSpeed(4, 0.1);
	pos->setRefSpeed(5, 30);
	pos->setRefSpeed(4, 80);
	pos->setRefSpeed(3, 80);
	
	std::cout << pos->positionMove(5, 0) << std::endl;
	std::cout << pos->positionMove(4, 0) << std::endl;
		std::cout << pos->positionMove(3, -40) << std::endl;
		Time::delay(1);
		std::cout << pos->positionMove(3, 40) << std::endl;
	*/
	///*
		if(!dd.view(tor))
    {
        printf("Problem of open tor device\n");
        return 0;
	}

		tor->setRefTorque(9, 1023);

		Time::delay(2);
		tor->setRefTorque(9, 0);

		Time::delay(2);
		tor->setRefTorque(9, 1023);

		Time::delay(2);
		//tor->setRefTorque(9, 1023);
		/*
	if(!dd.view(enc))
    {
        printf("Problem of open enc device\n");
        return 0;
	}

    int jnts = 5;
	double t = 0;
	double p = 0;
	pos->getAxes(&jnts);
	std::cout << jnts << std::endl;
	pos->setRefSpeed(4, 23);
	std::cout << pos->positionMove(4, 90) << std::endl;
	pos->setRefSpeed(6, 20);
	std::cout << pos->relativeMove(6, 10) << std::endl;
	enc->getEncoder(4, &p);
	std::cout << "Position for joint 4 is --> " << p << std::endl;
//	printf("axes: %d\n", jnts);

	Time::delay(1);
	pos->setRefSpeed(2, 23);
	//yarp::os::Searchable c;

	//    std::cout << pos->positionMove(2, 15) << std::endl;
	//Time::delay(1);
	pos->setRefSpeed(4, 9);
	//yarp::os::Searchable c;

	std::cout << pos->positionMove(4, 100) << std::endl;
	yarp::os::Time::delay(1);
	//sleep(1);
	//tor->getTorque(4, &t);
	//std::cout << t << std::endl;

	std::cout << pos->relativeMove(4, 20) << std::endl;
	//sleep(1);
	//pos->relativeMove(4, 40);
    //yarp::os::Time::delay(1);
	//sleep(1);
	//sleep(1);
	for (int ii = 0; ii < 10; ii++)
	{
        //tor->getTorque(4, &t);
	//	enc->getEncoderSpeed(4, &t);
	//	std::cout << "Torque for join t 4 is --> " << t << std::endl;
		//std::cout << pos->positionMove(4, 90 + ii*5) << std::endl;

		//		sleep(1);
		yarp::os::Time::delay(0.11);
		enc->getEncoder(4, &p);
		std::cout << "Position for joint 4 is --> " << p << std::endl;
enc->getEncoder(1, &p);
		std::cout << "Position for joint 1 is --> " << p << std::endl;
		enc->getEncoder(2, &p);
		std::cout << "Position for joint 2 is --> " << p << std::endl;
		enc->getEncoder(3, &p);
		std::cout << "Position for joint 3 is --> " << p << std::endl;
	}
	yarp::os::Time::delay(1);
//	std::cout << pos->positionMove(4, 90) << std::endl;

	    std::cout << pos->relativeMove(4, -20) << std::endl;

	//    std::cout << pos->positionMove(2, 30) << std::endl;
	//    std::cout << pos->positionMove(2, 50) << std::endl;

	Time::delay(1);
*/
	dd.close();
    
	return 0;
}
bool partMover::entry_update(partMover *currentPart)
{
  GdkColor color_black;
  GdkColor color_grey;
  GdkColor color_yellow;
  GdkColor color_green;
  GdkColor color_green_blue;
  GdkColor color_dark_green;
  GdkColor color_red;
  GdkColor color_fault_red;
  GdkColor color_pink;
  GdkColor color_indaco;
  GdkColor color_white;
  GdkColor color_blue;
  
  color_pink.red=219*255;
  color_pink.green=166*255;
  color_pink.blue=171*255;

  color_fault_red.red=255*255;
  color_fault_red.green=10*255;
  color_fault_red.blue=10*255;

  color_black.red=10*255;
  color_black.green=10*255;
  color_black.blue=10*255;

  color_red.red=255*255;
  color_red.green=100*255;
  color_red.blue=100*255;

  color_grey.red=220*255;
  color_grey.green=220*255;
  color_grey.blue=220*255;

  color_white.red=250*255;
  color_white.green=250*255;
  color_white.blue=250*255;

  color_green.red=149*255;
  color_green.green=221*255;
  color_green.blue=186*255;

  color_dark_green.red=(149-30)*255;
  color_dark_green.green=(221-30)*255;
  color_dark_green.blue=(186-30)*255;

  color_blue.red=150*255;
  color_blue.green=190*255;
  color_blue.blue=255*255;

  color_green_blue.red=(149+150)/2*255;
  color_green_blue.green=(221+190)/2*255;
  color_green_blue.blue=(186+255)/2*255;

  color_indaco.red=220*255;
  color_indaco.green=190*255;
  color_indaco.blue=220*255;

  color_yellow.red=249*255;
  color_yellow.green=236*255;
  color_yellow.blue=141*255;
  
  GdkColor* pColor= &color_grey;

  static int slowSwitcher = 0;

  IControlMode     *ictrl = currentPart->ctrlmode2;
  IInteractionMode *iint  = currentPart->iinteract;
  IPositionControl  *ipos = currentPart->pos;
  IVelocityControl  *ivel = currentPart->iVel;
  IPositionDirect   *iDir = currentPart->iDir;
  IEncoders       *iiencs = currentPart->iencs;
  ITorqueControl    *itrq = currentPart->trq;
  IAmplifierControl *iamp = currentPart->amp;

  GtkEntry * *pos_entry   = (GtkEntry **)  currentPart->currPosArray;
  GtkEntry  **trq_entry   = (GtkEntry **)  currentPart->currTrqArray;
  GtkEntry  **speed_entry = (GtkEntry **)  currentPart->currSpeedArray;
  GtkEntry    **inEntry   = (GtkEntry **)  currentPart->inPosArray;
  GtkWidget **colorback   = (GtkWidget **) currentPart->frameColorBack;

  GtkWidget **sliderAry = currentPart->sliderArray;
  bool *POS_UPDATE = currentPart->CURRENT_POS_UPDATE;

  char buffer[40] = {'i', 'n', 'i', 't'};
  char frame_title [255];

  double positions[MAX_NUMBER_OF_JOINTS];
  double torques[MAX_NUMBER_OF_JOINTS];
  double speeds[MAX_NUMBER_OF_JOINTS];
  double max_torques[MAX_NUMBER_OF_JOINTS];
  double min_torques[MAX_NUMBER_OF_JOINTS];
  static int controlModes[MAX_NUMBER_OF_JOINTS];
  static int controlModesOld[MAX_NUMBER_OF_JOINTS];
  static yarp::dev::InteractionModeEnum interactionModes[MAX_NUMBER_OF_JOINTS];
  static yarp::dev::InteractionModeEnum interactionModesOld[MAX_NUMBER_OF_JOINTS];

  int k;
  int NUMBER_OF_JOINTS=0;
  bool done = false;
  bool ret = false;
  ipos->getAxes(&NUMBER_OF_JOINTS);

  if (NUMBER_OF_JOINTS == 0)
  {
      fprintf(stderr,"Lost connection with iCubInterface. You should save and restart.\n" );
      Time::delay(0.1);
      pColor=&color_grey;
      strcpy(frame_title,"DISCONNECTED");
      for (k = 0; k < MAX_NUMBER_OF_JOINTS; k++)
      {   
          if (currentPart->framesArray[k]!=0)
          {
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          }
      }
      return true;
  }

  for (k = 0; k < NUMBER_OF_JOINTS; k++) 
  {
      max_torques[k]=0;
      min_torques[k]=0;
      torques[k]=0;
  }

  if (!iiencs->getEncoders(positions)) 
      return true;
  itrq->getTorques(torques);
  iiencs->getEncoderSpeeds(speeds);
  
  //update all joints positions
  for (k = 0; k < NUMBER_OF_JOINTS; k++)
    {
      sprintf(buffer, "%.1f", positions[k]);  
      gtk_entry_set_text((GtkEntry*) pos_entry[k],  buffer);
      sprintf(buffer, "%.3f", torques[k]);  
      gtk_entry_set_text((GtkEntry*) trq_entry[k],  buffer);
      sprintf(buffer, "%.1f", speeds[k]);  
      gtk_entry_set_text((GtkEntry*) speed_entry[k],  buffer);
    }
  //update all joint sliders
  for (k = 0; k < NUMBER_OF_JOINTS; k++) 
    if(POS_UPDATE[k])
      gtk_range_set_value((GtkRange*)sliderAry[k],  positions[k]);

  // *** update the checkMotionDone box section ***
  // (only one at a time in order to save badwidth)
  k = slowSwitcher%NUMBER_OF_JOINTS;
  slowSwitcher++;
#if DEBUG_GUI
  gtk_entry_set_text((GtkEntry*) inEntry[k],  "off");
#else
  ipos->checkMotionDone(k, &done);
  if (!done)
      gtk_entry_set_text((GtkEntry*) inEntry[k],  " "); 
  else
      gtk_entry_set_text((GtkEntry*) inEntry[k],  "@");
#endif

  // *** update the controlMode section ***
  // the new icubinterface does not increase the bandwidth consumption
  // ret = true; useless guys!
  ret=ictrl->getControlModes(controlModes);
  if (ret==false) fprintf(stderr,"ictrl->getControlMode failed\n" );
  ret=iint->getInteractionModes(interactionModes);
  if (ret==false) fprintf(stderr,"iint->getInteractionlMode failed\n" );

  for (k = 0; k < NUMBER_OF_JOINTS; k++)
  {
      if (currentPart->first_time==false && controlModes[k] == controlModesOld[k]) continue;
      controlModesOld[k]=controlModes[k];
      sprintf(frame_title,"Joint %d ",k );

      switch (controlModes[k])
      {
          case VOCAB_CM_IDLE:
              pColor=&color_yellow;
                strcat(frame_title," (IDLE)");
                gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_POSITION:
              pColor=&color_green;
              strcat(frame_title," (POSITION)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"Position:");
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"Velocity:");
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_POSITION_DIRECT:
              pColor=&color_dark_green;
              strcat(frame_title," (POSITION_DIRECT)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"Position:");
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"---");
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_MIXED:
              pColor=&color_green_blue;
              strcat(frame_title," (MIXED_MODE)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"Position:");
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"Velocity");
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_VELOCITY:
              pColor=&color_blue;
              strcat(frame_title," (VELOCITY)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_TORQUE:
              pColor=&color_pink;
              strcat(frame_title," (TORQUE)");
                gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"Torque:");
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"Torque2:");
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
              break;
          case VOCAB_CM_IMPEDANCE_POS:
              pColor=&color_indaco;
              strcat(frame_title," (IMPEDANCE POS)");
                gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
            case VOCAB_CM_IMPEDANCE_VEL:
              pColor=&color_indaco;
              strcat(frame_title," (IMPEDANCE VEL)");
                gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_OPENLOOP:
              pColor=&color_white;
              strcat(frame_title," (OPENLOOP)");
                gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_HW_FAULT:
              pColor=&color_fault_red;
              strcat(frame_title," (HARDWARE_FAULT)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"---");
              gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"---");
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
              break;
         case VOCAB_CM_CALIBRATING:
              pColor=&color_grey;
              strcat(frame_title," (CALIBRATING)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
         case VOCAB_CM_CALIB_DONE:
              pColor=&color_grey;
              strcat(frame_title," (CALIB DONE)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_NOT_CONFIGURED:
              pColor=&color_grey;
              strcat(frame_title," (NOT CONFIGURED)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          case VOCAB_CM_CONFIGURED:
              pColor=&color_grey;
              strcat(frame_title," (CONFIGURED)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
          default:
          case VOCAB_CM_UNKNOWN:
              pColor=&color_grey;
              strcat(frame_title," (UNKNOWN)");
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          break;
      }
  }
  for (k = 0; k < NUMBER_OF_JOINTS; k++)
  {
      if (currentPart->first_time==false && interactionModes[k] == interactionModesOld[k]) continue;
      interactionModesOld[k]=interactionModes[k];
      switch (interactionModes[k])
      {
           case VOCAB_IM_STIFF:
               gtk_widget_modify_base ((GtkWidget*)inEntry[k], GTK_STATE_NORMAL, &color_green);
           break;
           case VOCAB_IM_COMPLIANT:
               gtk_widget_modify_base ((GtkWidget*)inEntry[k], GTK_STATE_NORMAL, &color_fault_red);
           break;
           default:
           case VOCAB_CM_UNKNOWN:
               gtk_widget_modify_base ((GtkWidget*)inEntry[k], GTK_STATE_NORMAL, &color_white);
           break;
      }
  }

  currentPart->first_time =false;
  return true;
    
}
예제 #3
0
bool partMover::entry_update(partMover *currentPart)
{
  GdkColor color_grey;
  GdkColor color_yellow;
  GdkColor color_green;
  GdkColor color_red;
  GdkColor color_pink;
  GdkColor color_indaco;
  GdkColor color_white;
  GdkColor color_blue;
  
  color_pink.red=219*255;
  color_pink.green=166*255;
  color_pink.blue=171*255;

  color_red.red=255*255;
  color_red.green=100*255;
  color_red.blue=100*255;

  color_grey.red=220*255;
  color_grey.green=220*255;
  color_grey.blue=220*255;

  color_white.red=250*255;
  color_white.green=250*255;
  color_white.blue=250*255;

  color_green.red=149*255;
  color_green.green=221*255;
  color_green.blue=186*255;

  color_blue.red=150*255;
  color_blue.green=190*255;
  color_blue.blue=255*255;

  color_indaco.red=220*255;
  color_indaco.green=190*255;
  color_indaco.blue=220*255;

  color_yellow.red=249*255;
  color_yellow.green=236*255;
  color_yellow.blue=141*255;
  
  GdkColor* pColor= &color_grey;

  static int slowSwitcher = 0;

  IControlMode     *ictrl = currentPart->ctrlmode;
  IPositionControl  *ipos = currentPart->pos;
  IVelocityControl  *ivel = currentPart->iVel;
  IEncoders       *iiencs = currentPart->iencs;
  ITorqueControl    *itrq = currentPart->trq;
  IAmplifierControl *iamp = currentPart->amp;

  GtkEntry * *pos_entry   = (GtkEntry **)  currentPart->currPosArray;
  GtkEntry  **trq_entry   = (GtkEntry **)  currentPart->currTrqArray;
  GtkEntry  **speed_entry = (GtkEntry **)  currentPart->currSpeedArray;
  GtkEntry    **inEntry   = (GtkEntry **)  currentPart->inPosArray;
  GtkWidget **colorback   = (GtkWidget **) currentPart->frameColorBack;

  GtkWidget **sliderAry = currentPart->sliderArray;
  bool *POS_UPDATE = currentPart->CURRENT_POS_UPDATE;

  char buffer[40] = {'i', 'n', 'i', 't'};
  char frame_title [255];

  double positions[MAX_NUMBER_OF_JOINTS];
  double torques[MAX_NUMBER_OF_JOINTS];
  double speeds[MAX_NUMBER_OF_JOINTS];
  double max_torques[MAX_NUMBER_OF_JOINTS];
  double min_torques[MAX_NUMBER_OF_JOINTS];
  static int controlModes[MAX_NUMBER_OF_JOINTS];
  static int controlModesOld[MAX_NUMBER_OF_JOINTS];

  int k;
  int NUMBER_OF_JOINTS=0;
  bool done = false;
  bool ret = false;
  ipos->getAxes(&NUMBER_OF_JOINTS);

  if (NUMBER_OF_JOINTS == 0)
  {
      fprintf(stderr,"Lost connection with iCubInterface. You should save and restart.\n" );
      Time::delay(0.1);
      pColor=&color_grey;
      strcpy(frame_title,"DISCONNECTED");
      for (k = 0; k < MAX_NUMBER_OF_JOINTS; k++)
      {   
          if (currentPart->framesArray[k]!=0)
          {
              gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
              gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
          }
      }
      return true;
  }

  for (k = 0; k < NUMBER_OF_JOINTS; k++) 
  {
	  max_torques[k]=0;
	  min_torques[k]=0;
	  torques[k]=0;
  }

  if (!iiencs->getEncoders(positions)) 
	  return true;
  itrq->getTorques(torques);
  iiencs->getEncoderSpeeds(speeds);
  
  //update all joints positions
  for (k = 0; k < NUMBER_OF_JOINTS; k++)
    {
      sprintf(buffer, "%.1f", positions[k]);  
      gtk_entry_set_text((GtkEntry*) pos_entry[k],  buffer);
      sprintf(buffer, "%.3f", torques[k]);  
	  gtk_entry_set_text((GtkEntry*) trq_entry[k],  buffer);
      sprintf(buffer, "%.1f", speeds[k]);  
	  gtk_entry_set_text((GtkEntry*) speed_entry[k],  buffer);
    }
  //update all joint sliders
  for (k = 0; k < NUMBER_OF_JOINTS; k++) 
    if(POS_UPDATE[k])
      gtk_range_set_value((GtkRange*)sliderAry[k],  positions[k]);

  // *** update the checkMotionDone box section ***
  // (only one at a time in order to save badwidth)
  k = slowSwitcher%NUMBER_OF_JOINTS;
  slowSwitcher++;
#if DEBUG_GUI
  gtk_entry_set_text((GtkEntry*) inEntry[k],  "off");
#else
  ipos->checkMotionDone(k, &done);
  if (!done)
      gtk_entry_set_text((GtkEntry*) inEntry[k],  " "); 
  else
      gtk_entry_set_text((GtkEntry*) inEntry[k],  "@");
#endif

  // *** update the controlMode section ***
  // the new icubinterface does not increase the bandwidth consumption
  // ret = true; useless guys!
  ret=ictrl->getControlModes(controlModes);

  if (ret==false) fprintf(stderr,"ictrl->getControlMode failed\n" );
  for (k = 0; k < NUMBER_OF_JOINTS; k++)
  {
	  if (currentPart->first_time==false && controlModes[k] == controlModesOld[k]) continue;
	  controlModesOld[k]=controlModes[k];
	  sprintf(frame_title,"Joint %d ",k );

	  switch (controlModes[k])
	  {
		  case VOCAB_CM_IDLE:
			  pColor=&color_yellow;
  			  strcat(frame_title," (IDLE)");
  			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
		  case VOCAB_CM_POSITION:
			  pColor=&color_green;
			  strcat(frame_title," (POSITION)");
			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"Position:");
			  gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"Velocity:");
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
		  case VOCAB_CM_VELOCITY:
			  pColor=&color_blue;
			  strcat(frame_title," (VELOCITY)");
			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
		  case VOCAB_CM_TORQUE:
			  pColor=&color_pink;
			  strcat(frame_title," (TORQUE)");
  			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider1[k]),"Torque:");
			  gtk_frame_set_label   (GTK_FRAME(currentPart->frame_slider2[k]),"Torque2:");
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
			  break;
		  case VOCAB_CM_IMPEDANCE_POS:
			  pColor=&color_indaco;
			  strcat(frame_title," (IMPEDANCE POS)");
  			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
  		  case VOCAB_CM_IMPEDANCE_VEL:
			  pColor=&color_indaco;
			  strcat(frame_title," (IMPEDANCE VEL)");
  			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
		  case VOCAB_CM_OPENLOOP:
			  pColor=&color_white;
			  strcat(frame_title," (OPENLOOP)");
  			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
		  default:
		  case VOCAB_CM_UNKNOWN:
			  pColor=&color_grey;
			  //strcat(frame_title," (UNKNOWN)");
			  gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
			  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
		  break;
	  }

	  //  pColor=&color_blue;
	  //  gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
	  
	  int curr_amp_status=0;
	  int amp_status[60];                             //fix this!!!
	  for (int i=0; i<60; i++) amp_status[i]=0;       //fix this!!!
	  iamp->getAmpStatus(amp_status);                 //fix this!!!
	  curr_amp_status=amp_status[k];                  //fix this!!!

#if 0
	  if ((amp_status[k] & 0xFF)!=0)
	  {
	     //fprintf(stderr, "FAULT DETECTED: %x\n", curr_amp_status);
		 //pColor=&color_red;
		 //strcat(frame_title," (FAULT)");
		 //gtk_frame_set_label   (GTK_FRAME(currentPart->framesArray[k]),frame_title);
		 //gtk_widget_modify_bg (colorback[k], GTK_STATE_NORMAL, pColor);
	  }
#endif
  }

  currentPart->first_time =false;
  return true;
	
}