-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MELM and VESC CAN. Signed-off-by: James Goppert <[email protected]> Signed-off-by: Benjamin Perseghetti <[email protected]> Co-authored-by: James Goppert <[email protected]>
- Loading branch information
1 parent
adca457
commit 38d0da2
Showing
26 changed files
with
3,575 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#------------------------------------------------------------------------------- | ||
# Zephyr Cerebri Application | ||
# | ||
# Copyright (c) 2023 CogniPilot Foundation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.13.1) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
|
||
project(melm LANGUAGES C) | ||
|
||
set(CYECCA_PYTHON ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/cyecca_python) | ||
|
||
set(flags | ||
-std=c11 | ||
-Wall | ||
-Wextra | ||
-Werror | ||
-Wstrict-prototypes | ||
-Waggregate-return | ||
-Wbad-function-cast | ||
-Wcast-align | ||
-Wcast-qual | ||
-Wfloat-equal | ||
-Wformat-security | ||
-Wlogical-op | ||
-Wmissing-declarations | ||
# ubxlib includes geographiclib which dir doesn't exist | ||
#-Wmissing-include-dirs | ||
-Wmissing-prototypes | ||
-Wnested-externs | ||
-Wpointer-arith | ||
-Wredundant-decls | ||
-Wsequence-point | ||
-Wshadow | ||
-Wstrict-prototypes | ||
-Wswitch | ||
-Wundef | ||
-Wunreachable-code | ||
-Wunused-but-set-parameter | ||
-Wwrite-strings | ||
) | ||
string(JOIN " " flags ${flags}) | ||
|
||
set(SOURCE_FILES | ||
src/boot_banner.c | ||
src/input_mapping.c | ||
) | ||
|
||
if (CONFIG_CEREBRI_MELM_FSM) | ||
list(APPEND SOURCE_FILES src/fsm.c) | ||
endif() | ||
|
||
if (CONFIG_CEREBRI_MELM_ESTIMATE) | ||
list(APPEND SOURCE_FILES src/estimate.c) | ||
endif() | ||
|
||
if (CONFIG_CEREBRI_MELM_MIXING) | ||
list(APPEND SOURCE_FILES src/mixing.c) | ||
endif() | ||
|
||
if (CONFIG_CEREBRI_MELM_LIGHTING) | ||
list(APPEND SOURCE_FILES src/lighting.c) | ||
endif() | ||
|
||
if (CONFIG_CEREBRI_MELM_COMMAND) | ||
list(APPEND SOURCE_FILES src/command.c) | ||
endif() | ||
|
||
if (CONFIG_CEREBRI_MELM_POSITION) | ||
list(APPEND SOURCE_FILES | ||
src/position.c) | ||
endif() | ||
|
||
if (CONFIG_CEREBRI_MELM_VELOCITY) | ||
list(APPEND SOURCE_FILES | ||
src/velocity.c) | ||
endif() | ||
|
||
set(CASADI_DEST_DIR ${CMAKE_BINARY_DIR}/app/melm/casadi) | ||
|
||
set(CASADI_FILES | ||
${CASADI_DEST_DIR}/melm.c | ||
) | ||
|
||
if (CONFIG_CEREBRI_MELM_CASADI) | ||
list(APPEND SOURCE_FILES | ||
${CASADI_DEST_DIR}/melm.c | ||
) | ||
endif() | ||
|
||
add_custom_command(OUTPUT ${CASADI_DEST_DIR}/melm.c | ||
COMMAND ${CYECCA_PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/src/casadi/melm.py ${CASADI_DEST_DIR} | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/casadi/melm.py) | ||
|
||
set_source_files_properties( | ||
${SOURCE_FILES} | ||
PROPERTIES COMPILE_FLAGS | ||
"${flags}" | ||
) | ||
|
||
set_source_files_properties( | ||
${CASADI_FILES} | ||
PROPERTIES COMPILE_FLAGS | ||
"${flags}\ | ||
-Wno-unused-parameter\ | ||
-Wno-missing-prototypes\ | ||
-Wno-missing-declarations\ | ||
-Wno-float-equal") | ||
|
||
target_sources(app PRIVATE ${SOURCE_FILES}) | ||
|
||
target_include_directories(app SYSTEM BEFORE PRIVATE ${ZEPHYR_BASE}/include ${CMAKE_BINARY_DIR}) | ||
|
||
# vi: ts=2 sw=2 et |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Copyright (c) 2023, CogniPilot Foundation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
mainmenu "CogniPilot - Cerebri - MELM" | ||
menu "Zephyr" | ||
source "Kconfig.zephyr" | ||
endmenu | ||
|
||
menu "MELM" | ||
config CEREBRI_MELM_ESTIMATE | ||
bool "enable estimate" | ||
depends on CEREBRI_MELM_CASADI | ||
help | ||
Enable estimator | ||
|
||
config CEREBRI_MELM_FSM | ||
bool "enable finite state machine" | ||
help | ||
Enable fintie state machine | ||
|
||
config CEREBRI_MELM_LIGHTING | ||
bool "enable lighting" | ||
help | ||
Enable lighting | ||
|
||
config CEREBRI_MELM_COMMAND | ||
bool "enable command" | ||
depends on CEREBRI_MELM_MIXING | ||
help | ||
Enable command | ||
|
||
config CEREBRI_MELM_MIXING | ||
bool "enable mixing" | ||
help | ||
Enable mixing | ||
|
||
config CEREBRI_MELM_POSITION | ||
bool "enable position" | ||
depends on CEREBRI_MELM_CASADI | ||
help | ||
Enable position | ||
|
||
config CEREBRI_MELM_VELOCITY | ||
bool "enable velocity" | ||
depends on CEREBRI_MELM_MIXING | ||
depends on CEREBRI_MELM_CASADI | ||
help | ||
Enable velocity | ||
|
||
config CEREBRI_MELM_CASADI | ||
bool "enable casadi code" | ||
help | ||
Enable Casadi generated code | ||
|
||
config CEREBRI_MELM_BATTERY_MIN_MILLIVOLT | ||
int "min battery voltage in milli volts before shut off" | ||
default 16500 | ||
help | ||
Minimum battery voltage in mV before auto-disarm | ||
|
||
config CEREBRI_MELM_BATTERY_LOW_MILLIVOLT | ||
int "low battery voltage in milli volts before warning" | ||
default 17250 | ||
help | ||
Low battery voltage in mV before warning | ||
|
||
config CEREBRI_MELM_BATTERY_MAX_MILLIVOLT | ||
int "max battery voltage in milli volts" | ||
default 21900 | ||
help | ||
Maximum battery voltage | ||
|
||
config CEREBRI_MELM_GAIN_HEADING | ||
int "heading gain" | ||
default 100 | ||
help | ||
Steering = Heading error * GAIN_/ 1000 | ||
|
||
config CEREBRI_MELM_GAIN_CROSS_TRACK | ||
int "cross track gain" | ||
default 100 | ||
help | ||
Steering = Cross track error * GAIN / 1000 | ||
|
||
config CEREBRI_MELM_GAIN_ALONG_TRACK | ||
int "along track gain" | ||
default 100 | ||
help | ||
Steering = Along track error * GAIN / 1000 | ||
|
||
config CEREBRI_MELM_MAX_VELOCITY_MM_S | ||
int "max velocity, mm/s" | ||
default 2000 | ||
help | ||
Max velocity in mm/s | ||
|
||
config CEREBRI_MELM_WHEEL_RADIUS_MM | ||
int "wheel radius, mm" | ||
default 108 | ||
help | ||
Wheel radius in mm | ||
|
||
config CEREBRI_MELM_WHEEL_SEPARATION_MM | ||
int "wheel separation, mm" | ||
default 408 | ||
help | ||
Wheel radius in mm | ||
|
||
config CEREBRI_MELM_WHEEL_BASE_MM | ||
int "wheel base, mm" | ||
default 280 | ||
help | ||
Wheel radius in mm | ||
|
||
module = CEREBRI_MELM | ||
module-str = cerebri_melm | ||
source "subsys/logging/Kconfig.template.log_config" | ||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
CONFIG_ENTROPY_GENERATOR=y | ||
CONFIG_TEST_RANDOM_GENERATOR=y | ||
CONFIG_SPEED_OPTIMIZATIONS=y | ||
CONFIG_SIZE_OPTIMIZATIONS=n | ||
|
||
CONFIG_DISK_ACCESS=n | ||
CONFIG_FS_FATFS_EXFAT=n | ||
CONFIG_DISK_DRIVER_SDMMC=n | ||
CONFIG_FS_FATFS_MOUNT_MKFS=n | ||
CONFIG_CEREBRI_SYNAPSE_LOG_SDCARD=n | ||
|
||
CONFIG_TEST=y | ||
CONFIG_UBSAN=n | ||
CONFIG_ASSERT=y | ||
CONFIG_ASSERT_LEVEL=2 | ||
CONFIG_ASSERT_VERBOSE=y | ||
|
||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 | ||
|
||
CONFIG_STACK_CANARIES=y | ||
|
||
CONFIG_ISR_STACK_SIZE=2048 | ||
|
||
CONFIG_LOG_MODE_DEFERRED=y | ||
CONFIG_LOG_MODE_IMMEDIATE=n | ||
|
||
CONFIG_FPU=y | ||
|
||
# config | ||
CONFIG_INPUT=y | ||
CONFIG_INPUT_GPIO_KEYS=y | ||
CONFIG_INPUT_SBUS=y | ||
CONFIG_INPUT_SBUS_THREAD_STACK_SIZE=8192 | ||
CONFIG_INPUT_SBUS_REPORT_FILTER=0 | ||
CONFIG_INPUT_EVENT_DUMP=n | ||
CONFIG_INPUT_SHELL=n | ||
CONFIG_INPUT_MODE_SYNCHRONOUS=y | ||
CONFIG_INPUT_THREAD_STACK_SIZE=2048 | ||
|
||
|
||
CONFIG_CEREBRI_SENSE_SBUS=y | ||
CONFIG_CEREBRI_SENSE_IMU=y | ||
CONFIG_CEREBRI_SENSE_MAG=y | ||
CONFIG_CEREBRI_SENSE_SAFETY=n | ||
CONFIG_CEREBRI_SENSE_UBX_GNSS=y | ||
|
||
CONFIG_CEREBRI_SYNAPSE_ETH_RX=y | ||
CONFIG_CEREBRI_SYNAPSE_ETH_TX=y | ||
|
||
CONFIG_CAN=y | ||
CONFIG_CEREBRI_ACTUATE_VESC_CAN=y | ||
|
||
CONFIG_LED_STRIP=y | ||
CONFIG_APA102_STRIP=y | ||
CONFIG_CEREBRI_ACTUATE_LED_ARRAY=y | ||
CONFIG_CEREBRI_SENSE_MAG_COUNT=2 | ||
CONFIG_CEREBRI_SENSE_POWER=n | ||
CONFIG_CEREBRI_ACTUATE_SOUND=y | ||
|
||
CONFIG_ETH_NXP_S32_RX_RING_LEN=16 | ||
|
||
CONFIG_CAN=y | ||
CONFIG_CAN_MAX_FILTER=5 | ||
CONFIG_CAN_SHELL=y | ||
|
||
CONFIG_NET_DRIVERS=y | ||
CONFIG_NET_CANBUS=y | ||
|
||
CONFIG_NET_SOCKETS_CAN=y | ||
CONFIG_NET_DEFAULT_IF_CANBUS_RAW=y | ||
|
||
CONFIG_CAN_LOG_LEVEL_DBG=n | ||
CONFIG_CAN_FD_MODE=y | ||
CONFIG_SHELL_ARGC_MAX=72 | ||
CONFIG_I2C=y | ||
CONFIG_SENSOR=y | ||
CONFIG_SENSOR_SHELL=y | ||
CONFIG_HEAP_MEM_POOL_SIZE=16384 | ||
|
||
# Debugging | ||
CONFIG_DEBUG_THREAD_INFO=y | ||
|
||
# Logging | ||
#CONFIG_LOG_BACKEND_NET=n | ||
#CONFIG_LOG_BACKEND_NET_SERVER="192.0.2.2" |
Oops, something went wrong.