Browse Source

change driver/driver_map_xodrload. for fix junction problem.

yuchuli 3 years ago
parent
commit
3b42b7facd

+ 38 - 13
src/common/common/xodr/xodrfunc/xodrdijkstra.cpp

@@ -171,10 +171,10 @@ xodrdijkstra::xodrdijkstra(OpenDrive  * pxodr)
                 {
                     fseclen = px->GetRoadLength() - px->GetLaneSection(j)->GetS();
                 }
-                if((px->GetRoadId() == "10098")||(px->GetRoadId() == "10113")||(px->GetRoadId() == "10074"))
-                {
-                    int axy = 1;
-                }
+//                if((px->GetRoadId() == "10098")||(px->GetRoadId() == "10113")||(px->GetRoadId() == "10074"))
+//                {
+//                    int axy = 1;
+//                }
                 roadedge xroad(atoi(px->GetRoadId().data()),atoi(px->GetRoadJunction().data()),fseclen,2,j,px);
 
 //                roadedge xroad(atoi(px->GetRoadId().data()),atoi(px->GetRoadJunction().data()),px->GetRoadLength(),2,j,px);
@@ -229,6 +229,12 @@ xodrdijkstra::xodrdijkstra(OpenDrive  * pxodr)
             int road_from = atoi(pjc->GetIncomingRoad().data());
             int road_to = atoi(pjc->GetConnectingRoad().data());
 
+            if((road_from == 117)||(road_to == 117))
+            {
+                int bbb = 1;
+                bbb++;
+            }
+
             Road * pRoad_From = GetRoadByID(road_from);
             Road * pRoad_To = GetRoadByID(road_to);
             int k;
@@ -305,7 +311,7 @@ xodrdijkstra::xodrdijkstra(OpenDrive  * pxodr)
  //                   if(lr_from == 1)
                     if(lr_to == 2)
                     {
-                        fromedge = getroadedge(road_from,lr_from,pRoad_From->GetLaneSectionCount() -1);
+                        fromedge = getroadedge(road_from,lr_from);
                         toedge = getroadedge(road_to,lr_to);
                         a = mroadedge[fromedge].mvertexend;
                         b = mroadedge[toedge].mvertexstart;
@@ -1597,6 +1603,10 @@ std::vector<pathsection> xodrdijkstra::getgpspoint(int srcroadid, int nsrclr, in
                         xpathsection[i-1].mnEndLaneSel = ngoodlane;
                         bNeedChangeLane = false;
                     }
+                    else
+                    {
+                        bNeedChangeLane = true;
+                    }
                 }
                 else
                 {
@@ -1687,6 +1697,21 @@ std::vector<pathsection> xodrdijkstra::getgpspoint(int srcroadid, int nsrclr, in
             if(pRoad == pRoad2)
             {
                 std::cout<<" Lane Change in road inter. "<<std::endl;
+
+                if(nlr == 2)
+                {
+                    if(pLane2->IsSuccessorSet())
+                    {
+                        xpathsection[i].secondsel = pLane2->GetSuccessor();
+                    }
+                }
+                else
+                {
+                    if(pLane2->IsPredecessorSet())
+                    {
+                        xpathsection[i].secondsel = pLane2->GetPredecessor();
+                    }
+                }
             }
             else
             {
@@ -1740,14 +1765,14 @@ std::vector<pathsection> xodrdijkstra::getgpspoint(int srcroadid, int nsrclr, in
 
             }
 
-            int k;
-            for(k=(nsize-1);k>i;k--)
-            {
-                if(xpathsection[k].mpRoad == xpathsection[i].mpRoad)
-                {
-                    xpathsection[k].secondsel = xpathsection[i].secondsel;
-                }
-            }
+//            int k;
+//            for(k=(nsize-1);k>i;k--)
+//            {
+//                if(xpathsection[k].mpRoad == xpathsection[i].mpRoad)
+//                {
+//                    xpathsection[k].secondsel = xpathsection[i].secondsel;
+//                }
+//            }
 
         }
         else

+ 73 - 0
src/tool/view_message/.gitignore

@@ -0,0 +1,73 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+

+ 11 - 0
src/tool/view_message/main.cpp

@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}

+ 32 - 0
src/tool/view_message/mainwindow.cpp

@@ -0,0 +1,32 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+
+    setWindowTitle("Message View");
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+
+void MainWindow::on_pushButton_refresh_clicked()
+{
+
+}
+
+void MainWindow::on_pushButton_view_clicked()
+{
+
+}
+
+void MainWindow::on_pushButton_manualadd_clicked()
+{
+
+}

+ 28 - 0
src/tool/view_message/mainwindow.h

@@ -0,0 +1,28 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = nullptr);
+    ~MainWindow();
+
+private slots:
+    void on_pushButton_refresh_clicked();
+
+    void on_pushButton_view_clicked();
+
+    void on_pushButton_manualadd_clicked();
+
+private:
+    Ui::MainWindow *ui;
+};
+#endif // MAINWINDOW_H

+ 81 - 0
src/tool/view_message/mainwindow.ui

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>351</width>
+    <height>335</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QPushButton" name="pushButton_refresh">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>30</y>
+      <width>121</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>刷新消息列表</string>
+    </property>
+   </widget>
+   <widget class="QComboBox" name="comboBox_message">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>110</y>
+      <width>311</width>
+      <height>41</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_view">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>190</y>
+      <width>151</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>查看</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_manualadd">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>190</y>
+      <width>131</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>手动增加</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>351</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 31 - 0
src/tool/view_message/view_message.pro

@@ -0,0 +1,31 @@
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+    main.cpp \
+    mainwindow.cpp
+
+HEADERS += \
+    mainwindow.h
+
+FORMS += \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target