Skip to content
Merged

Final #206

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
70aaae0
test and ego lanes modification
pranavreddy23 Dec 13, 2025
53834b7
v 0.5 full pipeline intial v_0.5_0.1
pranavreddy23 Dec 13, 2025
5a36895
ego lanes rename
pranavreddy23 Dec 13, 2025
f053a30
egolanes rename
pranavreddy23 Dec 13, 2025
5c8de72
autosteer is here
pranavreddy23 Dec 13, 2025
b6d919c
autosteer implementation
pranavreddy23 Dec 13, 2025
82e75d0
egolane rename
pranavreddy23 Dec 13, 2025
7da7f72
egolanes rename
pranavreddy23 Dec 13, 2025
8479e88
size and name for extra model
pranavreddy23 Dec 13, 2025
b378b01
give me tensors and input shape
pranavreddy23 Dec 13, 2025
352d799
egolanes rename
pranavreddy23 Dec 13, 2025
d62caed
welcome autosteer
pranavreddy23 Dec 13, 2025
ec74357
egolanes rename
pranavreddy23 Dec 13, 2025
38ce40d
egolanes rename
pranavreddy23 Dec 13, 2025
7c2bfb3
test autosteer
pranavreddy23 Dec 13, 2025
b5787a8
added some log
pranavreddy23 Dec 13, 2025
c0927f6
tweak it to get right output
pranavreddy23 Dec 13, 2025
8215fbf
working version
pranavreddy23 Dec 13, 2025
748cdf4
good test
pranavreddy23 Dec 13, 2025
b2b878d
autosteer is here
pranavreddy23 Dec 14, 2025
b88e736
pre final v0.5_0.2
pranavreddy23 Dec 14, 2025
af015c2
now take road curvature or autosteer
pranavreddy23 Dec 14, 2025
2b2ee11
Autosteer input
pranavreddy23 Dec 14, 2025
9feb368
remove center unnecessary
pranavreddy23 Dec 14, 2025
8ed762f
remove unnecesary
pranavreddy23 Dec 14, 2025
75ef319
manadate autosteet
pranavreddy23 Dec 14, 2025
75d73b8
final bash change args
pranavreddy23 Dec 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 37 additions & 29 deletions VisionPilot/Production_Releases/0.5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(autosteer_pipeline LANGUAGES CXX)
project(egolanes_pipeline LANGUAGES CXX)

Check warning on line 2 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (egolanes)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -9,21 +9,21 @@
find_package(Threads REQUIRED)
find_package(Eigen3 REQUIRED)

# ONNX Runtime - user must set ONNXRUNTIME_ROOT

Check warning on line 12 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (ONNXRUNTIME)
if(NOT DEFINED ENV{ONNXRUNTIME_ROOT})

Check warning on line 13 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (ONNXRUNTIME)
message(FATAL_ERROR "Please set ONNXRUNTIME_ROOT environment variable to ONNX Runtime installation directory\n"

Check warning on line 14 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (ONNXRUNTIME)
"Example: export ONNXRUNTIME_ROOT=/path/to/onnxruntime-linux-x64-gpu-1.22.0")

Check warning on line 15 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (onnxruntime)

Check warning on line 15 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (ONNXRUNTIME)
endif()

set(ONNXRUNTIME_ROOT $ENV{ONNXRUNTIME_ROOT})

Check warning on line 18 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (ONNXRUNTIME)
set(ONNXRUNTIME_INCLUDE_DIR ${ONNXRUNTIME_ROOT}/include)
set(ONNXRUNTIME_LIB_DIR ${ONNXRUNTIME_ROOT}/lib)

# Find library (handle versioned .so files)
file(GLOB ONNXRUNTIME_LIBRARY "${ONNXRUNTIME_LIB_DIR}/libonnxruntime.so*")

Check warning on line 23 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (libonnxruntime)
list(GET ONNXRUNTIME_LIBRARY 0 ONNXRUNTIME_LIBRARY)

if(NOT EXISTS ${ONNXRUNTIME_INCLUDE_DIR}/onnxruntime_cxx_api.h)

Check warning on line 26 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (onnxruntime)
message(FATAL_ERROR "ONNX Runtime headers not found at: ${ONNXRUNTIME_INCLUDE_DIR}")
endif()

Expand All @@ -39,38 +39,39 @@
${EIGEN3_INCLUDE_DIR}
)

# AutoSteer inference backend
add_library(autosteer_inference
# EgoLanes inference backend
add_library(egolanes_inference

Check warning on line 43 in VisionPilot/Production_Releases/0.5/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (egolanes)
src/inference/onnxruntime_session.cpp
src/inference/onnxruntime_engine.cpp
src/inference/autosteer_engine.cpp
)
target_compile_definitions(autosteer_inference PRIVATE LOG_TYPE=0) # Use non-ROS logging
target_link_libraries(autosteer_inference
target_compile_definitions(egolanes_inference PRIVATE LOG_TYPE=0) # Use non-ROS logging
target_link_libraries(egolanes_inference
${OpenCV_LIBS}
${ONNXRUNTIME_LIBRARY}
)
# Add RPATH so executable can find libonnxruntime.so at runtime
set_target_properties(autosteer_inference PROPERTIES
set_target_properties(egolanes_inference PROPERTIES
BUILD_RPATH ${ONNXRUNTIME_LIB_DIR}
INSTALL_RPATH ${ONNXRUNTIME_LIB_DIR}
)

# Visualization module
add_library(autosteer_visualization
add_library(egolanes_visualization
src/visualization/draw_lanes.cpp
)
target_compile_definitions(autosteer_visualization PRIVATE LOG_TYPE=0) # Use non-ROS logging
target_link_libraries(autosteer_visualization
autosteer_inference
target_compile_definitions(egolanes_visualization PRIVATE LOG_TYPE=0) # Use non-ROS logging
target_link_libraries(egolanes_visualization
egolanes_inference
${OpenCV_LIBS}
)

# Lane filtering module
add_library(autosteer_lane_filtering
add_library(egolanes_lane_filtering
src/lane_filtering/lane_filter.cpp
)
target_link_libraries(autosteer_lane_filtering
autosteer_inference
target_link_libraries(egolanes_lane_filtering
egolanes_inference
${OpenCV_LIBS}
)

Expand Down Expand Up @@ -135,8 +136,8 @@
src/rerun/rerun_logger.cpp
)
target_compile_definitions(rerun_logger PRIVATE ENABLE_RERUN)
target_link_libraries(rerun_logger
autosteer_inference
target_link_libraries(rerun_logger
egolanes_inference
${OpenCV_LIBS}
rerun_sdk
)
Expand All @@ -152,26 +153,26 @@
endif()

# Lane tracking module
add_library(autosteer_lane_tracking
add_library(egolanes_lane_tracking
src/lane_tracking/lane_tracking.cpp
)
target_link_libraries(autosteer_lane_tracking
autosteer_inference
target_link_libraries(egolanes_lane_tracking
egolanes_inference
${OpenCV_LIBS}
)

# Main executable
add_executable(autosteer_pipeline
add_executable(egolanes_pipeline
main.cpp
)
target_compile_definitions(autosteer_pipeline PRIVATE LOG_TYPE=0) # Use non-ROS logging
target_compile_definitions(egolanes_pipeline PRIVATE LOG_TYPE=0) # Use non-ROS logging

# Link libraries
set(AUTOSTEER_LIBS
autosteer_inference
autosteer_visualization
autosteer_lane_filtering
autosteer_lane_tracking
set(EGOLANES_LIBS
egolanes_inference
egolanes_visualization
egolanes_lane_filtering
egolanes_lane_tracking
camera_utils
path_planning
steering_control
Expand All @@ -180,14 +181,21 @@
)

if(ENABLE_RERUN AND RERUN_ENABLED)
target_compile_definitions(autosteer_pipeline PRIVATE ENABLE_RERUN)
list(APPEND AUTOSTEER_LIBS rerun_logger)
target_compile_definitions(egolanes_pipeline PRIVATE ENABLE_RERUN)
list(APPEND EGOLANES_LIBS rerun_logger)
endif()

target_link_libraries(autosteer_pipeline ${AUTOSTEER_LIBS})
target_link_libraries(egolanes_pipeline ${EGOLANES_LIBS})

# Test executable for AutoSteer
add_executable(test_autosteer
test/test_autosteer.cpp
)
target_compile_definitions(test_autosteer PRIVATE LOG_TYPE=0)
target_link_libraries(test_autosteer ${EGOLANES_LIBS})

# Installation
install(TARGETS autosteer_pipeline
install(TARGETS egolanes_pipeline
RUNTIME DESTINATION bin
)

Expand Down
2 changes: 1 addition & 1 deletion VisionPilot/Production_Releases/0.5/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# VisionPilot 0.5 - AutoSteer Production Release
# VisionPilot 0.5 - EgoLanes Production Release

This release enables autonomous steering using the EgoLanes neural network to detect lane lines and navigate roads at a predetermined, desired speed.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#ifndef AUTOWARE_POV_VISION_EGOLANES_AUTOSTEER_ENGINE_HPP_
#define AUTOWARE_POV_VISION_EGOLANES_AUTOSTEER_ENGINE_HPP_

#include <onnxruntime_cxx_api.h>
#include <string>
#include <vector>
#include <memory>

namespace autoware_pov::vision::egolanes
{

/**
* @brief AutoSteer ONNX Runtime Inference Engine
*
* Takes concatenated EgoLanes raw outputs from two consecutive frames
* and predicts steering angle.
*
* Input: [1, 6, 80, 160] - concatenated (t-1, t) EgoLanes outputs
* Output: Steering angle (degrees)
*
* Supports CPU and TensorRT execution providers.
*/
class AutoSteerOnnxEngine
{
public:
/**
* @brief Constructor
*
* @param model_path Path to ONNX model (.onnx file)
* @param provider Execution provider: "cpu" or "tensorrt"
* @param precision Precision mode: "fp32" or "fp16" (TensorRT only)
* @param device_id GPU device ID (TensorRT only, default: 0)
* @param cache_dir TensorRT engine cache directory (default: ./trt_cache)
*/
AutoSteerOnnxEngine(
const std::string& model_path,
const std::string& provider = "cpu",
const std::string& precision = "fp32",
int device_id = 0,
const std::string& cache_dir = "./trt_cache"
);

~AutoSteerOnnxEngine();

/**
* @brief Run AutoSteer inference
*
* @param concat_input Concatenated tensor [1, 6, 80, 160]
* = [t-1 EgoLanes output, t EgoLanes output]
* @return Steering angle in degrees (-30 to +30)
*/
float inference(const std::vector<float>& concat_input);

/**
* @brief Get model input dimensions
*/
int getInputChannels() const { return model_input_channels_; }
int getInputHeight() const { return model_input_height_; }
int getInputWidth() const { return model_input_width_; }

/**
* @brief Get raw output logits for debugging
* @return Vector of 61 logit values (one per steering class)
*/
std::vector<float> getRawOutputLogits() const;

private:
/**
* @brief Run ONNX Runtime inference
*/
bool doInference(const std::vector<float>& input_buffer);

/**
* @brief Post-process raw output to steering angle
*
* Applies argmax and converts to degrees: argmax(logits) - 30
*/
float postProcess();

// ONNX Runtime components
std::unique_ptr<Ort::Session> session_;
std::unique_ptr<Ort::MemoryInfo> memory_info_;

// Input/Output tensor names (storage + pointers)
std::string input_name_storage_;
std::string output_name_storage_; // Kept for backward compatibility (points to second output)
std::vector<std::string> output_names_storage_; // Stores both output names
std::vector<const char*> input_names_;
std::vector<const char*> output_names_;

// Model dimensions
int model_input_channels_; // 6 (two 3-channel EgoLanes outputs)
int model_input_height_; // 80
int model_input_width_; // 160
int model_output_classes_; // 61 (steering classes: -30 to +30)

// Output buffer
std::vector<Ort::Value> output_tensors_;
};

} // namespace autoware_pov::vision::egolanes

#endif // AUTOWARE_POV_VISION_EGOLANES_AUTOSTEER_ENGINE_HPP_

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef AUTOWARE_POV_VISION_AUTOSTEER_ONNXRUNTIME_ENGINE_HPP_
#define AUTOWARE_POV_VISION_AUTOSTEER_ONNXRUNTIME_ENGINE_HPP_
#ifndef AUTOWARE_POV_VISION_EGOLANES_ONNXRUNTIME_ENGINE_HPP_
#define AUTOWARE_POV_VISION_EGOLANES_ONNXRUNTIME_ENGINE_HPP_

#include <onnxruntime_cxx_api.h>
#include <opencv2/opencv.hpp>
Expand All @@ -8,7 +8,7 @@
#include <memory>
#include <array>

namespace autoware_pov::vision::autosteer
namespace autoware_pov::vision::egolanes
{

/**
Expand Down Expand Up @@ -48,7 +48,7 @@ struct LaneSegmentation
};

/**
* @brief AutoSteer ONNX Runtime Inference Engine
* @brief EgoLanes ONNX Runtime Inference Engine
*
* Supports multiple execution providers:
* - CPU: Default CPU execution
Expand All @@ -59,7 +59,7 @@ struct LaneSegmentation
* 2. Model inference via ONNX Runtime
* 3. Post-processing (thresholding, channel extraction)
*/
class AutoSteerOnnxEngine
class EgoLanesOnnxEngine
{
public:
/**
Expand All @@ -71,15 +71,15 @@ class AutoSteerOnnxEngine
* @param device_id GPU device ID (TensorRT only, default: 0)
* @param cache_dir TensorRT engine cache directory (default: ./trt_cache)
*/
AutoSteerOnnxEngine(
EgoLanesOnnxEngine(
const std::string& model_path,
const std::string& provider = "cpu",
const std::string& precision = "fp32",
int device_id = 0,
const std::string& cache_dir = "./trt_cache"
);

~AutoSteerOnnxEngine();
~EgoLanesOnnxEngine();

/**
* @brief Run complete inference pipeline
Expand All @@ -105,7 +105,7 @@ class AutoSteerOnnxEngine
*/
std::vector<int64_t> getTensorShape() const;

// Model input dimensions (320x640 for AutoSteer)
// Model input dimensions (320x640 for EgoLanes)
int getInputWidth() const { return model_input_width_; }
int getInputHeight() const { return model_input_height_; }

Expand All @@ -115,11 +115,11 @@ class AutoSteerOnnxEngine

private:
/**
* @brief Preprocess image for AutoSteer
* @brief Preprocess image for EgoLanes
*
* Resizes to 320x640, converts to RGB, normalizes with ImageNet stats, converts to CHW
*/
void preprocessAutoSteer(const cv::Mat& input_image, float* buffer);
void preprocessEgoLanes(const cv::Mat& input_image, float* buffer);

/**
* @brief Run ONNX Runtime inference
Expand Down Expand Up @@ -159,7 +159,7 @@ class AutoSteerOnnxEngine
static constexpr std::array<float, 3> STD = {0.229f, 0.224f, 0.225f};
};

} // namespace autoware_pov::vision::autosteer
} // namespace autoware_pov::vision::egolanes

#endif // AUTOWARE_POV_VISION_AUTOSTEER_ONNXRUNTIME_ENGINE_HPP_
#endif // AUTOWARE_POV_VISION_EGOLANES_ONNXRUNTIME_ENGINE_HPP_

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef AUTOWARE_POV_VISION_AUTOSTEER_ONNXRUNTIME_SESSION_HPP_
#define AUTOWARE_POV_VISION_AUTOSTEER_ONNXRUNTIME_SESSION_HPP_
#ifndef AUTOWARE_POV_VISION_EGOLANES_ONNXRUNTIME_SESSION_HPP_
#define AUTOWARE_POV_VISION_EGOLANES_ONNXRUNTIME_SESSION_HPP_

#include <onnxruntime_cxx_api.h>
#include <string>
#include <memory>

namespace autoware_pov::vision::autosteer
namespace autoware_pov::vision::egolanes
{

/**
Expand All @@ -26,14 +26,18 @@ class OnnxRuntimeSessionFactory
* @param precision "fp32" or "fp16" (only for TensorRT)
* @param device_id GPU device ID (only for TensorRT)
* @param cache_dir Directory for TensorRT engine cache (optional)
* @param workspace_size_gb TensorRT workspace size in GB (default: 1GB)
* @param cache_prefix Prefix for TensorRT engine cache files (default: "egolanes_")
* @return Unique pointer to created session
*/
static std::unique_ptr<Ort::Session> createSession(
const std::string& model_path,
const std::string& provider,
const std::string& precision = "fp16",
int device_id = 0,
const std::string& cache_dir = "./trt_cache"
const std::string& cache_dir = "./trt_cache",
double workspace_size_gb = 1.0,
const std::string& cache_prefix = "egolanes_"
);

private:
Expand All @@ -51,21 +55,23 @@ class OnnxRuntimeSessionFactory
* Enables:
* - Engine caching for fast startup
* - FP16/FP32 precision
* - Optimal workspace size
* - Configurable workspace size
* - Timing cache
*/
static std::unique_ptr<Ort::Session> createTensorRTSession(
Ort::Env& env,
const std::string& model_path,
const std::string& precision,
int device_id,
const std::string& cache_dir
const std::string& cache_dir,
double workspace_size_gb,
const std::string& cache_prefix
);
};

} // namespace autoware_pov::vision::autosteer
} // namespace autoware_pov::vision::egolanes

#endif // AUTOWARE_POV_VISION_AUTOSTEER_ONNXRUNTIME_SESSION_HPP_
#endif // AUTOWARE_POV_VISION_EGOLANES_ONNXRUNTIME_SESSION_HPP_



Loading
Loading