matlab视觉伺服仿真过程中遇到的error:Error in port widths or dimensions. ‘Output Port 1‘ of ‘sl_arm_ibvs/camera‘

在运行matlab视觉伺服工具箱中的机械臂仿真时遇到以下问题:Error in port widths or dimensions. 'Output Port 1' of 'sl_arm_ibvs/camera' is a [28x1] matrix.

该问题是由于下图中红圈标注处输入向量维度错误导致。

此处的p为相机像素坐标系下的坐标值,应该为2*4向量。

解决方法:新版本的Machine Vision Toolbox for MATLAB工具箱中缺乏了模块“slcamera.m”,打开simulate中的camera模块:

双击matlab fcn模块,提示找不到“slcamera”,选择新建:

 键入以下代码:

function p = slcamera(cam, u)
    %if all(u == 0)
     if (u(1:16,:)==0)
        % Simulink is probing for the dimensions
        np = (length(u)-16)/3;
        p = zeros(2, np);
    else
        p = zeros(2, 4);
        P = reshape(u(17:end), 3, []);
        Tcam = reshape(u(1:16), 4, 4);
        p = cam.plot(P, 'pose', Tcam, 'drawnow');
        
    end

再次运行simulate,可以看到该报错以及消失,这时应该会遇到如下error:

 Error in 'sl_arm_ibvs/camera/MATLAB Fcn'. Evaluation of expression resulted in an invalid output. Only finite
double vector or matrix outputs are supported

关于该报错的解决办法,本人也在研究中,请关注以后的博客。

 

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值