Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
146 changes: 39 additions & 107 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,129 +1,61 @@
# Checkout config tool: https://zed0.co.uk/clang-format-configurator/
# Or http://cf.monofraps.net/
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# https://github.com/01org/parameter-framework/blob/master/.clang-format

# Tested on: clang-format version 6.0.1


# Common settings
BasedOnStyle: WebKit
TabWidth: 4
IndentWidth: 4
UseTab: Always
ColumnLimit: 150

# Other languages JavaScript, Proto

---
Language: Cpp

# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code
# int formatted_code;
# // clang-format off
# void unformatted_code ;
# // clang-format on
# void formatted_code_again;

DisableFormat: false
Standard: Cpp11

AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom
# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
AfterExternBlock : 'true'
SplitEmptyFunction : 'false'
SplitEmptyRecord : 'false'
SplitEmptyNamespace : 'true'
}

BreakAfterJavaFieldAnnotations: true
BreakBeforeInheritanceComma: false
BreakBeforeBinaryOperators: None
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
BeforeLambdaBody: true
AfterStruct: true
BeforeElse: true
SplitEmptyFunction: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: true

CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ColumnLimit: 140
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
SpaceBeforeCpp11BracedList: false
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
Cpp11BracedListStyle: false
FixNamespaceComments: true
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
JavaScriptQuotes: Double
IncludeBlocks: Preserve
IndentCaseBlocks: true
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000

PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
NamespaceIndentation: All
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Left
SpaceAfterCStyleCast: false
SortIncludes: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceAfterTemplateKeyword: true
SpaceBeforeInheritanceColon: true

SortUsingDeclarations: true
SortIncludes: true

# Comments are for developers, they should arrange them
ReflowComments: false

IncludeBlocks: Preserve
IndentPPDirectives: AfterHash
---
Standard: c++17
UseTab: Never
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
url = https://github.com/crayzeewulf/libserial.git
[submodule "3rd/minmea"]
path = 3rd/minmea
url = https://github.com/kosma/minmea.git
url = https://github.com/kosma/minmea.git
[submodule "3rd/ouster-sdk"]
path = 3rd/ouster-sdk
url = https://github.com/ouster-lidar/ouster-sdk.git
1 change: 1 addition & 0 deletions 3rd/ouster-sdk
Submodule ouster-sdk added at c8b9b4
Empty file added CLAUDE.md
Empty file.
88 changes: 81 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ project (mandeye_multisensor)
set(MANDEYE_HARDWARE_HEADER CACHE STRING "Mandeye hardware setting. Choose one header from 'code/hardware/mandeye-*.h")
#add_compile_definitions(MANDEYE_HARDWARE_HEADER="${MANDEYE_HARDWARE_HEADER}")
message(STATUS "Mandeye hardware version is : ${MANDEYE_HARDWARE_HEADER}")
set (MANDEYE_VERSION "0.6-dev")
set (MANDEYE_VERSION "0.7-dev")
message(STATUS "Mandeye version is : ${MANDEYE_VERSION}")

set(SYSTEM_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
message("pistache")
#pistache
set(PISTACHE_BUILD_TESTS OFF CACHE BOOL "Disable Pistache tests")
add_subdirectory(3rd/pistache)


Expand All @@ -28,15 +29,18 @@ message("JSON")
#JSON
include_directories(3rd/json)

message("Livox SDK2")
# Livox SDK2
add_subdirectory(3rd/Livox-SDK2)


# extras
add_subdirectory(extras)

include_directories(code/)

set(MANDEYE_USE_OUSTER_SDK ON CACHE BOOL "Use Ouster SDK ")
set(MANDEYE_USE_LIVOX_SDK2 ON CACHE BOOL "Use Livox SDK (HAP/Mid360)")
set(MANDEYE_USE_SICK ON CACHE BOOL "Use SICK SCAN XD SDK (Multiscan MRS1000), requires SICK SDK to be installed")


# NMEA and libserial
find_path(LIBSERIAL_INCLUDE_DIR SerialPort.h
PATH_SUFFIXES include
Expand Down Expand Up @@ -73,12 +77,82 @@ configure_file(
# Include the generated file in the project
include_directories(${CMAKE_BINARY_DIR})
#executable
add_executable(control_program code/main.cpp code/gnss.cpp code/web_page.h code/LivoxClient.cpp code/gpios.cpp code/FileSystemClient.cpp code/save_laz.cpp ${PISTACHE_SRC}
set(LIDAR_SOURCES
code/lidars/dummy/ButterLidar.cpp
code/lidars/LidarImplementation.cpp
)
set(LIDAR_LIBRARIES )

if (${MANDEYE_USE_OUSTER_SDK})
# We need to separate the Ouster SDK from the main project to avoid conflicts with SPDLOG in LIVOX SDK2
message("Ouster SDK")
add_subdirectory(3rd/ouster-sdk)
add_executable(ouster_client_example code/lidars/ouster/ouster_client_example.cpp)
target_link_libraries(ouster_client_example PRIVATE OusterSDK::ouster_client)

# Create isolated static library for Ouster integration
add_library(ouster_lib
code/lidars/ouster/OusterClient.cpp
)
target_link_libraries(ouster_lib PRIVATE OusterSDK::ouster_client)
target_include_directories(ouster_lib PRIVATE 3rd/ouster-sdk/ouster_client/include)

list(APPEND LIDAR_LIBRARIES ouster_lib)
install(TARGETS ouster_lib LIBRARY DESTINATION /opt/mandeye/)
add_compile_definitions(MANDEYE_USE_OUSTER_SDK)
endif ()

if (${MANDEYE_USE_LIVOX_SDK2})
message("Livox SDK2")
# Livox SDK2

add_subdirectory(3rd/Livox-SDK2)
add_library(livox2_lib
code/lidars/livoxsdk2/LivoxClient.cpp
)
target_link_libraries(livox2_lib PRIVATE livox_lidar_sdk_static)
target_include_directories(livox2_lib PRIVATE 3rd/Livox-SDK2/include)
install(TARGETS livox2_lib LIBRARY DESTINATION /opt/mandeye/)
list(APPEND LIDAR_LIBRARIES livox2_lib)
# add defines
add_compile_definitions(MANDEYE_USE_LIVOX_SDK2)
endif()

if (${MANDEYE_USE_SICK})
message("SICK SDK")
# SICK SDK
find_package(sick_scan_xd REQUIRED)
if (TARGET sick_scan_xd::sick_scan_xd_shared_lib)
add_executable(sick_client_example code/lidars/sick/sick_client_example.cpp)
target_link_libraries(sick_client_example PRIVATE sick_scan_xd::sick_scan_xd_shared_lib )

add_library(sick_lib
code/lidars/sick/SickClient.cpp
)
target_link_libraries(sick_lib PRIVATE sick_scan_xd::sick_scan_xd_shared_lib)
install(TARGETS sick_lib LIBRARY DESTINATION /opt/mandeye/)
list(APPEND LIDAR_LIBRARIES sick_lib)
add_compile_definitions(MANDEYE_USE_SICK)
else()
message(FATAL_ERROR "SICK SDK not found. Install SICK SDK to use this feature.")
endif()
endif()

add_executable(control_program code/main.cpp code/gnss.cpp code/web_page.h
${LIDAR_SOURCES}
${LIDAR_SOURCES}
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${LIDAR_SOURCES} is listed twice in the add_executable command; remove the duplicate entry.

Suggested change
${LIDAR_SOURCES}

Copilot uses AI. Check for mistakes.
code/gpios.cpp code/FileSystemClient.cpp code/save_laz.cpp
code/utils/TimeStampReceiver.cpp code/publisher.cpp)
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

target_link_libraries(control_program pthread livox_lidar_sdk_static pistache atomic laszip ${LIBSERIAL_LIBRARY} minea gpiod zmq)
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic " )


target_link_libraries(control_program pthread ${LIDAR_LIBRARIES} pistache_static atomic laszip ${LIBSERIAL_LIBRARY} minea gpiod zmq)

set_target_properties(control_program PROPERTIES
INSTALL_RPATH "/opt/mandeye/lib"
BUILD_WITH_INSTALL_RPATH TRUE
)

add_executable(led_demo code/led_demo.cpp code/gpios.cpp)
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
Expand Down
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ sudo apt-get install build-essential cmake git rapidjson-dev debhelper build-ess
```


## Static IP for eth0

## Static IP for eth0
### Systems without network manager [Raspbian Bullseye]
```bash
sudo nano /etc/dhcpcd.conf
```
Expand All @@ -68,6 +68,24 @@ static ip_address=192.168.1.5/24
static routers=0.0.0.0
```

### Systems with network manager [Raspbian Bookwork]

```bash
sudo nmcli connection add type ethernet ifname eth0 con-name static-eth0 \
ipv4.addresses 192.168.1.5/24 \
ipv4.gateway 0.0.0.0 \
ipv4.method manual
```

verify with :
```bash
nmcli device show eth0
```

eventually you can use
```bash
nmtui
```
## Clone and build app

Note that, target hardware is defined during compilation time using `-MANDEYE_HARDWARE_HEADER=mandeye-standard-rpi4.h` parameter.
Expand Down Expand Up @@ -204,6 +222,25 @@ make package

The package will be available in the build directory.

# Choosing Lidar SDK
The software supports different SDKs for the Lidar:

| SDK | Variable | Description |
|-----|----------|----------------------------------------------------------------------------------|
| Livox SDK | `LIVOX_SDK2` | Livox SDK version 2 tested with Mid360 and HAP |
| Ouster SDK | `OUSTER` | Ouster SDK tested with OS-0-64 (ousteros-image-prod-aries-v2.5.3+20240111055903) |
| Butter Lidar | `BUTTER_LIDAR` | Dummy SDK for documentation and testing purposes |

Those are shared libraries that are loaded at runtime.
You can set the SDK to use in two ways:
1. By setting the `MANDEYE_LIDAR_SDK` environment variable to `LIVOX_SDK2` or `OUSTER`.
2. By putting the config in location '/media/usb/mandeye_config.json' with the following content:
```json
{
"lidar_sdk": "LIVOX_SDK2"
}
```

# Installation and usage of the package
To install the package, you need to copy it to the target device and install it with `dpkg`:
```bash
Expand Down
Loading