谁能告诉我,为什么上和下的情况与按钮完美地工作,而其他人没有?我尝试了这两种不同的方法,一种是在左边的情况下看到的,另一种是在正确的情况下,但这两种方法都根本不起作用。
void Move(String direction)
{
timer.Enabled = true;
switch (direction)
{
case "Up ":
onvifPTZ.RelativeMove(0, 1f, 0, (float)Pan_Speed.Value, (float)Tilt_Speed.Value, (float)Zoom_Speed.Value);
break;
case "Down":
onvifPTZ.RelativeMove(0, -1f, 0, (float)Pan_Speed.Value, (float)Tilt_Speed.Value, (float)Zoom_Speed.Value);
break;
case "Left":
direction = Direction.Left.ToString();
onvifPTZ.RelativeMove((float)Direction.Left, 0, 0, (float)Pan_Speed.Value, (float)Tilt_Speed.Value, (float)Zoom_Speed.Value);
break;
case "Right":
onvifPTZ.RelativeMove(-1f, 0, 0, (float)Pan_Speed.Value, (float)Tilt_Speed.Value, (float)Zoom_Speed.Value);
break;
}
}这是我的相对移动函数。
public int RelativeMove(float xTrans, float yTrans, float zTrans, float xSpeed , float ySpeed, float zSpeed)
{
// Define Translation Vector
PTZ.PTZVector ptzTrans = new PTZ.PTZVector()
{
PanTilt = new PTZ.Vector2D()
{
x = xTrans,
y = yTrans,
space = ptzOptions.Spaces.RelativePanTiltTranslationSpace[0].URI,
},
Zoom = new PTZ.Vector1D()
{
x = zTrans,
//space = ptzOptions.Spaces.RelativeZoomTranslationSpace[0].URI,
}
};
// Define Speed Vector
PTZ.PTZSpeed ptzSpd = new PTZ.PTZSpeed()
{
PanTilt = new PTZ.Vector2D()
{
x = xSpeed,
y = ySpeed,
//space = ptzOptions.Spaces.RelativePanTiltTranslationSpace[0].URI,
},
Zoom = new PTZ.Vector1D()
{
x = zSpeed,
// space = ptzOptions.Spaces.RelativeZoomTranslationSpace[0].URI,
}
};
// Move relative along vectore <ptzTrans> with speed <ptzSpd>
// Zoom is manipulated with <zSpeed>.
ptzClient.RelativeMove(profiles[this.selectedProfile].token, ptzTrans, ptzSpd);
return 0;
}如果有人知道我是怎么做的,请帮忙:)如果有人知道如何在我不按下按钮的情况下停止移动,请告诉我,因为它也不起作用.我确实实现了它,并告诉摄像机在那里停止移动,但它根本没有反应。
发布于 2018-12-05 16:41:25
从你的描述,我知道你试图移动PTZ单位使用速度。但是,这与您在代码中使用的函数RelativeMove不匹配。
如果PTZ节点支持相对Pan/Tilt或相对缩放运动,那么它将支持RelativeMove操作。此操作的转换参数指定从当前位置到PTZ设备被指示移动的位置之间的差异。该操作被拆分为可选的泛美/Tilt元素和可选的Zoom元素。如果省略Pan/Tilt元素,则当前Pan/Tilt移动将不受此命令的影响。缩放元素也是如此。
因此,您有两个选择:
ContinuousMove是否是执行所需功能的函数。RelativeMove,请检查ptzOptions.Spaces.RelativePanTiltTranslationSpace[0].URI是什么。这可能是一个定制的空间,有不同的范围,为平底锅和倾斜。https://stackoverflow.com/questions/53499526
复制相似问题