(!) It is appreciated that problems/questions regarding this tutorial are asked on answers.ros.org. Don't forget to include in your question the link to this page, versions of your OS & ROS, and also add appropriate tags.

Creating a DX100 Server Application(<=Groovy)

Description: This tutorial walks through the steps of creating a server application for the dx100 controller. The server application runs on the controller and allows communications with ROS nodes.

Keywords: dx100, motoman, motoplus

Tutorial Level: INTERMEDIATE

This procedure requires the compilation of a server program that runs directly on the dx100 controller. This requires the MotoPlus application. This tutorial assumes the user has some familiarity with the MotoPlus SDK.

NOTE: The procedure for creating the dx100 server application on the controller has changed for the Trunk(Fuerte)/Groovy ROS release. Follow the appropriate sections below.

Trunk(Fuerte)/Groovy

The process for building and deploying the dx100 server application has been greatly simplified (Thanks to efforts by Motoman!).

  1. Import the motoros_lib library to the motoros server application. A batch file has been created called, SyncFromSource.bat, that automatically does this for you.

  2. Build the motoros server application located in motoplus\motoros_server (See below for details).
  3. Deploy your application to the controller (see MotoPlus documentation)

  4. Configure the controller (see this section)

Fuerte

There are three parts to creating a Fuerte server. The first part steps through the process of adding the robot specific joint rads to pulses conversion factors. This may not be required if your particular robot model has already been added to the list. The second part creates a robot specific server application that must be loaded on the controller in order to communicate with ROS. The final step requires adding INFORM tasks and setting variable values.

Adding Robot Specific Conversion Factors to the ROS Library

Add Robot Model

Open ros_conversion.h, add your robot model to the MotomanRobotModel enumeration (if your model number is already in the list, then the joint conversions have already been calculated and verified, jump to the second part of this tutorial).

   1 namespace MotomanRobotModels
   2 {
   3 enum MotomanRobotModel
   4 {
   5   SIA_10D,
   6   SIA_20D
   7 };
   8 }
   9 typedef MotomanRobotModels::MotomanRobotModel MotomanRobotModel;

Joint Conversion Factors

Please contact Yaskawa Motoman support for the conversion factor to convert pulse-counts to radians.

In ros_conversion.cpp, add the conversion factors to the initJointConversion function

   1 void initJointConversion(MotomanRobotModel model_number)
   2 {
   3     
   4     LOG_INFO("Initializing joint conversion factors for: ");
   5     switch (model_number)
   6     {
   7     case MotomanRobotModels::SIA_10D:
   8         LOG_INFO("SIA_10D: %d", model_number);
   9         S_PULSE_TO_RAD  = 58670.87822;      
  10         L_PULSE_TO_RAD  = 58670.87822;   
  11         U_PULSE_TO_RAD  = 65841.76588;      
  12         R_PULSE_TO_RAD  = 65841.76588;    
  13         B_PULSE_TO_RAD  = 65841.76588;    
  14         T_PULSE_TO_RAD  = 33246.8329;     
  15         E_PULSE_TO_RAD  = 65841.76588;  
  16         break;
  17         
  18     case MotomanRobotModels::SIA_20D:
  19         LOG_INFO("SIA_20D: %d", model_number);
  20         S_PULSE_TO_RAD  = 58670.87822;      
  21         L_PULSE_TO_RAD  = 58670.87822;   
  22         U_PULSE_TO_RAD  = 58670.87822;      
  23         R_PULSE_TO_RAD  = 65841.76588;    
  24         B_PULSE_TO_RAD  = 65841.76588;    
  25         T_PULSE_TO_RAD  = 33246.8329;     
  26         E_PULSE_TO_RAD  = 58670.87822;  
  27         break;
  28     
  29     default:
  30         LOG_ERROR("Failed to initialize conversion factors for model: %d", model_number);
  31         break;
  32     }
  33 }

Verify the motoros_lib library builds (See below for details)

Creating the robot specific server application (building application)

Create a new directory with the name of your application (typically the robot model number). If you are using version control, add the following file externals (see http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-externals.html if you are using tortoise svn)

../motoros_lib/output/motoros_lib.mpLib motoros_lib.mpLib
../motoros_lib/output/mp_default_main.h mp_default_main.h
../motoros_lib/output/ros_conversion.h ros_conversion.h
../motoros_lib/output/joint_data.h joint_data.h
../motoros_lib/output/simple_message.h simple_message.h
../motoros_lib/output/simple_serialize.h simple_serialize.h
../motoros_lib/output/shared_types.h shared_types.h
../motoros_lib/output/byte_array.h byte_array.h

Add your directory and update using version control. The above external files will be copied into your directory. (NOTE: if you are not working in version control or your version control does not support externals, then simply copy the files from the locations above).

  1. In the folder you just created, create a shortcut link to MotoPlusCPPCompile_DX100.exe in the installation directory for MotoPlusIDE. (If you do not have the MotoPlusCPPCompile application, please contact Yaskawa Motoman for the latest update).
  2. Run the shortcut without any command-line arguments to view the Usage page.
  3. Modify the command arguments in the shortcut for your project. (Example: "C:\Program Files (x86)\Yaskawa\MotoPlusIDE_DX\MotoPlusCPPCompile_DX100.exe" -n MyProjectName -p "C:\My Project Folder\" -s Y -e us-ascii -l N)

  4. Modify the default build setting to include the MOTOPLUS compiler switch. The default build settings are contained in file "<install dir>\mpbuilder\settings\DefaultCompileCommand.mps". Add "-DMOTOPLUS" to the command string (typically add right after "-DCPU=PENTIUM4")

  5. Copy the following code into the mpMain.cpp file (Don't forget your copyright header). Replace the <<ROBOT_MODEL>> tag with the robot model you added in the first part of this tutorial.

   1 //mpMain.cpp
   2 //
   3 //This contains mpUsrRoot which is the entry point for your MotoPlus application
   4 #include "mp_default_main.h"
   5 #include "ros_conversion.h"
   6 #include "motoPlus.h"
   7 
   8 using namespace motoman::mp_default_main;
   9 using namespace motoman::ros_conversion;
  10 
  11 int motion_server_task_ID; \
  12 int system_server_task_ID; \
  13 int state_server_task_ID; \
  14 int io_server_task_ID; \
  15 extern "C" void mpUsrRoot(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10)
  16 {  
  17   initJointConversion( MotomanRobotModels::<<ROBOT_MODEL>> ); 
  18   motion_server_task_ID = mpCreateTask(MP_PRI_TIME_NORMAL, MP_STACK_SIZE, (FUNCPTR)motionServer, 
  19                                         arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); 
  20   state_server_task_ID = mpCreateTask(MP_PRI_TIME_NORMAL, MP_STACK_SIZE, (FUNCPTR)stateServer, 
  21                                         arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); 
  22   mpExitUsrRoot; //Ends the initialization task. 
  23 } 

Build and Deploy

Verify that your application library builds (run shortcut to MotoPlusCPPCompile_DX100.exe. Deploy your application to the controller (see MotoPlus documentation)

Configure the Controller

Before motion can be commanded from ROS-Industrial, the following controller configuration must be performed (this is after the motoplus application has been loaded and the controller rebooted).

  • Special controller parameters must be loaded. See dx100 package requirements for more information.

  • The INFORM jobs in the inform directory must also be loaded.
  • Set the move velocity limit (Integer data[94]). NOTE: The current implementation of the motoman interface ignores the ROS velocity and instead sets a single velocity for an entire motion. The move velocity is currently limited to <20% for smooth motion. Setting higher values will result in stop/start motion.

In order for ROS to communicate with the controller it must be connected via Ethernet. It is recommended that a small local network be used for this, since delays in this communications channel could affect motion.

Wiki: dx100/Tutorials/Creating_DX100_Server_Application (last edited 2013-09-12 19:56:29 by ShaunEdwards)