How to run pbvs or ibvs

633 views
Skip to first unread message

Abdulrahman Alshanoon

unread,
Dec 16, 2017, 4:44:02 PM12/16/17
to Robotics & Machine Vision Toolboxes
Hi all

I reading chapter 15 I want to run the example pbvs and ibvs but I getting some errors 


cam=CentralCamera('name','Camera','default'); 
P=mkgrid(2,0.5,'T',transl(0,0,3)); 
Tc0=transl(1,1,-3)*trotz(0.6); 
TcStar_t=transl(0,0,1); 
Tc_t_est = cam.estpose(P, p);

Tdelta = TcStar_t * inv(Tc_t_est);

I get this error :

Struct contents reference from a non-struct array object.

Error in  *  (line 225)
            n = obj1.dim;


or

when I try 

Tdelta = Tc_t_est * inv(TcStar_t)

I got this error

Error using  *  (line 254)
LHS should be matrix with 3 rows


Any solutions please ??!!

Peter Corke

unread,
Dec 16, 2017, 5:48:21 PM12/16/17
to Robotics & Machine Vision Toolboxes
Please see my reply to your other post.   I think you are using the old syntax (textbook edition1 from 2011) with the newest version of the toolbox (2017).

peter

abdulrah...@gmail.com

unread,
Dec 30, 2017, 5:45:01 PM12/30/17
to Robotics & Machine Vision Toolboxes
Thanks for help Dr Peter 

I have the following issue, I am using RTB 10.2, vision 4.1 and your 2017 book, I tried with Matlab R2016a, R2016b, and R2018a. I don't know what should I do? 

>> cam = CentralCamera('default');           
principal point not specified, setting it to centre of image plane
>> P = mkgrid( 2, 0.5, 'pose', SE3(0,0,3) );   
Undefined function or variable 'cam'.

Error in  *  (line 254)
ibvs = IBVS(cam, 'pose0', T_C0, 'pstar', pd);                    assert(numrows(a) == n-1, 'RTB:RTBPose:badops', 'LHS should be matrix
with %d rows', n-1);

Error in mkgrid (line 72)
        p = SE3.check(opt.pose) * p;

Peter Corke

unread,
Dec 30, 2017, 7:31:42 PM12/30/17
to Robotics & Machine Vision Toolboxes
There's something wrong with the code you cut and pasted.  Those two lines run fine, but the command that fails is not given.  mkgrid() cannot give that error message.

peter

abdulrah...@gmail.com

unread,
Dec 31, 2017, 10:55:09 PM12/31/17
to Robotics & Machine Vision Toolboxes
Thanks again for prompt reply 

I solved my issue by removing the path of RTB10.2, and run the file 10.2Robotics Toolbox for MATLAB.mltbx. For vision 4.1, I just added the whole folder to the path. Then I run the following IBVS code, it works fine with me:-

cam = CentralCamera('default');           % defining the camera with known parameters

P = mkgrid( 2, 0.5, 'pose', SE3(0,0,3) );  % target four points in image plane

pd = bsxfun(@plus, 200*[-1 -1 1 1; -1 1 1 -1], cam.pp'); % the desired features target position is centered on the %principle points and implicitly have the square target fronto-parallel to the camera.

T_C0 = SE3(1,1,-3)*SE3.Rz(0.6);              % initial camera position in the world coordinates

p = cam.plot(P, 'pose', T_C0)                   % initial camera pose in pixel coordinates

e = pd - p;  % image plane error bet. The desired camera position and initial camera position

J = cam.visjac_p( p, 1 ); % image Jacobian 8 × 6 matrix, since p has four feature points

lambda = 0.125; % gain value

v = lambda * pinv(J) * e(:); % control law determines the required translational and angular velocity of the camera


%T_C = T_C0 .* delta2tr(v); % the updated motion of the camera toward the goal


ibvs = IBVS(cam, 'pose0', T_C0, 'pstar', pd);

ibvs.run();

ibvs.plot_p(); % plot the path of the feature points on the image plane

ibvs.plot_vel(); % Cartesian velocity

ibvs.plot_camera(); % Cartesian position

ibvs.plot_jcond(); % condition number of the image Jacobian 


Thanks sir

Reply all
Reply to author
Forward
0 new messages