Available now on our RTSX download page
After experimenting with Beta1 version for nearly a year with more function implementation, bug fixes, and refinements, I decide to launch Version 1.0 of RTSX (Robotic Tools for Scilab/Xcos). Basic usage of the software remains the same. An e-book Industrial Robot Analysis and Control” with a couple of free downloadable chapters is also available. Meanwhile, it is quite possible to use this text from Professor Peter Corke
and consult RTSX online help to find the right command syntax . Many core commands of Prof. Corke’s rvctools are implemented, expecially those for the position/velocity kinematics, trajectory generation, dynamics, and some vision-based control, while those related to more advanced topics such as mobile robots, navigation etc. are left out. The following discussion might help smoothen the conversion from rvctools to RTSX.
No OOP command in RTSX
RTSX is written entirely using Scilab commands. Since there’s no direct OOP support in Scilab, those rvctools commands that rely on MATLAB OOP features have to be changed for both syntax and usage.
As an example, suppose you want to create a central-perspective camera with rvctools, as explained on page 256 of the above text, you can issue the following commands in MATLAB
>> cam = CentralCamera('focal', 0.015, 'pixel', 10e-6, ... 'resolution', [1280 1024], 'centre', [640 512], 'name', 'mycamera') cam = name: mycamera [central-perspective] focal length: 0.015 pixel size: (1e-05, 1e-05) principal pt: (640, 512) number pixels: 1280 x 1024 T: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
This creates a camera object named ‘cam’ with a few parameters and methods attached to it. Then you can project a world point or plot it using methods
>> P = mkgrid(3, 0.2, 'T', transl(0, 0, 1.0)); >> cam.project(P) ans = 490 490 490 640 640 640 790 790 790 362 512 662 362 512 662 362 512 662 >> cam.plot(P)
Note the way that project( ) and plot( ), method functions of the object cam , are called. This kind of syntax is not possible with RTSX. The approach I use to get around this problem is to create a camera model as a data structure .
-->cam = CentralCamera('focal', 0.015, 'pixel', 10e-6, ... --->'resolution', [1280 1024], 'centre', [640 512], 'name', 'mycamera') cam = name: "mycamera" comment: "" T: [4x4 constant] f: 0.015 rho: [0.00001,0.00001] npix: [1280,1024] pp: [640,512] limits: [-1,1,-1,1] perspective: %t noise: 0 u0: 640 v0: 512 C: [3x4 constant] K: [3x3 constant]
Even the command syntax for this part is the same, keep in mind that cam in RTSX is a data structure. It has only parameters attached, with no method. So we need to implement project( ) and plot( ) as ordinary functions and pass cam to it. To avoid name crashes with other Scilab commands, I make the names more specific as CamProject( ) and CamPlot( )
-->P = mkgrid(3, 0.2, 'T', transl(0, 0, 1.0)); -->CamProject(cam,P) ans = 490. 490. 490. 640. 640. 640. 790. 790. 790. 362. 512. 662. 362. 512. 662. 362. 512. 662. -->CamPlot(cam,P)
Commands specific to RTSX
There are some RTSX commands that originate from my teaching experience in robotics and hence are unrelated to rvctools. For instance, I found stutdents were often confused about the difference beween rotating around a current frame and the world frame, when the rotation operations were executed in sequence. So I construct a function trotw( ) to show rotation around the world frame. Another example is PlotRobotFrame( ) that, as the name says, plot all coordinate frames in a robot configuration. This helps a student verify his homework assignment and has a better understanding on how to correctly attach frames conforming to Denavit-Hartenberg convention.
The Xcos part is not quite yet a tool
A nice feature of rvctools is seamless integration of MATLAB functions and Simulink models, say, you can run a Simulink mdl file that commands robot movement in a MATLAB graphic window. To be honest, I am still not an expert in Scilab to implement such a link between Scilab and Xcos. So the Xcos models included in RTSX so far are more like standalone examples on PID, linear and nonlinear feedback control. Quite a shame I know, but well, RTSX is just a one-year-old child, isn’t he?
Machine vision part is still open for your development
At first I have no desire to implement any image processing or control in this tool. After playing around with it a bit, I ‘ve found it interesting in its own right. Version 1.00 of RTSX therefore provides a few basic machine vision commands, like those already discussed above. If I have more expertise in this area (and time), more may be added in the future. Otherwise, I leave it for you to fill in.
Here I give a final example on a visual control scheme known as IBVS (Image-Based Visual Servoing). RTSX includes a function IBVS4( ), written specificly for 4 feature points (*) tracking. You can then follow the discussion and examples in Sec 15.2 of Prof.Corke’s book, with IBVS4 in place of the object ibvs or Simulink model.
(*) Roughly speaking, feature points are those points on the object of interest that identify its motion on the image plane. Suppose an object is of rectangular shape, then its 4 corners can be conveniently selected as feature points.
Let’s say we want to investigate the camera retreat scenario that happens when the target is rotated about the z-axis (discussed in section 15.2.4, page 471 of the text).
-->cam = CentralCamera('default'); -->P = mkgrid(2, 0.5,'T',transl(0,0,2)); -->pStar = camproject(cam,P,'Tcam',trotz(0.9*pi)); -->ibvs4(cam, 'P', P,'pstar',pStar,'depth',2); Image-Based Visual Servo algorithm for 4-point image features. 87 ----- of maximum 1000 iterations
The resulting plots are shown below. We can see that when the target is rotated around Z axis, the camera moves backward significantly along Z.
I appreciate any feedback on this software to make it a better educational tool. See you next time for more tips on RTSX. Have fun.