文件配置
本节描述如何配置几个OpenPTrack文件,这些文件允许每个节点在网络上正确通信,并标识它们的关联映像器。
1.修改bashrc文件
每个传感器都应该连接到同一千兆以太网的PC机上。一台PC机作为主机,在主机上运行校准代码和跟踪代码,另一台PC机运行传感器驱动程序(在校准期间)和人员检测代码(在分布式检测和跟踪期间)。为了允许不同计算机中的软件节点之间通信,必须将每个客户机PC上的环境变量ROS_MASTER_URI设置为主机的IP地址。此外,必须在每台PC上设置ROS_IP和ROS_PC_NAME环境变量。
export ROS_MASTER_URI=http://<MASTER_IP>:11311/
export ROS_IP=<MACHINE_IP>
export ROS_PC_NAME=<MACHINE_NAME>
例如:
export ROS_MASTER_URI=http://192.168.100.101:11311/
export ROS_IP=192.168.100.102
export ROS_PC_NAME=PC1-Example
注意,要分配的PC名称可以是用户想要的任何名称,不一定与PC的真实名称相关。要明确设置它们,可以直接将它们添加到home文件夹中的.bashrc文件末尾,方法是:
echo "export ROS_MASTER_URI=http://192.168.100.101:11311/" >> ~/.bashrc
echo "export ROS_IP=192.168.100.102" >> ~/.bashrc
echo "export ROS_PC_NAME=PC1-Example" >> ~/.bashrc
或者
gedit ~/.bashrc
2. 为多传感器校准创建文件
多传感器校准是通过在主PC上运行一个校准节点,在每个连接到传感器的PC上运行一个传感器驱动程序(每个传感器对应一个驱动程序节点)来实现的。网络必须在opt_calibration/conf/camera_network.yaml文件。
# Camera network parameters
network:
- pc: "PC1-Example"
sensors:
- type: kinect1
id: "Kinect_Left"
serial: "A00364820345039A"
- type: kinect1
id: "Kinect_Right"
serial: "A00345482325021B"
- pc: "PC1-Example"
sensors:
- type: kinect2
id: "Kinect_PC2"
- type: sr4500
id: "SwissRanger"
ip: "192.168.1.42"
- type: stereo_pg
id: "blackfly_stereo"
serial_left: "13310958"
serial_right: "13310959"
注意::特别注意前导空间。不要使用Tab键。
- pc: "PC1-Example"
需要与 .bashrc
ROS_PC_NAME=
相同,将PC添加到网络中,参数PC:“”前面加上一个减号,表示它属于一个列表(请参阅上面的yaml文档)。
然后,对于每台PC机,将连接的传感器列表与参数传感器一起添加。对于每个传感器,可以定义2 - 4个参数:
-
type
(mandatory) defines the type of the sensor. It must bekinect1
for the 1st Kinect version,kinect2
for the 2nd Kinect version,sr4500
for Swiss Rangers SR4500, andstereo_pg
for custom stereo pairs composed of Point Grey cameras. -
id
(mandatory) is the unique name to identify the sensor in the network. -
serial
(optional, for Kinects only) defines the serial number of the Kinects to make them distinguishable in the same PC. -
ip
(mandatory, for SwissRangers only) is the local IP address of the SwissRanger (can be the same for each one if connected to different PCs). -
serial_left
,serial_right
(optional, for stereo only) define the serial numbers of the left and right cameras of the stereo pair. The serials of the cameras attached to a PC can be retrieved withrosrun pointgrey_camera_driver list_cameras
.
校正棋盘的参数也必须加上:
# Checkerboard parameters
checkerboard:
rows: 6
cols: 5
cell_width: 0.12
cell_height: 0.12
注意:行和列参数是由行和列中的国际象棋交叉点数量(cols)定义的,而不是由棋盘边缘的正方形数量定义的。宽度和高度的测量单位是米
在上面的图像中,行数为6,cols数为5。这是由于棋盘上的列和行相交造成的。考虑这个问题的一个简单方法是计算列和行,每一个数减去1。在上面的棋盘上,有7行6列;每一行减去1,就得到校准配置所需的6行5列的值。