diff --git a/README.md b/README.md
index a3a136b..6ae2ae1 100644
--- a/README.md
+++ b/README.md
@@ -9,14 +9,18 @@
#### 安装教程
-1. xxxx
-2. xxxx
+1. chmod +x build.sh
+2. ./build.sh
3. xxxx
#### 使用说明
-1. xxxx
-2. xxxx
+
+在最外层目录 catkin_make
+在工作目录下(src上一层)
+记得source(可能需要)
+1. source ./devel/setup.bash
+2. roslaunch point_visual laser.launch
3. xxxx
#### 参与贡献
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..5a8e36b
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# 创建工作目录
+mkdir ~/PointVisual
+
+cd ..
+#将当前src移动到PointVisual
+cp -r src ~/PointVisual
+
+# 切换到工作目录
+cd ~/PointVisual
+
+# 在工作目录make
+catkin_make
+
+if [ $? -eq 0 ]; then
+
+# 执行source命令
+ source ./devel/setup.bash
+
+# 运行其他命令
+# roslaunch point_visual laser.launch
+ roscore &
+ sleep 2
+ rosrun point_visual myviz
+else
+ exit 1
+fi
diff --git a/librviz_tutorial/launch/laser.launch b/librviz_tutorial/launch/laser.launch
deleted file mode 100644
index 0a19978..0000000
--- a/librviz_tutorial/launch/laser.launch
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/librviz_tutorial/src/myviz.cpp b/librviz_tutorial/src/myviz.cpp
deleted file mode 100644
index e738d49..0000000
--- a/librviz_tutorial/src/myviz.cpp
+++ /dev/null
@@ -1,1005 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include "rviz/properties/property_tree_widget.h"
-#include "rviz/selection/selection_manager.h"
-#include "rviz/panel.h"
-
-#include "rviz/visualization_manager.h"
-#include"rviz/tool_manager.h"
-#include "rviz/render_panel.h"
-#include "rviz/display.h"
-
-#include "myviz.h"
-#include "../tools/color.h"
-#include "qthread.h"
-// BEGIN_TUTORIAL
-// Constructor for MyViz. This does most of the work of the class.
-MyViz::MyViz( QWidget* parent)
- : QWidget( parent )
-{
-
- nh=ros::NodeHandle("~");
- sub=nh.subscribe("/test",1000,&MyViz::subCallback,this);
- pub=nh.advertise("/test_pub",1000);
- pub_thread=std::thread(&MyViz::pubThread,this);
-
- // 全局变量存放处
- // 颜色名称,可添加,待设置rgb类型设置颜色
- color_name = {"white","red","green","black","blue","yellow","pink","purple","skyblue","lightgreen","orange",
- };
- // 颜色路径名
- color_icon_filename = QString("/home/wbw/Rviz/librviz_ws/src/librviz_tutorial/sources/images/%1.png");
- speed_name = {"2.0","1.5","1.25","1.0","0.75","0.5",};
- duration = 0;
- isclicked = true;
- ispauseclick = true;
- sliderreleased = false;
- playagain = false;
- isthreadplaying = false;
- abs = false;
- stored = false;
-
-
- // 网格结构
- QGridLayout* controls_layout = new QGridLayout();
- int ctl_index = 0;
-
- //select按钮
- QPushButton* selection_button = new QPushButton("select");
- QPushButton* move_camera_button = new QPushButton("move_camera");
-
- controls_layout->addWidget( move_camera_button, ctl_index, 0);
- controls_layout->addWidget( selection_button, ctl_index++ ,1);
-
- // offline 布局
- // QPushButton setting!////////////////////////////////////////////////////////////////////////////////////////////////
- QPushButton* play = new QPushButton("play", this);
- QPushButton* pause = new QPushButton("pause", this);
- QPushButton* but_save = new QPushButton("save", this);// buttonn: save one frame
- QPushButton* but_saveMul = new QPushButton("saveMul", this);// button: save multiple frames
- QPushButton* but_file = new QPushButton("file", this);// button: select file
-
- // QLabel setting!/////////////////////////////////////////////////////////////////////////////////////////////////////
- QLabel* label_speed = new QLabel("speed:");//speed combobox
- QLabel* label_split = new QLabel("");//speed combobox
-
- // QSlider setting!////////////////////////////////////////////////////////////////////////////////////////////////////
- progress = new QSlider(Qt::Horizontal);
- // QComboBox setting!//////////////////////////////////////////////////////////////////////////////////////////////////
- QComboBox * speed_combobox = new QComboBox();
- //enable button////////////////////////////////////////////////////////////////////////////////////////////////////////
- play->setEnabled(true);
- pause->setEnabled(true);
- but_save->setEnabled(true);
- but_saveMul->setEnabled(true);
- but_file->setEnabled(true);
-
- // setting button size!////////////////////////////////////////////////////////////////////////////////////////////////
- play->setFixedSize(100, 30);
- pause->setFixedSize(100, 30);
- but_save->setFixedSize(100, 30);
- but_saveMul->setFixedSize(100, 30);
- but_file->setFixedSize(100, 30);
-
- for(int i = 0; i < speed_name.size(); i++)
- speed_combobox->addItem(speed_name[i] + "x");
- speed_combobox->setCurrentIndex(3);
-
- controls_layout->addWidget( label_split, ctl_index++, 0 );
- controls_layout->addWidget( but_file, ctl_index, 0 );
- controls_layout->addWidget( but_save, ctl_index++, 1 );
- controls_layout->addWidget( but_saveMul, ctl_index++, 0 );
-
- controls_layout->addWidget(label_speed,ctl_index,0);
- controls_layout->addWidget(speed_combobox,ctl_index++,1);
-
- controls_layout->addWidget( play, ctl_index, 0 );
- controls_layout->addWidget( pause, ctl_index++, 1 );
- controls_layout->addWidget(progress,ctl_index++,0, 1, 2); // addwidget(widget,row,col,m,n);//m是占几行,n是占几列,
-
- controls_layout->setSpacing(5);
-
- // 是否选择显示坐标轴
- QLabel* label_axes = new QLabel("Display Axes:");
- QComboBox * axesBox = new QComboBox();
- axesBox->addItem("no");
- axesBox->addItem("yes");
-
- // 选择圆圈范围
- QLabel* label_circle = new QLabel("Circle Scale(m): ");
- QComboBox* circleBox = new QComboBox();
- circleBox->addItem("cancel");
- for(int i =1; i<=3 ;++i){
- circleBox->addItem(QString(std::to_string(i).c_str()));
- }
- circleBox->addItem("5");
-
- controls_layout->addWidget(label_axes, ctl_index,0);
- controls_layout->addWidget(axesBox, ctl_index++,1);
- controls_layout->addWidget(label_circle, ctl_index,0);
- controls_layout->addWidget(circleBox, ctl_index++,1);
-
- // 第二个layout
- QGridLayout* display_layout = new QGridLayout();
- int display_index = 0;
-
- // Tree 全局变量存放地方
- Tree_Display(display_layout, display_index++);
-
- // controls_layout->setRowStretch(3, 0);
- // Make signal/slot connections. 进行信号/插槽连接
-
- // 增加切换select
- connect(selection_button, SIGNAL(clicked()), this, SLOT( slot_select()));
- connect(move_camera_button, SIGNAL(clicked()), this, SLOT( slot_move_camera()));
-
-
- // 增加坐标变换
- connect(axesBox, SIGNAL(currentIndexChanged(int)), this, SLOT(AxesDisplayChanged(int)));
- // 增加圆圈变换
- connect(circleBox, SIGNAL(currentIndexChanged(int)), this, SLOT(CircleDisplayChanged(int)));
- //off
- connect(progress,&QSlider::valueChanged,this,[=](){// 变动会触发
- if(!ismoved){
- ischanged = true;// “戳”这一个动作会使ischange变成true
- // qDebug()<<"CLICK"<setSliderPosition(0);
- std::thread rosBagPlay(&MyViz::openFile, this);// 新开线程执行操作
- rosBagPlay.detach();
-
- }
- }
-
- });
- connect(pause, &QPushButton::clicked, this, [&]() {
- if(isthreadplaying){
- if(ispauseclick)
- {
- ispauseclick = false;
- }
- else
- {
- ispauseclick = true;
- }
- }
- });
-
- // Construct and lay out render panel.
- render_panel_ = new rviz::RenderPanel(); // RVIZ在QT上显示的类
- QHBoxLayout* main_layout = new QHBoxLayout; // 主要layout QV垂直,QH水平
-
- // QSplitter *splitter = new QSplitter();
- // main_layout->addWidget(splitter);
- // splitter->addWidget(render_panel_);
-
- // Next we initialize the main RViz classes.
- //
- // The VisualizationManager is the container for Display objects,
- // holds the main Ogre scene, holds the ViewController, etc. It is
- // very central and we will probably need one in every usage of
- // librviz.
- manager_ = new rviz::VisualizationManager( render_panel_ ); // 是实现rviz功能的类
- // 初始化camera 这行代码实现放大 缩小 平移等操作
- render_panel_->initialize( manager_->getSceneManager(), manager_ );
- // manager_->setFixedFrame("world");
- // 初始化tool_manager_
- tool_manager_ = manager_->getToolManager();
-
- manager_->initialize();
- manager_->startUpdate();
-
- // 创建select panel
- QLabel *select_label = new QLabel("Select Display:");
- tree_widget_ = new rviz::PropertyTreeWidget();
- tree_widget_->setModel(manager_->getSelectionManager()->getPropertyModel());
-
- display_layout->addWidget(select_label, display_index++, 0);
- display_layout->addWidget(tree_widget_, display_index++, 0);
-
- // 设置网格某一行伸缩比例,放最后一行
- // controls_layout->setRowStretch(--ctl_index, 6);
-
- // Create a Grid display.
- grid_ = manager_->createDisplay( "rviz/Grid", "adjustable grid", true );
- ROS_ASSERT( grid_ != NULL );
-
- // cloud = manager_->createDisplay( "rviz/PointCloud2", "point cloud", true );
- // ROS_ASSERT( cloud != NULL );
-
- laser_ = manager_->createDisplay( "rviz/LaserScan", "Qlaser", true );
- ROS_ASSERT( laser_ );
- // 新增雷达
- laser_->subProp("Topic")->setValue("/scan");
- laser_->subProp("Size (Pixels)")->setValue("2");
- laser_->subProp("Color Transformer")->setValue("FlatColor");
- // laser_->subProp("Color")->setValue(comboBox->currentText());
- // cloud->subProp("Topic")->setValue("/pose_graph/octree");
- // cloud->subProp("Style")->setValue("Points");
- // cloud->subProp("Size (Pixels)")->setValue("2");
- // cloud->subProp("Color Transformer")->setValue("Intensity");
- // cloud->subProp("Invert Rainbow")->setValue("true");
- // cloud->subProp("Decay Time")->setValue("1");
- // Configure the GridDisplay the way we like it.
- grid_->subProp( "Line Style" )->setValue( "Billboards" );
- grid_->subProp( "Color" )->setValue( QColor( Qt::white ) );
-
- // 新增坐标系
- axes_display= manager_->createDisplay("rviz/Axes", "Axes", false);
- ROS_ASSERT( axes_display != NULL );
- axes_display->subProp("Length")->setValue(5); // 设置透明度
- axes_display->subProp("Radius")->setValue(0.1); // 设置坐标系的缩放大小
-
- // 新增Marker_ 显示圆圈
- marker_ = manager_->createDisplay("rviz/Marker", "Marker", false);
- ROS_ASSERT( marker_ != NULL );
- marker_->subProp("Topic")->setValue("visualization_marker");
-
- // Set the top-level layout for this MyViz widget.
- main_layout->addLayout( controls_layout );
- main_layout->addLayout( display_layout );
- main_layout->addWidget( render_panel_,2); // 存放rviz的位置, stretch 拉伸系数
- setLayout( main_layout );
-
-}
-
-void MyViz::Tree_Display(QGridLayout* controls_layout, int index){
- QTreeWidget *menu = new QTreeWidget();
- // menu->setColumnCount(2);
- // 列头自适应大小
- menu->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
-
- menu->setHeaderLabels(QStringList()<<"key"<<"value");
- menu->setHeaderHidden(true);
- // menu->setColumnCount(2);
-
- // 设置不同层次菜单的缩进
- // menu->setIndentation(10);
- // global-一层树
- QTreeWidgetItem *global= new QTreeWidgetItem(menu, QStringList("全局变量"));
- menu->addTopLevelItem(global);
- global->setExpanded(true);
-
- // fix frame
- QTreeWidgetItem *fixed_frame = new QTreeWidgetItem(global, QStringList("Fixed Frame"));
-
- QLineEdit* fixed_frame_text = new QLineEdit();
- fixed_frame_text->setText("laser");
- fixed_frame_text->setStyleSheet("background:transparent;border-width:0;border-style:inset");
- // 设置事件
- connect(fixed_frame_text,SIGNAL(textChanged(const QString&)),this,SLOT(setFixedFrame(const QString&)));
- // 将其他控件(非TreeWidgetItem)放入treeItem中
- menu->setItemWidget(fixed_frame, 1, fixed_frame_text); // 将container 放到 Item ,数字为列数
-
- QTreeWidgetItem *bg_color = new QTreeWidgetItem(global, QStringList("BackGround Color"));
- QLineEdit* bg_color_text = new QLineEdit();
- bg_color_text->setText("48;48;48");
- bg_color_text->setStyleSheet("border-width:0;border-style:outset");
- connect(bg_color_text,SIGNAL(textChanged(const QString&)),this,SLOT(setBackgroundColor(const QString&)));
- menu->setItemWidget(bg_color, 1, bg_color_text); // 将container 放到 Item ,数字为列数
-
- // global->addChild(fixed_frame);
- // global->setTextAlignment(1, 2); // (列数,对齐方式)
- // grid - 一层树
- QTreeWidgetItem * grid = new QTreeWidgetItem(menu, QStringList("Grid"));
- // 二层
- QTreeWidgetItem *grid_color = new QTreeWidgetItem(grid, QStringList("Color"));
- QComboBox * grid_color_cbox = new QComboBox();
- for(int i =0 ; i < color_name.size(); ++i){
- QString color_path = color_icon_filename.arg(color_name[i]);
- QIcon color_icon(color_path);
- grid_color_cbox->addItem(color_icon, color_name[i]);
- }
- connect(grid_color_cbox, SIGNAL(currentIndexChanged(int)), this, SLOT(GridColorChanged(int)));
- menu->setItemWidget(grid_color, 1, grid_color_cbox);
-
- // grid cell size
- QTreeWidgetItem *grid_cell = new QTreeWidgetItem(grid, QStringList("Cell Size"));
- QSlider* cell_size_slider = new QSlider( Qt::Horizontal );
- cell_size_slider->setMinimum( 1 );
- cell_size_slider->setMaximum( 100 );
- connect( cell_size_slider, SIGNAL( valueChanged( int )), this, SLOT( setCellSize( int )));
- cell_size_slider->setValue( 1 );
- menu->setItemWidget(grid_cell, 1, cell_size_slider);
-
- // grid Line Thickness
- QTreeWidgetItem *grid_thickness = new QTreeWidgetItem(grid, QStringList("Line Thickness"));
- QSlider* thickness_slider = new QSlider( Qt::Horizontal );
- thickness_slider->setMinimum( 1 );
- thickness_slider->setMaximum( 100 );
- connect( thickness_slider, SIGNAL( valueChanged( int )), this, SLOT( setThickness( int )));
- thickness_slider->setValue( 5 );
- menu->setItemWidget(grid_thickness, 1, thickness_slider);
-
- // laser - 一层树
- QTreeWidgetItem * laser = new QTreeWidgetItem(menu, QStringList("Laser"));
- // 二层
- QTreeWidgetItem *laser_topic = new QTreeWidgetItem(laser, QStringList("Topic "));
- // Topic_Laser 输入雷达
- QLineEdit* laser_topic_text = new QLineEdit();
- // 增加雷达话题
- connect(laser_topic_text, SIGNAL(textChanged(const QString &)), this, SLOT(setLaserTopic(const QString &)));
- menu->setItemWidget(laser_topic, 1, laser_topic_text);
-
- // Laser size
- QTreeWidgetItem *laser_size = new QTreeWidgetItem(laser, QStringList("Size "));
- QSpinBox* laser_size_text=new QSpinBox();
- connect(laser_size_text,SIGNAL(valueChanged(int)),this,SLOT(setLaserSize(int)));
- menu->setItemWidget(laser_size, 1, laser_size_text);
-
- // Laser color
- QTreeWidgetItem *laser_color = new QTreeWidgetItem(laser, QStringList("Color "));
- QComboBox * comboBox = new QComboBox();
- for(int i =0 ; i < color_name.size(); ++i){
- QString color_path = color_icon_filename.arg(color_name[i]);
- QIcon color_icon(color_path);
- comboBox->addItem(color_icon, color_name[i]);
- }
- comboBox->setCurrentIndex(1);
- // 增加颜色变换
- connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LaserColorChanged(int)));
- menu->setItemWidget(laser_color, 1, comboBox);
-
-
- QTreeWidgetItem *item13 = new QTreeWidgetItem(global, QStringList("Frame rate"));
-
- QTreeWidgetItem *item22 = new QTreeWidgetItem(grid, QStringList("Line Style"));
- controls_layout->addWidget(menu, index, 0 );
-}
-
-void MyViz::PlayCircle(int index){
- int argc =0;
- char** argv;
- ros::init(argc, argv, "basic_shapes");
- ros::NodeHandle n;
- ros::Rate r(1);
- ros::Publisher marker_pub = n.advertise("visualization_marker", 1);
- uint32_t shape = visualization_msgs::Marker::LINE_STRIP;
-
- if (ros::ok())
- {
- visualization_msgs::Marker marker;
- // Set the frame ID and timestamp. See the TF tutorials for information on these.
- marker.header.frame_id = "laser";
- marker.header.stamp = ros::Time::now();
-
- // Set the namespace and id for this marker. This serves to create a unique ID
- // Any marker sent with the same namespace and id will overwrite the old one
- marker.ns = "basic_shapes";
- marker.id = 0;
-
- // Set the marker type. Initially this is CUBE, and cycles between that and SPHERE, ARROW, and CYLINDER
- marker.type = shape;
-
- // Set the marker action. Options are ADD, DELETE, and new in ROS Indigo: 3 (DELETEALL)
- marker.action = visualization_msgs::Marker::ADD;
-
- // Set the pose of the marker. This is a full 6DOF pose relative to the frame/time specified in the header
- marker.pose.position.x = 0;
- marker.pose.position.y = 0;
- marker.pose.position.z = 0;
- marker.pose.orientation.x = 0.0;
- marker.pose.orientation.y = 0.0;
- marker.pose.orientation.z = 0.0;
- marker.pose.orientation.w = 1.0;
-
- // Set the scale of the marker -- 1x1x1 here means 1m on a side
- // 设置线段的宽度
- marker.scale.x = 0.02;
- marker.scale.y = 1.0;
- marker.scale.z = 1.0;
-
- // Set the color -- be sure to set alpha to something non-zero!
- marker.color.r = 0.0f;
- marker.color.g = 1.0f;
- marker.color.b = 0.0f;
- marker.color.a = 1.0;
- // points
- // 绘制同心圆
- // double r_c= std::stod(argv[1]);
- double radius = index;
- int num_points = 360;
- // Create the vertices for the points and lines 画圆
- for (uint32_t i = 0; i < num_points; ++i)
- {
- // float y = sin(f + i / 100.0f * 2 * M_PI);
- // float z = cos(f + i / 100.0f * 2 * M_PI);
- double angle = 2 * M_PI * i / num_points;
- geometry_msgs::Point point;
- point.x = radius * cos(angle);
- point.y = radius * sin(angle);
- point.z = 0.0;
- marker.points.push_back(point);
- }
- marker.lifetime = ros::Duration();
-
- // Publish the marker
- while (marker_pub.getNumSubscribers() < 1)
- {
- if (!ros::ok())
- {
- std::cout<< "publish return 0" << std::endl;
- }
- ROS_WARN_ONCE("Please create a subscriber to the marker");
- // sleep(1);
- }
- marker_pub.publish(marker);
-
- r.sleep();
- }
-
-}
-
-void MyViz::CircleDisplayChanged(int index){
- if(index == 0){
- marker_->setValue(false);
- }else
- {
- manager_->setFixedFrame("laser");
-
- marker_->setValue(true);
- std::thread ThreadCircle(&MyViz::PlayCircle, this, index);// 新开线程执行操作
- ThreadCircle.detach();// 执行完成后自动回收资源
- }
-}
-
-void MyViz::AxesDisplayChanged(int index)
-{
- switch (index)
- {
- case 0: // "yes" 选项被选择
- if (axes_display != NULL)
- axes_display->setValue(false);
- break;
-
- case 1: // "no" 选项被选择
- if (axes_display != NULL)
- axes_display->setValue(true);
- break;
- }
-}
-
-void MyViz::slot_move_camera(){
- rviz::Tool* current_tool_= tool_manager_->getDefaultTool();
- tool_manager_->setCurrentTool(current_tool_);
- manager_->startUpdate();
-}
-
-
-void MyViz::slot_select(){
- // 获得工具类
- // tool_manager_ = manager_->getToolManager();
- rviz::Tool* current_tool_ = tool_manager_->addTool("rviz/Select");
- tool_manager_->setCurrentTool(current_tool_);
- manager_->startUpdate();
-}
-
-void MyViz::setBackgroundColor(const QString& color_string){
- if(manager_!=NULL){
- const QString t = color_string;
- QColor new_color = parseColor(t);
- if(new_color.isValid()){
- // rviz源码中修改背景颜色的方式
- render_panel_->setBackgroundColor(qtToOgre(new_color));
- manager_->queueRender();
- }
- else
- {
- ROS_INFO_STREAM("Color invalid !!!");
- }
- }else{
- ROS_INFO_STREAM("manager_ failed !!!");
- }
-}
-
-
-void MyViz::LaserColorChanged(int index){
- if(laser_!=NULL) laser_->subProp("Color")->setValue(color_name[index]);
-
-}
-
-void MyViz::GridColorChanged(int index){
- if(grid_!=NULL) grid_->subProp("Color")->setValue(color_name[index]);
-}
-
-// Destructor.
-MyViz::~MyViz()
-{
- delete manager_;
-}
-
-// This function is a Qt slot connected to a QSlider's valueChanged()
-// signal. It sets the line thickness of the grid by changing the
-// grid's "Line Width" property.
-void MyViz::setThickness( int thickness_percent )
-{
- if( grid_ != NULL )
- {
- grid_->subProp( "Line Style" )->subProp( "Line Width" )->setValue( thickness_percent / 100.0f );
- }
-}
-
-// This function is a Qt slot connected to a QSlider's valueChanged()
-// signal. It sets the cell size of the grid by changing the grid's
-// "Cell Size" Property.
-void MyViz::setCellSize( int cell_size_percent )
-{
- if( grid_ != NULL )
- {
- grid_->subProp( "Cell Size" )->setValue( cell_size_percent / 10.0f );
- }
-}
-
-void MyViz::setCloudTopic(const QString &newTopic){
- if(cloud!=NULL){
- cloud->subProp( "Topic" )->setValue(newTopic);
- //ROS_INFO_STREAM("cloud topic changed to => "<subProp( "Topic" )->setValue(newTopic);
- ROS_INFO_STREAM("laser topic changed to => "<setEnabled(true);
- // laser->subProp( "Color" )->setValue( QColor( Qt::yellow ) );
- manager_->setFixedFrame("laser");
- manager_->startUpdate();
-}
-
-void MyViz::setFixedFrame(const QString & fix_frame){
- manager_->setFixedFrame(fix_frame);
- manager_->startUpdate();
-}
-
-void MyViz::setCloudSize(int cloudsize){
- if(cloud!=NULL){
- cloud->subProp("Size (Pixels)")->setValue(cloudsize);
- }
-}
-
-void MyViz::setLaserSize(int lasersize){
- if(laser_!=NULL){
- laser_->subProp("Size (Pixels)")->setValue(lasersize);
- }
-}
-
-void MyViz::subCallback(const std_msgs::String& msg){
- ROS_INFO_STREAM("receive message!");
-}
-
-void MyViz::pubThread(){
- while(ros::ok()){
- ROS_INFO_STREAM_ONCE("here is in publish process!");
- }
-}
-
-
-void MyViz::openFile()
-{
- ros::Rate r(10.0);
- rosbag::Bag bag,newBag;
- std::string pcdFilePathStr = filePath.toStdString();
- int frameEnd;
- int frameStart;
- bool saveFlag = false;
- if(stored)
- {
- char** argv;// 字符串内容(输入)
- int argc=0;// 字符串个数(输入)
- countbag = 0;
- ros::init(argc, argv, "laser_scan_publisher");// "laser"???????????重新启动一下roscore可以解决
- // qDebug()<<"11111";
-
- ros::NodeHandle n;
- scan_pub = n.advertise("scan", 5);// "topic"
- // sleep time
-
- bag.open(pcdFilePathStr, rosbag::bagmode::Read);
-
- rosbag::View view1(bag, rosbag::TopicQuery("/scan"));
- view = &view1;
- std::cout<size()<begin(); it != view->end(); ++it)// 用于预先存储bag包的信息
- {
- auto m = *it;
- sensor_msgs::LaserScan::ConstPtr input = m.instantiate();
- indx.push_back(input);
- }
- stored = false;
- indxsize = indx.size();
- bag.close();
- qDebug()<=indxsize)
- {
- scan_pub.publish(*indx[indxsize-1]);
- end = true;// 停在当前位置
- countbag = 0;// 从头开始
- qDebug()<<"publish end";
- }
- // progressmove = false;
-
- if(is_rateChanged){
- qDebug() << QString::number(speed_rate);
- r = ros::Rate(speed_rate);
- r.reset();
- is_rateChanged = false;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- if(is_save){
- if(newBag.isOpen())
- newBag.close();
- std::string temFileStr = pcdFilePathStr;
- temFileStr.resize(pcdFilePathStr.length() - 4);
- std::string saveFilePathStr = temFileStr + "frame" \
- + std::to_string(countbag) + ".bag";
- std::cout << saveFilePathStr;
- std::ifstream file(saveFilePathStr.c_str());
- if (!file.good()) {
- // std::ofstream outputFile(saveFilePathStr); //create a file
- // outputFile.close();
-
- QFile newFile(QString::fromStdString(saveFilePathStr));
-
- newBag.open(saveFilePathStr, rosbag::bagmode::Write);
- // for(int i=0;i<10;i++){
- newBag.write("/scan", ros::Time::now(), indx[countbag]);
- // }
- newBag.close();
- }else{
- // file exist
- }
-
- is_save = false;
- r.sleep();
- countbag++;
- continue;
- }
- if(is_saveMul || is_saveMulFinish){
- if(ispauseclick && is_saveMul)
- {
- is_saveMul = false;
- QMessageBox msgBox;
- msgBox.setWindowTitle("Tips");
- msgBox.setText("Pause First Please!");
- msgBox.resize(2000, 1000);
- msgBox.exec();
- continue;
- }
-
- if(is_saveMulFinish){
- frameEnd = countbag;
- std::string temFileStr = pcdFilePathStr;
- temFileStr.resize(pcdFilePathStr.length() - 4);
- std::string saveFilePathStr = temFileStr + "frame" \
- + std::to_string(frameStart) + "to" + std::to_string(frameEnd) + ".bag";
- std::cout << saveFilePathStr;
- std::ifstream file(saveFilePathStr.c_str());
- if (!file.good()) {
-
-
- newBag.open(saveFilePathStr, rosbag::bagmode::Write);
-
-
- for(int i = frameStart; i < frameEnd; i++){
-
- newBag.write("/scan", ros::Time::now(), indx[i]);
-
-
- }
- is_saveMulFinish = false;
- is_saveMul = false;
- saveFlag = false;
- newBag.close();
- }else{
-
- }
- }
- else{
- qDebug()<setSliderPosition(ceil(countbag/indxsize*100));
- qDebug()<value()/100)*indxsize;
- double valuedouble = progress->value();
- countbag = round((valuedouble/100)*indxsize);
- if(countbag >= indxsize)// 直接重新开始for循环
- {
- countbag = indxsize-1;
- progress->setSliderPosition(100);
- ispauseclick = false;
- }
- ismoved = false;
- }
- else if(ischanged)// 手戳动时改变进度条
- {
- end = false;
- int value = (progress->value()/100)*indxsize;
- double valuedouble = progress->value();
- countbag = round((valuedouble/100)*indxsize);
- if(countbag >= indxsize)// 直接重新开始for循环
- {
- countbag = indxsize-1;
- progress->setSliderPosition(100);
- ispauseclick = false;
- }
- scan_pub.publish(*indx[countbag]);
- countbag++;
- ischanged = false;
- r.sleep();
- continue;
- // ismoved = false;
- }
- if(!ispauseclick || end)
- {
- qDebug()<<"pause";
- if(countbagsliderPosition()<=100 && countbagvalue/indxsize*100<=100)
- {
- qDebug()<<"pause";
- progress->setSliderPosition(ceil(countbagvalue/indxsize*100));
- qDebug()<setSliderPosition(0);
- isthreadplaying = false;
- playagain = false;
- filePath = QFileDialog::getOpenFileName(nullptr, "select file", "/home", "bag(*.bag);;所有文件 (*)");
- qDebug()<< filePath;
- if(filePath.isEmpty()){
- QMessageBox msgBox;
- msgBox.setWindowTitle("Tips");
- msgBox.setText("No file is selected");
- msgBox.resize(2000, 1000);
- // 设置样式表,包括透明度设置
- msgBox.setStyleSheet("QMessageBox {"
- "background-color: rgba(255, 255, 255, 0.9);" // 设置背景颜色和透明度
- "border: 2px solid rgba(0, 0, 0, 0.9);" // 设置边框颜色和透明度
- "}"
- "QLabel {"
- "color: rgba(0, 0, 0, 0.9);" // 设置文本颜色和透明度
- "font-size: 16px;"
- "}");
- QTimer selectTimer;
- selectTimer.setSingleShot(true); // 设置定时器只触发一次
- selectTimer.start(2000); // 3秒后触发定时器,单位是毫秒
-
- //连接定时器的超时信号到关闭消息框的槽函数
- QObject::connect(&selectTimer, &QTimer::timeout, [&]() {
- msgBox.done(QMessageBox::Ok); // 关闭消息框
- });
- msgBox.exec();
- }else{
-
- QMessageBox msgBox;
- msgBox.setWindowTitle("Tips");
- msgBox.setText("File selected");
- msgBox.resize(2000, 1000);
- // 设置样式表,包括透明度设置
- msgBox.setStyleSheet("QMessageBox {"
- "background-color: rgba(255, 255, 255, 0.9);" // 设置背景颜色和透明度
- "border: 2px solid rgba(0, 0, 0, 0.9);" // 设置边框颜色和透明度
- "}"
- "QLabel {"
- "color: rgba(0, 0, 0, 0.9);" // 设置文本颜色和透明度
- "font-size: 16px;"
- "}");
- QTimer selectTimer;
- selectTimer.setSingleShot(true); // 设置定时器只触发一次
- selectTimer.start(2000); // 3秒后触发定时器,单位是毫秒
-
- //连接定时器的超时信号到关闭消息框的槽函数
- QObject::connect(&selectTimer, &QTimer::timeout, [&]() {
- msgBox.done(QMessageBox::Ok); // 关闭消息框
- });
- msgBox.exec();
- isthreadplaying = true;
- }
-}
-
-
-void MyViz::SpeedChanged(int index){
- // if(isthreadplaying)
- bool ok;
- double number = speed_name[index].toDouble(&ok);
- if(ok){
- speed_rate = 10.0 * number;
- qDebug() << "*************func test" << QString::number(speed_rate);
- is_rateChanged = true;
- }
-
- else{
- qDebug() << "failed";
- }
-}
\ No newline at end of file
diff --git a/librviz_tutorial/CHANGELOG.rst b/point_visual/CHANGELOG.rst
similarity index 100%
rename from librviz_tutorial/CHANGELOG.rst
rename to point_visual/CHANGELOG.rst
diff --git a/librviz_tutorial/CMakeLists.txt b/point_visual/CMakeLists.txt
similarity index 81%
rename from librviz_tutorial/CMakeLists.txt
rename to point_visual/CMakeLists.txt
index 5077048..d3a9c55 100644
--- a/librviz_tutorial/CMakeLists.txt
+++ b/point_visual/CMakeLists.txt
@@ -4,7 +4,7 @@
##
## First start with some standard catkin stuff.
cmake_minimum_required(VERSION 3.0.2)
-project(librviz_tutorial)
+project(point_visual)
set(SDK_PATH "./sdk/")
@@ -17,7 +17,15 @@ FILE(GLOB SDK_SRC
find_package(catkin REQUIRED COMPONENTS
rviz roscpp std_msgs
rosconsole sensor_msgs # node.cpp
-rosbag
+rosbag
+pcl_ros
+)
+
+find_package(PCL REQUIRED)
+include_directories(
+ include
+ ${catkin_INCLUDE_DIRS}
+ /usr/include/pcl-1.8
)
@@ -58,6 +66,7 @@ set(SRC_FILES
src/myviz.cpp
src/main.cpp
tools/color.cpp
+ src/loginDialog.cpp
)
## Add the "myviz" executable and specify the list of source files we
@@ -67,9 +76,9 @@ set(SRC_FILES
add_executable(myviz ${SRC_FILES} )
-add_executable(rplidarNode src/node.cpp ${SDK_SRC}) # 创建启动laser
-target_link_libraries(rplidarNode ${catkin_LIBRARIES})
-
+# add_executable(rplidarNode src/node.cpp ${SDK_SRC}) # 创建启动laser
+# target_link_libraries(rplidarNode ${catkin_LIBRARIES})
+target_link_libraries(myviz -lcrypto)
## Link the myviz executable with whatever Qt libraries have been defined by
@@ -84,11 +93,11 @@ target_link_libraries(myviz ${QT_LIBRARIES} ${catkin_LIBRARIES})
## Install
install(TARGETS myviz DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
-install(TARGETS rplidarNode
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)
+# install(TARGETS rplidarNode
+# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+# )
install(DIRECTORY launch sdk
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
diff --git a/point_visual/launch/laser.launch b/point_visual/launch/laser.launch
new file mode 100644
index 0000000..425c158
--- /dev/null
+++ b/point_visual/launch/laser.launch
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/librviz_tutorial/launch/rplidar.launch b/point_visual/launch/rplidar.launch
similarity index 81%
rename from librviz_tutorial/launch/rplidar.launch
rename to point_visual/launch/rplidar.launch
index 0b2c7e2..1c88615 100644
--- a/librviz_tutorial/launch/rplidar.launch
+++ b/point_visual/launch/rplidar.launch
@@ -1,5 +1,5 @@
-
+
diff --git a/librviz_tutorial/package.xml b/point_visual/package.xml
similarity index 96%
rename from librviz_tutorial/package.xml
rename to point_visual/package.xml
index b6183b9..a1961ef 100644
--- a/librviz_tutorial/package.xml
+++ b/point_visual/package.xml
@@ -1,5 +1,5 @@
- librviz_tutorial
+ point_visual
0.11.0
Tutorial showing how to compile your own C++ program with RViz displays and features.
diff --git a/librviz_tutorial/rosdoc.yaml b/point_visual/rosdoc.yaml
similarity index 100%
rename from librviz_tutorial/rosdoc.yaml
rename to point_visual/rosdoc.yaml
diff --git a/librviz_tutorial/sdk/README.txt b/point_visual/sdk/README.txt
similarity index 100%
rename from librviz_tutorial/sdk/README.txt
rename to point_visual/sdk/README.txt
diff --git a/librviz_tutorial/sdk/include/rplidar.h b/point_visual/sdk/include/rplidar.h
similarity index 100%
rename from librviz_tutorial/sdk/include/rplidar.h
rename to point_visual/sdk/include/rplidar.h
diff --git a/librviz_tutorial/sdk/include/rplidar_cmd.h b/point_visual/sdk/include/rplidar_cmd.h
similarity index 100%
rename from librviz_tutorial/sdk/include/rplidar_cmd.h
rename to point_visual/sdk/include/rplidar_cmd.h
diff --git a/librviz_tutorial/sdk/include/rplidar_driver.h b/point_visual/sdk/include/rplidar_driver.h
similarity index 100%
rename from librviz_tutorial/sdk/include/rplidar_driver.h
rename to point_visual/sdk/include/rplidar_driver.h
diff --git a/librviz_tutorial/sdk/include/rplidar_protocol.h b/point_visual/sdk/include/rplidar_protocol.h
similarity index 100%
rename from librviz_tutorial/sdk/include/rplidar_protocol.h
rename to point_visual/sdk/include/rplidar_protocol.h
diff --git a/librviz_tutorial/sdk/include/rptypes.h b/point_visual/sdk/include/rptypes.h
similarity index 100%
rename from librviz_tutorial/sdk/include/rptypes.h
rename to point_visual/sdk/include/rptypes.h
diff --git a/librviz_tutorial/sdk/src/arch/linux/arch_linux.h b/point_visual/sdk/src/arch/linux/arch_linux.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/arch_linux.h
rename to point_visual/sdk/src/arch/linux/arch_linux.h
diff --git a/librviz_tutorial/sdk/src/arch/linux/net_serial.cpp b/point_visual/sdk/src/arch/linux/net_serial.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/net_serial.cpp
rename to point_visual/sdk/src/arch/linux/net_serial.cpp
diff --git a/librviz_tutorial/sdk/src/arch/linux/net_serial.h b/point_visual/sdk/src/arch/linux/net_serial.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/net_serial.h
rename to point_visual/sdk/src/arch/linux/net_serial.h
diff --git a/librviz_tutorial/sdk/src/arch/linux/net_socket.cpp b/point_visual/sdk/src/arch/linux/net_socket.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/net_socket.cpp
rename to point_visual/sdk/src/arch/linux/net_socket.cpp
diff --git a/librviz_tutorial/sdk/src/arch/linux/thread.hpp b/point_visual/sdk/src/arch/linux/thread.hpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/thread.hpp
rename to point_visual/sdk/src/arch/linux/thread.hpp
diff --git a/librviz_tutorial/sdk/src/arch/linux/timer.cpp b/point_visual/sdk/src/arch/linux/timer.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/timer.cpp
rename to point_visual/sdk/src/arch/linux/timer.cpp
diff --git a/librviz_tutorial/sdk/src/arch/linux/timer.h b/point_visual/sdk/src/arch/linux/timer.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/linux/timer.h
rename to point_visual/sdk/src/arch/linux/timer.h
diff --git a/librviz_tutorial/sdk/src/arch/macOS/arch_macOS.h b/point_visual/sdk/src/arch/macOS/arch_macOS.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/arch_macOS.h
rename to point_visual/sdk/src/arch/macOS/arch_macOS.h
diff --git a/librviz_tutorial/sdk/src/arch/macOS/net_serial.cpp b/point_visual/sdk/src/arch/macOS/net_serial.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/net_serial.cpp
rename to point_visual/sdk/src/arch/macOS/net_serial.cpp
diff --git a/librviz_tutorial/sdk/src/arch/macOS/net_serial.h b/point_visual/sdk/src/arch/macOS/net_serial.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/net_serial.h
rename to point_visual/sdk/src/arch/macOS/net_serial.h
diff --git a/librviz_tutorial/sdk/src/arch/macOS/net_socket.cpp b/point_visual/sdk/src/arch/macOS/net_socket.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/net_socket.cpp
rename to point_visual/sdk/src/arch/macOS/net_socket.cpp
diff --git a/librviz_tutorial/sdk/src/arch/macOS/thread.hpp b/point_visual/sdk/src/arch/macOS/thread.hpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/thread.hpp
rename to point_visual/sdk/src/arch/macOS/thread.hpp
diff --git a/librviz_tutorial/sdk/src/arch/macOS/timer.cpp b/point_visual/sdk/src/arch/macOS/timer.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/timer.cpp
rename to point_visual/sdk/src/arch/macOS/timer.cpp
diff --git a/librviz_tutorial/sdk/src/arch/macOS/timer.h b/point_visual/sdk/src/arch/macOS/timer.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/macOS/timer.h
rename to point_visual/sdk/src/arch/macOS/timer.h
diff --git a/librviz_tutorial/sdk/src/arch/win32/arch_win32.h b/point_visual/sdk/src/arch/win32/arch_win32.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/arch_win32.h
rename to point_visual/sdk/src/arch/win32/arch_win32.h
diff --git a/librviz_tutorial/sdk/src/arch/win32/net_serial.cpp b/point_visual/sdk/src/arch/win32/net_serial.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/net_serial.cpp
rename to point_visual/sdk/src/arch/win32/net_serial.cpp
diff --git a/librviz_tutorial/sdk/src/arch/win32/net_serial.h b/point_visual/sdk/src/arch/win32/net_serial.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/net_serial.h
rename to point_visual/sdk/src/arch/win32/net_serial.h
diff --git a/librviz_tutorial/sdk/src/arch/win32/net_socket.cpp b/point_visual/sdk/src/arch/win32/net_socket.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/net_socket.cpp
rename to point_visual/sdk/src/arch/win32/net_socket.cpp
diff --git a/librviz_tutorial/sdk/src/arch/win32/timer.cpp b/point_visual/sdk/src/arch/win32/timer.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/timer.cpp
rename to point_visual/sdk/src/arch/win32/timer.cpp
diff --git a/librviz_tutorial/sdk/src/arch/win32/timer.h b/point_visual/sdk/src/arch/win32/timer.h
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/timer.h
rename to point_visual/sdk/src/arch/win32/timer.h
diff --git a/librviz_tutorial/sdk/src/arch/win32/winthread.hpp b/point_visual/sdk/src/arch/win32/winthread.hpp
similarity index 100%
rename from librviz_tutorial/sdk/src/arch/win32/winthread.hpp
rename to point_visual/sdk/src/arch/win32/winthread.hpp
diff --git a/librviz_tutorial/sdk/src/hal/abs_rxtx.h b/point_visual/sdk/src/hal/abs_rxtx.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/abs_rxtx.h
rename to point_visual/sdk/src/hal/abs_rxtx.h
diff --git a/librviz_tutorial/sdk/src/hal/assert.h b/point_visual/sdk/src/hal/assert.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/assert.h
rename to point_visual/sdk/src/hal/assert.h
diff --git a/librviz_tutorial/sdk/src/hal/byteops.h b/point_visual/sdk/src/hal/byteops.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/byteops.h
rename to point_visual/sdk/src/hal/byteops.h
diff --git a/librviz_tutorial/sdk/src/hal/event.h b/point_visual/sdk/src/hal/event.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/event.h
rename to point_visual/sdk/src/hal/event.h
diff --git a/librviz_tutorial/sdk/src/hal/locker.h b/point_visual/sdk/src/hal/locker.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/locker.h
rename to point_visual/sdk/src/hal/locker.h
diff --git a/librviz_tutorial/sdk/src/hal/socket.h b/point_visual/sdk/src/hal/socket.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/socket.h
rename to point_visual/sdk/src/hal/socket.h
diff --git a/librviz_tutorial/sdk/src/hal/thread.cpp b/point_visual/sdk/src/hal/thread.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/thread.cpp
rename to point_visual/sdk/src/hal/thread.cpp
diff --git a/librviz_tutorial/sdk/src/hal/thread.h b/point_visual/sdk/src/hal/thread.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/thread.h
rename to point_visual/sdk/src/hal/thread.h
diff --git a/librviz_tutorial/sdk/src/hal/types.h b/point_visual/sdk/src/hal/types.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/types.h
rename to point_visual/sdk/src/hal/types.h
diff --git a/librviz_tutorial/sdk/src/hal/util.h b/point_visual/sdk/src/hal/util.h
similarity index 100%
rename from librviz_tutorial/sdk/src/hal/util.h
rename to point_visual/sdk/src/hal/util.h
diff --git a/librviz_tutorial/sdk/src/rplidar_driver.cpp b/point_visual/sdk/src/rplidar_driver.cpp
similarity index 100%
rename from librviz_tutorial/sdk/src/rplidar_driver.cpp
rename to point_visual/sdk/src/rplidar_driver.cpp
diff --git a/librviz_tutorial/sdk/src/rplidar_driver_TCP.h b/point_visual/sdk/src/rplidar_driver_TCP.h
similarity index 100%
rename from librviz_tutorial/sdk/src/rplidar_driver_TCP.h
rename to point_visual/sdk/src/rplidar_driver_TCP.h
diff --git a/librviz_tutorial/sdk/src/rplidar_driver_impl.h b/point_visual/sdk/src/rplidar_driver_impl.h
similarity index 100%
rename from librviz_tutorial/sdk/src/rplidar_driver_impl.h
rename to point_visual/sdk/src/rplidar_driver_impl.h
diff --git a/librviz_tutorial/sdk/src/rplidar_driver_serial.h b/point_visual/sdk/src/rplidar_driver_serial.h
similarity index 100%
rename from librviz_tutorial/sdk/src/rplidar_driver_serial.h
rename to point_visual/sdk/src/rplidar_driver_serial.h
diff --git a/librviz_tutorial/sdk/src/sdkcommon.h b/point_visual/sdk/src/sdkcommon.h
similarity index 100%
rename from librviz_tutorial/sdk/src/sdkcommon.h
rename to point_visual/sdk/src/sdkcommon.h
diff --git a/point_visual/sources/images/button/approach.png b/point_visual/sources/images/button/approach.png
new file mode 100644
index 0000000..910bda2
Binary files /dev/null and b/point_visual/sources/images/button/approach.png differ
diff --git a/point_visual/sources/images/button/back.png b/point_visual/sources/images/button/back.png
new file mode 100644
index 0000000..9e89b4f
Binary files /dev/null and b/point_visual/sources/images/button/back.png differ
diff --git a/point_visual/sources/images/button/pause.png b/point_visual/sources/images/button/pause.png
new file mode 100644
index 0000000..a18c404
Binary files /dev/null and b/point_visual/sources/images/button/pause.png differ
diff --git a/point_visual/sources/images/button/play.png b/point_visual/sources/images/button/play.png
new file mode 100644
index 0000000..1e3cd8d
Binary files /dev/null and b/point_visual/sources/images/button/play.png differ
diff --git a/librviz_tutorial/sources/images/black.png b/point_visual/sources/images/color/black.png
similarity index 100%
rename from librviz_tutorial/sources/images/black.png
rename to point_visual/sources/images/color/black.png
diff --git a/librviz_tutorial/sources/images/blue.png b/point_visual/sources/images/color/blue.png
similarity index 100%
rename from librviz_tutorial/sources/images/blue.png
rename to point_visual/sources/images/color/blue.png
diff --git a/librviz_tutorial/sources/images/green.png b/point_visual/sources/images/color/green.png
similarity index 100%
rename from librviz_tutorial/sources/images/green.png
rename to point_visual/sources/images/color/green.png
diff --git a/librviz_tutorial/sources/images/lightgreen.png b/point_visual/sources/images/color/lightgreen.png
similarity index 100%
rename from librviz_tutorial/sources/images/lightgreen.png
rename to point_visual/sources/images/color/lightgreen.png
diff --git a/librviz_tutorial/sources/images/orange.png b/point_visual/sources/images/color/orange.png
similarity index 100%
rename from librviz_tutorial/sources/images/orange.png
rename to point_visual/sources/images/color/orange.png
diff --git a/librviz_tutorial/sources/images/pink.png b/point_visual/sources/images/color/pink.png
similarity index 100%
rename from librviz_tutorial/sources/images/pink.png
rename to point_visual/sources/images/color/pink.png
diff --git a/librviz_tutorial/sources/images/purple.png b/point_visual/sources/images/color/purple.png
similarity index 100%
rename from librviz_tutorial/sources/images/purple.png
rename to point_visual/sources/images/color/purple.png
diff --git a/librviz_tutorial/sources/images/red.png b/point_visual/sources/images/color/red.png
similarity index 100%
rename from librviz_tutorial/sources/images/red.png
rename to point_visual/sources/images/color/red.png
diff --git a/librviz_tutorial/sources/images/skyblue.png b/point_visual/sources/images/color/skyblue.png
similarity index 100%
rename from librviz_tutorial/sources/images/skyblue.png
rename to point_visual/sources/images/color/skyblue.png
diff --git a/librviz_tutorial/sources/images/white.png b/point_visual/sources/images/color/white.png
similarity index 100%
rename from librviz_tutorial/sources/images/white.png
rename to point_visual/sources/images/color/white.png
diff --git a/librviz_tutorial/sources/images/yellow.png b/point_visual/sources/images/color/yellow.png
similarity index 100%
rename from librviz_tutorial/sources/images/yellow.png
rename to point_visual/sources/images/color/yellow.png
diff --git a/point_visual/sources/user/input.txt b/point_visual/sources/user/input.txt
new file mode 100644
index 0000000..3244982
--- /dev/null
+++ b/point_visual/sources/user/input.txt
@@ -0,0 +1,5 @@
+root 123!@
+wbw 1234
+
+## 待删除,保存原始用户密码
+##
diff --git a/point_visual/sources/user/user.txt b/point_visual/sources/user/user.txt
new file mode 100644
index 0000000..2e613e6
--- /dev/null
+++ b/point_visual/sources/user/user.txt
@@ -0,0 +1,2 @@
+root p�������w�:��R�wH�pD��#���6
+wbw �gB��\v���U�g�6#ȳ��E��x��F�
diff --git a/librviz_tutorial/src/doc/conf.py b/point_visual/src/doc/conf.py
similarity index 100%
rename from librviz_tutorial/src/doc/conf.py
rename to point_visual/src/doc/conf.py
diff --git a/librviz_tutorial/src/doc/index.rst b/point_visual/src/doc/index.rst
similarity index 100%
rename from librviz_tutorial/src/doc/index.rst
rename to point_visual/src/doc/index.rst
diff --git a/librviz_tutorial/src/doc/myviz.png b/point_visual/src/doc/myviz.png
similarity index 100%
rename from librviz_tutorial/src/doc/myviz.png
rename to point_visual/src/doc/myviz.png
diff --git a/librviz_tutorial/src/doc/tutorialformatter.py b/point_visual/src/doc/tutorialformatter.py
similarity index 100%
rename from librviz_tutorial/src/doc/tutorialformatter.py
rename to point_visual/src/doc/tutorialformatter.py
diff --git a/point_visual/src/loginDialog.cpp b/point_visual/src/loginDialog.cpp
new file mode 100644
index 0000000..1e50af6
--- /dev/null
+++ b/point_visual/src/loginDialog.cpp
@@ -0,0 +1,181 @@
+#include "loginDialog.h"
+
+#include
+#include
+#include
+#include
+
+#include
+
+LoginDialog::LoginDialog(QWidget *parent):QDialog(parent)
+{
+
+ this->setFixedSize(380, 300);
+ userLabel = new QLabel(this);
+ userLabel->move(70, 80);
+ userLabel->setText(tr("用户名"));
+
+ userEditLine = new QLineEdit(this);
+ userEditLine->move(150, 80);
+ userEditLine->setPlaceholderText(tr("请输入用户名"));
+
+ pwdLabel = new QLabel(this);
+ pwdLabel->move(70, 130);
+ pwdLabel->setText(tr("密码"));
+
+ pwdEditLine = new QLineEdit(this);
+ pwdEditLine->move(150, 130);
+ pwdEditLine->setPlaceholderText(tr("请输入密码"));
+ pwdEditLine->setEchoMode(QLineEdit::Password);
+
+ loginBtn = new QPushButton(this);
+ loginBtn->move(60, 200);
+ loginBtn->setText(tr("登录"));
+
+ exitBtn = new QPushButton(this);
+ exitBtn->move(220, 200);
+ exitBtn->setText(tr("退出"));
+
+ connect(loginBtn, &QPushButton::clicked, this, &LoginDialog::login);
+ connect(exitBtn, &QPushButton::clicked, this, &LoginDialog::close);
+
+ // 待解锁的组件名称
+ setting_name = {"cloud_topic", "laser_topic", "open_file", "bag_progress", "fixd_frame_topic"};
+ // 账号路径
+ user_file_name = "../PointVisual/src/point_visual/sources/user/user.txt";
+
+ // 创建用户表存下
+ createUser();
+ // userPasswords["root"] = hashPassword("root123");
+ // userPasswords["wbw"] = hashPassword("123");
+}
+
+
+void LoginDialog::createUser(){
+ std::ifstream inputFile(user_file_name);
+ // 第一次读写user.txt将user加密后,建立userPasswords
+ if(inputFile.is_open()){
+ std::string line;
+ while(std::getline(inputFile, line)){
+ std::istringstream iss(line);
+ std::string username, pwd;
+ if(iss>> username && iss>> pwd){
+ if(pwd.size() <= 8){
+ // 根据长度判断是否已经被加密
+ pwd = hashPassword(pwd);
+ }
+ // 创建map/用户表
+ userPasswords[QString::fromStdString(username)] = QString::fromStdString(pwd);
+ }
+ }
+ inputFile.close();
+ }else{
+ qDebug() << "Unable to open the user.txt.";
+ }
+ writeHash(userPasswords);
+}
+
+// 加密后的账户密码写入user.txt
+void LoginDialog::writeHash(const std::map user){
+ std::ofstream file(user_file_name);
+
+ if(file.is_open()){
+ for(auto iter = user.begin(); iter != user.end() ; iter++){
+ file << (iter->first).toStdString() << " ";
+ file << (iter->second).toStdString() << std::endl;
+ }
+ file.close();
+ }else{
+ qDebug()<<"Unable to write hashcode!!!";
+ }
+}
+
+
+// hash加密函数
+QString LoginDialog::hashPassword(const QString& pwd) {
+ std::string password = pwd.toStdString();
+ unsigned char hash[SHA256_DIGEST_LENGTH];
+ SHA256_CTX sha256;
+ SHA256_Init(&sha256);
+ SHA256_Update(&sha256, password.c_str(), password.size());
+ SHA256_Final(hash, &sha256);
+
+ std::string hashedPassword;
+ for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
+ hashedPassword += hash[i];
+ }
+ return QString(hashedPassword.c_str());
+}
+
+// 重载加密函数
+std::string LoginDialog::hashPassword(const std::string& password) {
+ // std::string password = pwd.toStdString();
+ unsigned char hash[SHA256_DIGEST_LENGTH];
+ SHA256_CTX sha256;
+ SHA256_Init(&sha256);
+ SHA256_Update(&sha256, password.c_str(), password.size());
+ SHA256_Final(hash, &sha256);
+
+ std::string hashedPassword;
+ for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
+ hashedPassword += hash[i];
+ }
+ return hashedPassword;
+}
+
+
+// 判断用户账号返回不同code
+int LoginDialog::checkUser(const QString username, const QString pwd){
+ auto iter = userPasswords.find(username);
+ if(iter != userPasswords.end()){
+ if(pwd.size() > 8) { return 1; }
+ if(iter->second == hashPassword(pwd)){
+ // 用户密码都对
+ return 2;
+ }else{
+ // 用户对,密码不对
+ return 1;
+ }
+ }else {
+ // 用户不对
+ return 0;
+ }
+}
+
+// 槽函数
+void LoginDialog::login()
+{
+ int flag = checkUser(userEditLine->text().trimmed(), pwdEditLine->text());
+ switch(flag){
+ case 0: {
+ QMessageBox::warning(this, tr("登录失败"), tr("用户名错误"), QMessageBox::Ok);
+ break;
+ }
+ case 1: {
+ QMessageBox::warning(this, tr("登录失败"), tr("密码错误"), QMessageBox::Ok);
+ break;
+ }
+ case 2:{
+ for(int i=0 ; ifindChild(setting_name[i]);
+ if (foundChild) {
+ // 找到了指定的子组件 在这里可以对子组件进行操作
+ foundChild->setEnabled(true);
+ }else{
+ qDebug()<<"第" << i+1 <<"组件未找到" ;
+ }
+ }
+ QMessageBox::information(this, tr("登录成功"), tr("已解锁"), QMessageBox::Ok);
+ accept();
+ }
+ }
+ userEditLine->clear();
+ pwdEditLine->clear();
+ userEditLine->setFocus();
+}
+
+
+LoginDialog::~LoginDialog()
+{
+
+}
diff --git a/point_visual/src/loginDialog.h b/point_visual/src/loginDialog.h
new file mode 100644
index 0000000..fa60a2a
--- /dev/null
+++ b/point_visual/src/loginDialog.h
@@ -0,0 +1,54 @@
+#ifndef LOGINDIALOG_H
+#define LOGINDIALOG_H
+
+#include
+#include
+#include
+#include