Basler接口:
千兆网(GigE Vision) 或Camera Link接口
支持PoE的千兆网(GigE)、支持PoCL的Camera Link、USB 3.0
相机符合GigE Vision、USB3 Vision和Camera Link标准协议,具有极佳的稳定性和灵活性
USB3 Vision 接口标准
设备标识 设备控制 流技术 技术细节
物理层 链路层 协议层 USB3 Vision
带宽 供电能力 效率 稳定
getChunkTimestamp
括事件产生时间戳 inPixelTimestamp ,
事件输出时间戳 offPixelTimestamp ,
还有机器(例如ROS)收到时的时间戳 rosTs
触发方式
内触发模式: 相机通过设备内部给出的信号采集图像。
外触发模式: 相机通过外部给出的信号采集图像。
外部信号可以是软件信号,也可以是硬件信号,主要包含软触发和硬件触发
曝光
叠曝光和非交叠曝光相比,交叠曝光可以减少曝光时间对出图时间的影响
The frame transmission time
delay duration
相机上的图像采集过程包括两个截然不同的部分。
第一部分是exposure 曝光。曝光完成后,Exposure Time
第二部分Readout过程 即从传感器的寄存器中读出数据并传送出去(Readout过程)
曝光时间
“non-overlapped”的曝光和“overlapped”的曝光。
01.在非重叠(“non-overlapped”)模式中,每个图像采集的周期中,相机在下一个图像采集开始前,均要完成曝光/读出整个过程
02.在“overlapped”曝光模式下 相机读出数据和下一帧曝光开始出现重叠的情况,在同一个时刻内,相机执行两个操作,导致在同样的单位时间内,
可以采集到更多的图片,即相机的帧率更高
overlapped”的曝光模式下: FramePeriod ≤Exposure Time + ReadoutTime
“non-overlapped”的曝光模式下:FramePeriod > Exposure Time + Readout Time
PTP
setting their internal clocks based on the same reference clock which is the GPS clock,
using chronyd, gpsd, and IEEE 1588 PTP protocols,
the timestamps provided alongside with the information
PTP(Precision Time Protocol,精确时间同步协议)应运而生,最新协议是IEEE1588v2,可实现亚微秒量级的时间同步精度。
PTP 是一种高精度时间同步协议 , 可以到达亚微秒级精度 , 有资料说可达到 30 纳秒左右的偏差精
时间戳一般为10位和13位,10位的单位是秒,13位的是毫秒 1秒=1000毫秒(ms) 1秒=1,000,000 微秒(μs) 1秒=1,000,000,000 纳秒(ns)
stamp:
secs: 1582203535
nsecs: 456908823
NTP(Network Time Protocol) 局域网内计算机利用NTP协议进行时间同步,时间同步精度在5ms左右
数据块+ 元数据
1.Chunk --》 data chunks
chunk1 图像数据块 image data payload 图像有效载荷数据
chunk1 ID
chunk1 长度
chunk2 Gain块
这些数据帧中的记录信息的原始数据就是有效载荷数据,即 payload data
头和尾都加上一定的辅助信息,比如这一批数据量的大小,校验位等,这样就相当于给已经分批原始数据加一些外套,
这些外套起到标示作用,使得原始数据不易丢失
Exposure Time Chunk
If this chunk is enabled, the camera appends the exposure time used for image acquisition to every image.
2.Metadata --》 grab result data or pylon chunk parser
image height, image width, the image ROI offset, and the pixel format used.
###时间戳数据块
The Timestamp camera feature counts the number of ticks generated by the camera's internal device clock
Timestamp Chunk#
If this chunk is enabled, the camera appends an internal timestamp (in ticks) of a certain event to every image.
BslChunkTimestampValue or ChunkTimestamp
current image started
ChunkTimestamp
For Basler cameras, this means that their GevTimestampValue parameter values will be as identical as possible.
3.时间戳
时间戳一般为10位和13位,10位的单位是秒,13位的是毫秒
1秒=1000毫秒(ms) 1秒=1,000,000 微秒(μs) 1秒=1,000,000,000 纳秒(ns)
stamp:
secs: 1582203535
nsecs: 456908823
The nodes “TimestampControlLatch”,
“TimestampTickFrequency”,
Timestamp Value”
and “TimestampControlReset” are used to retrieve the timestamp
GevTimestampTickFrequency
## aca1920-48gc
执行 GevTimestampControlLatch 命令。获取相机当前时间戳值的“快照”。
获取 GevTimestampValue 参数的值。该参数的值表示执行 GevTimestampControlLatch 命令的时间点
相机型号
#include <GenApi/GenApi.h>
// Take a "snapshot" of the camera's current timestamp value
camera.TimestampLatch.Execute();
// Get the timestamp value
int64_t i = camera.TimestampLatchValue.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Take a "snapshot" of the camera's current timestamp value
CCommandParameter(nodemap, "TimestampLatch").Execute();
// Get the timestamp value
int64_t i = CIntegerParameter(nodemap, "TimestampLatchValue").GetValue();
参考
https://docs.baslerweb.com/timestamp#__tabbed_2_1
相机型号 按C选择型号 GevTimestampControlReset command aca1920-48gc
cam_->ChunkTimestamp.GetValue();
// Take a "snapshot" of the camera's current timestamp value
camera.GevTimestampControlLatch.Execute();
// Get the timestamp value
int64_t i = camera.GevTimestampValue.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Take a "snapshot" of the camera's current timestamp value
CCommandParameter(nodemap, "GevTimestampControlLatch").Execute();
// Get the timestamp value
int64_t i = CIntegerParameter(nodemap, "GevTimestampValue").GetValue();
驱动代码
bool PylonCameraNode::grabImage()
{
boost::lock_guard<boost::recursive_mutex> lock(grab_mutex_);
// Store current time before the image is transmitted for a more accurate grab time estimation
ros::Time grab_time = ros::Time::now();
if ( !pylon_camera_->grab(img_raw_msg_.data) )
{
return false;
}
img_raw_msg_.header.stamp = grab_time;
return true;
}
GenApi::INodeMap& node_map = cam_->GetNodeMap();
GenApi::INodeMap& node_map = dev.GetNodeMap();
Pylon::CCommandParameter
Execute(bool Verify =true) //Execute the command.
Pylon::CIntegerParameter
GetValue(bool Verify =false, bool IgnoreCache =false) //Get node value.
bool setChunkEnableCallback(std_srvs::SetBool::Request &req, std_srvs::SetBool::Response &res);
/**
* Service callback for getting the Value of the timestamp when the image was acquired - Applies to: GigE and ace USB..
* @param req request
* @param res response
* @return true on success
*/
bool getChunkTimestampCallback(camera_control_msgs::GetIntegerValue::Request &req, camera_control_msgs::GetIntegerValue::Response &res);
ros::ServiceServer get_chunk_timestamp_srv;
int PylonCameraImpl<CameraTraitT>::getChunkTimestamp() {
cam_info->header.stamp = img_raw_msg_.header.stamp;
ros::Time grab_time = ros::Time::now();
img_raw_msg_.header.stamp = grab_time;
// Store current time before the image is transmitted for a more accurate grab time estimation
img.header.stamp = ros::Time::now();
格式化转换
ros::Time int64_t
#include <string>
ros::Time timesamp2rostime(int64_t timesamp){
std::string suanz = std::to_string(timesamp);
std::string sec_string = suanz.substr(0,10);
std::string nsec_string = suanz.substr(10,9);
while(nsec_string.length() < 9){
nsec_string += "0";
}
return ros::Time(std::stoi(sec_string),std::stoi(nsec_string));
}
stamp:
secs: 1582203535
nsecs: 456908823
ROS的时间戳是很大的一个数值,所以在计算时, 用 double 类型,而不能用float
project
A basic CMakeLists.txt CMake file could look like this:
project (grab)
## Locate pylon.
find_package(pylon 7.1.0 REQUIRED)
add_executable(grab Grab.cpp)
target_link_libraries(grab pylon::pylon)
相位锁定功能,也就是输入PPS,但PPS上升沿到来时,激光雷达的激光束恰好旋转到一定的角度
参考
https://www.baslerweb.com/en/products/cameras/area-scan-cameras/ace/aca1920-40gc/
https://zh.docs.baslerweb.com/aca1920-48gc
https://docs.baslerweb.com/pylonapi/cpp/class_pylon_1_1_c_command_parameter
https://blog.csdn.net/wyf826459/article/details/104783394
激光雷达与相机时间同步问题的低成本完整解决方案 https://blog.csdn.net/qq_24972557/article/details/115049024
标签:同步,timestamp,image,概览,camera,时间,Time,grab,曝光
From: https://www.cnblogs.com/ytwang/p/17027668.html