Ubuntu18.04基于docker环境跑通PL-VINS
- 创建容器
- 问题一:直接对docker容器进行roslaunch plvins_estimator plvins_show_linepoint.launch会出现ROS path [0]=/opt/ros/melodic/share/ros ROS path [1]=/root/catkin_ws/src ROS path [2]=/opt/ros/melodic/share The traceback for the exception was written to the log file问题
- 问题二 QXcbConnection: Could not connect to display
- 问题三:[image_node_b-7] process has died [pid 1955, exit code -6, cmd /root/catkin_ws/devel/lib/image_node_b/image_node_b __name:=image_node_b __log:=/root/.ros/log/126e5a68-f898-11ed-8313-0242ac110004/image_node_b-7.log].
- 问题四: QXcbConnection: Could not connect to display
- 问题五fatal error: line_descriptor_custom.hpp: No such file or directory
- 最后终于成功啦
- 制作镜像并上传
- 容器中使用VSCODE
PL-VINS项目
dockerhub参考PL-VINS镜像
创建容器
可参考:
docker run --gpus all -it --privileged=true -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/tb/data:/data -e DISPLAY=$DISPLAY --name mycontainer ros_pytorch_ubuntu18.04 /bin/bash
问题一:直接对docker容器进行roslaunch plvins_estimator plvins_show_linepoint.launch会出现ROS path [0]=/opt/ros/melodic/share/ros ROS path [1]=/root/catkin_ws/src ROS path [2]=/opt/ros/melodic/share The traceback for the exception was written to the log file问题
解决方法:
我将catkin_ws文件下build、devel、src中的PL-VINS删除,等于我只要它的环境,我对PL-VINS重新下载编译
问题二 QXcbConnection: Could not connect to display
解决方法:退出容器
xhost +local:
之后再进入容器中
问题三:[image_node_b-7] process has died [pid 1955, exit code -6, cmd /root/catkin_ws/devel/lib/image_node_b/image_node_b __name:=image_node_b __log:=/root/.ros/log/126e5a68-f898-11ed-8313-0242ac110004/image_node_b-7.log].
解决方法:参考ubuntu18.04运行PL-VINS问题记录
以下直接复制啦
问题原因:
挂掉的原因是linefeature_tracker_node中只发布了归一化坐标,没有发布linefeature的startpoint和endpoint的像素坐标。
解决:修改PL-VINS/image_node_b/src/image_node_b.cpp
修改1:在void callback函数上方新增加一个函数void project存放像素坐标:
void project(cv::Point2f& pt, cv::Mat const& k)
{
pt.x=k.at<float>(0,0)*pt.x+k.at<float>(0,2);
pt.y=k.at<float>(1,1)*pt.y+k.at<float>(1,2);
}
修改2: 修改线投影的代码,找到如下代码段并注释掉:
cv::Point startPoint = cv::Point(line_feature_msg->channels[3].values[i], line_feature_msg->channels[4].values[i]);
cv::Point endPoint = cv::Point(line_feature_msg->channels[5].values[i], line_feature_msg->channels[6].values[i]);
添加正确代码:
cv::Point2f startPoint = cv::Point2f(line_feature_msg->points[i].x,line_feature_msg->points[i].y );
project (startPoint,K_);
cv::Point2f endPoint = cv::Point2f(line_feature_msg->channels[1].values[i],line_feature_msg->channels[2].values[i]);
project (endPoint,K_);
修改3: 以下路径改为绝对路径:
问题四: QXcbConnection: Could not connect to display
解决方法:
xhost +local:
问题五fatal error: line_descriptor_custom.hpp: No such file or directory
最后终于成功啦
制作镜像并上传
制作镜像
docker commit -m="plvins_ubuntu18.04" -a="tb" bb390f67d410 tb/plvins:v1
上传:
docker push tb/plvins:v1
出现问题:
denied: requested access to the resource is denied
解决方法:
首先把生成的镜像修改标签:
格式是docker tag 镜像名 your-repository(你的dockerhub用户名)/subname:tagname(记得标签号不能少)
举例:
docker tag 5e686706b1e8 fymtb/plvins:v1
最后即可上传
docker push fymtb/plvins:v1