diff --git a/.gitignore b/.gitignore index e303e2c..837ce65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,17 @@ -# Compiled Object files -*.o -*.obj - -# Executables -*.bin -*.elf - -# PROS -bin/ -.vscode/ -.cache/ -compile_commands.json -temp.log -temp.errors -*.ini +# Compiled Object files +*.o +*.obj + +# Executables +*.bin +*.elf + +# PROS +bin/ +.vscode/ +.cache/ +compile_commands.json +temp.log +temp.errors +*.ini .d/ \ No newline at end of file diff --git a/Graphy@1.2.0.zip b/Graphy@1.2.0.zip deleted file mode 100644 index 4a37241..0000000 Binary files a/Graphy@1.2.0.zip and /dev/null differ diff --git a/Graphy@1.3.0.zip b/Graphy@1.3.0.zip new file mode 100644 index 0000000..f7475fa Binary files /dev/null and b/Graphy@1.3.0.zip differ diff --git a/Makefile b/Makefile index dfa4117..b48e666 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:= IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=Graphy -VERSION:=1.2.0 +VERSION:=1.3.0 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) diff --git a/firmware/libpros.a b/firmware/libpros.a index 0539990..3dbfc1b 100644 Binary files a/firmware/libpros.a and b/firmware/libpros.a differ diff --git a/firmware/v5-common.ld b/firmware/v5-common.ld index 762a905..c341c60 100644 --- a/firmware/v5-common.ld +++ b/firmware/v5-common.ld @@ -1,263 +1,263 @@ -/* Define the sections, and where they are mapped in memory */ -SECTIONS -{ -/* This will get stripped out before uploading, but we need to place code - here so we can at least link to it (install_hot_table) */ -.hot_init : { - KEEP (*(.hot_magic)) - KEEP (*(.hot_init)) -} > HOT_MEMORY - -.text : { - KEEP (*(.vectors)) - /* boot data should be exactly 32 bytes long */ - *(.boot_data) - . = 0x20; - *(.boot) - . = ALIGN(64); - *(.freertos_vectors) - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - *(.plt) - *(.gnu_warning) - *(.gcc_except_table) - *(.glue_7) - *(.glue_7t) - *(.vfp11_veneer) - *(.ARM.extab) - *(.gnu.linkonce.armextab.*) -} > RAM - -.init : { - KEEP (*(.init)) -} > RAM - -.fini : { - KEEP (*(.fini)) -} > RAM - -.rodata : { - __rodata_start = .; - *(.rodata) - *(.rodata.*) - *(.gnu.linkonce.r.*) - __rodata_end = .; -} > RAM - -.rodata1 : { - __rodata1_start = .; - *(.rodata1) - *(.rodata1.*) - __rodata1_end = .; -} > RAM - -.sdata2 : { - __sdata2_start = .; - *(.sdata2) - *(.sdata2.*) - *(.gnu.linkonce.s2.*) - __sdata2_end = .; -} > RAM - -.sbss2 : { - __sbss2_start = .; - *(.sbss2) - *(.sbss2.*) - *(.gnu.linkonce.sb2.*) - __sbss2_end = .; -} > RAM - -.data : { - __data_start = .; - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - *(.jcr) - *(.got) - *(.got.plt) - __data_end = .; -} > RAM - -.data1 : { - __data1_start = .; - *(.data1) - *(.data1.*) - __data1_end = .; -} > RAM - -.got : { - *(.got) -} > RAM - -.ctors : { - __CTOR_LIST__ = .; - ___CTORS_LIST___ = .; - KEEP (*crtbegin.o(.ctors)) - KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - __CTOR_END__ = .; - ___CTORS_END___ = .; -} > RAM - -.dtors : { - __DTOR_LIST__ = .; - ___DTORS_LIST___ = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - __DTOR_END__ = .; - ___DTORS_END___ = .; -} > RAM - -.fixup : { - __fixup_start = .; - *(.fixup) - __fixup_end = .; -} > RAM - -.eh_frame : { - *(.eh_frame) -} > RAM - -.eh_framehdr : { - __eh_framehdr_start = .; - *(.eh_framehdr) - __eh_framehdr_end = .; -} > RAM - -.gcc_except_table : { - *(.gcc_except_table) -} > RAM - -.mmu_tbl (ALIGN(16384)) : { - __mmu_tbl_start = .; - *(.mmu_tbl) - __mmu_tbl_end = .; -} > RAM - -.ARM.exidx : { - __exidx_start = .; - *(.ARM.exidx*) - *(.gnu.linkonce.armexidix.*.*) - __exidx_end = .; -} > RAM - -.preinit_array : { - __preinit_array_start = .; - KEEP (*(SORT(.preinit_array.*))) - KEEP (*(.preinit_array)) - __preinit_array_end = .; -} > RAM - -.init_array : { - __init_array_start = .; - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - __init_array_end = .; -} > RAM - -.fini_array : { - __fini_array_start = .; - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array)) - __fini_array_end = .; -} > RAM - -.ARM.attributes : { - __ARM.attributes_start = .; - *(.ARM.attributes) - __ARM.attributes_end = .; -} > RAM - -.sdata : { - __sdata_start = .; - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - __sdata_end = .; -} > RAM - -.sbss (NOLOAD) : { - __sbss_start = .; - *(.sbss) - *(.sbss.*) - *(.gnu.linkonce.sb.*) - __sbss_end = .; -} > RAM - -.tdata : { - __tdata_start = .; - *(.tdata) - *(.tdata.*) - *(.gnu.linkonce.td.*) - __tdata_end = .; -} > RAM - -.tbss : { - __tbss_start = .; - *(.tbss) - *(.tbss.*) - *(.gnu.linkonce.tb.*) - __tbss_end = .; -} > RAM - -.bss (NOLOAD) : { - __bss_start = .; - *(.bss) - *(.bss.*) - *(.gnu.linkonce.b.*) - *(COMMON) - __bss_end = .; -} > RAM - -_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 ); - -_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 ); - -/* Generate Stack and Heap definitions */ - -.heap (NOLOAD) : { - . = ALIGN(16); - _heap = .; - HeapBase = .; - _heap_start = .; - . += _HEAP_SIZE; - _heap_end = .; - HeapLimit = .; -} > HEAP - -.stack (NOLOAD) : { - . = ALIGN(16); - _stack_end = .; - . += _STACK_SIZE; - . = ALIGN(16); - _stack = .; - __stack = _stack; - . = ALIGN(16); - _irq_stack_end = .; - . += _IRQ_STACK_SIZE; - . = ALIGN(16); - __irq_stack = .; - _supervisor_stack_end = .; - . += _SUPERVISOR_STACK_SIZE; - . = ALIGN(16); - __supervisor_stack = .; - _abort_stack_end = .; - . += _ABORT_STACK_SIZE; - . = ALIGN(16); - __abort_stack = .; - _fiq_stack_end = .; - . += _FIQ_STACK_SIZE; - . = ALIGN(16); - __fiq_stack = .; - _undef_stack_end = .; - . += _UNDEF_STACK_SIZE; - . = ALIGN(16); - __undef_stack = .; -} > COLD_MEMORY - -_end = .; -} +/* Define the sections, and where they are mapped in memory */ +SECTIONS +{ +/* This will get stripped out before uploading, but we need to place code + here so we can at least link to it (install_hot_table) */ +.hot_init : { + KEEP (*(.hot_magic)) + KEEP (*(.hot_init)) +} > HOT_MEMORY + +.text : { + KEEP (*(.vectors)) + /* boot data should be exactly 32 bytes long */ + *(.boot_data) + . = 0x20; + *(.boot) + . = ALIGN(64); + *(.freertos_vectors) + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.plt) + *(.gnu_warning) + *(.gcc_except_table) + *(.glue_7) + *(.glue_7t) + *(.vfp11_veneer) + *(.ARM.extab) + *(.gnu.linkonce.armextab.*) +} > RAM + +.init : { + KEEP (*(.init)) +} > RAM + +.fini : { + KEEP (*(.fini)) +} > RAM + +.rodata : { + __rodata_start = .; + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + __rodata_end = .; +} > RAM + +.rodata1 : { + __rodata1_start = .; + *(.rodata1) + *(.rodata1.*) + __rodata1_end = .; +} > RAM + +.sdata2 : { + __sdata2_start = .; + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + __sdata2_end = .; +} > RAM + +.sbss2 : { + __sbss2_start = .; + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + __sbss2_end = .; +} > RAM + +.data : { + __data_start = .; + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + *(.jcr) + *(.got) + *(.got.plt) + __data_end = .; +} > RAM + +.data1 : { + __data1_start = .; + *(.data1) + *(.data1.*) + __data1_end = .; +} > RAM + +.got : { + *(.got) +} > RAM + +.ctors : { + __CTOR_LIST__ = .; + ___CTORS_LIST___ = .; + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __CTOR_END__ = .; + ___CTORS_END___ = .; +} > RAM + +.dtors : { + __DTOR_LIST__ = .; + ___DTORS_LIST___ = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __DTOR_END__ = .; + ___DTORS_END___ = .; +} > RAM + +.fixup : { + __fixup_start = .; + *(.fixup) + __fixup_end = .; +} > RAM + +.eh_frame : { + *(.eh_frame) +} > RAM + +.eh_framehdr : { + __eh_framehdr_start = .; + *(.eh_framehdr) + __eh_framehdr_end = .; +} > RAM + +.gcc_except_table : { + *(.gcc_except_table) +} > RAM + +.mmu_tbl (ALIGN(16384)) : { + __mmu_tbl_start = .; + *(.mmu_tbl) + __mmu_tbl_end = .; +} > RAM + +.ARM.exidx : { + __exidx_start = .; + *(.ARM.exidx*) + *(.gnu.linkonce.armexidix.*.*) + __exidx_end = .; +} > RAM + +.preinit_array : { + __preinit_array_start = .; + KEEP (*(SORT(.preinit_array.*))) + KEEP (*(.preinit_array)) + __preinit_array_end = .; +} > RAM + +.init_array : { + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; +} > RAM + +.fini_array : { + __fini_array_start = .; + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array)) + __fini_array_end = .; +} > RAM + +.ARM.attributes : { + __ARM.attributes_start = .; + *(.ARM.attributes) + __ARM.attributes_end = .; +} > RAM + +.sdata : { + __sdata_start = .; + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + __sdata_end = .; +} > RAM + +.sbss (NOLOAD) : { + __sbss_start = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + __sbss_end = .; +} > RAM + +.tdata : { + __tdata_start = .; + *(.tdata) + *(.tdata.*) + *(.gnu.linkonce.td.*) + __tdata_end = .; +} > RAM + +.tbss : { + __tbss_start = .; + *(.tbss) + *(.tbss.*) + *(.gnu.linkonce.tb.*) + __tbss_end = .; +} > RAM + +.bss (NOLOAD) : { + __bss_start = .; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + __bss_end = .; +} > RAM + +_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 ); + +_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 ); + +/* Generate Stack and Heap definitions */ + +.heap (NOLOAD) : { + . = ALIGN(16); + _heap = .; + HeapBase = .; + _heap_start = .; + . += _HEAP_SIZE; + _heap_end = .; + HeapLimit = .; +} > HEAP + +.stack (NOLOAD) : { + . = ALIGN(16); + _stack_end = .; + . += _STACK_SIZE; + . = ALIGN(16); + _stack = .; + __stack = _stack; + . = ALIGN(16); + _irq_stack_end = .; + . += _IRQ_STACK_SIZE; + . = ALIGN(16); + __irq_stack = .; + _supervisor_stack_end = .; + . += _SUPERVISOR_STACK_SIZE; + . = ALIGN(16); + __supervisor_stack = .; + _abort_stack_end = .; + . += _ABORT_STACK_SIZE; + . = ALIGN(16); + __abort_stack = .; + _fiq_stack_end = .; + . += _FIQ_STACK_SIZE; + . = ALIGN(16); + __fiq_stack = .; + _undef_stack_end = .; + . += _UNDEF_STACK_SIZE; + . = ALIGN(16); + __undef_stack = .; +} > COLD_MEMORY + +_end = .; +} diff --git a/firmware/v5-hot.ld b/firmware/v5-hot.ld index 017cb35..9618080 100644 --- a/firmware/v5-hot.ld +++ b/firmware/v5-hot.ld @@ -1,33 +1,33 @@ -/* This stack is used during initialization, but FreeRTOS tasks have their own - stack allocated in BSS or Heap (kernel tasks in FreeRTOS .bss heap; user tasks - in standard heap) */ -_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000; - -_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024; -_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048; -_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024; -_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024; -_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024; - -_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */ - -/* Define Memories in the system */ -start_of_cold_mem = 0x03800000; -_COLD_MEM_SIZE = 0x04800000; -end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE; - -start_of_hot_mem = 0x07800000; -_HOT_MEM_SIZE = 0x00800000; -end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE; - -MEMORY -{ - /* user code 72M */ - COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */ - HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE - HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ -} - -REGION_ALIAS("RAM", HOT_MEMORY); - -ENTRY(install_hot_table) +/* This stack is used during initialization, but FreeRTOS tasks have their own + stack allocated in BSS or Heap (kernel tasks in FreeRTOS .bss heap; user tasks + in standard heap) */ +_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000; + +_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024; +_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048; +_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024; +_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024; +_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024; + +_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */ + +/* Define Memories in the system */ +start_of_cold_mem = 0x03800000; +_COLD_MEM_SIZE = 0x04800000; +end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE; + +start_of_hot_mem = 0x07800000; +_HOT_MEM_SIZE = 0x00800000; +end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE; + +MEMORY +{ + /* user code 72M */ + COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */ + HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE + HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ +} + +REGION_ALIAS("RAM", HOT_MEMORY); + +ENTRY(install_hot_table) diff --git a/firmware/v5.ld b/firmware/v5.ld index 7cbd06f..a8ef570 100644 --- a/firmware/v5.ld +++ b/firmware/v5.ld @@ -1,33 +1,33 @@ -/* This stack is used during initialization, but FreeRTOS tasks have their own - stack allocated in BSS or Heap (kernel tasks in FreeRTOS .bss heap; user tasks - in standard heap) */ -_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000; - -_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024; -_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048; -_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024; -_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024; -_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024; - -_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */ - -/* Define Memories in the system */ -start_of_cold_mem = 0x03800000; -_COLD_MEM_SIZE = 0x04800000; -end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE; - -start_of_hot_mem = 0x07800000; -_HOT_MEM_SIZE = 0x00800000; -end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE; - -MEMORY -{ - /* user code 72M */ - COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */ - HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE - HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ -} - -REGION_ALIAS("RAM", COLD_MEMORY); - -ENTRY(vexStartup) +/* This stack is used during initialization, but FreeRTOS tasks have their own + stack allocated in BSS or Heap (kernel tasks in FreeRTOS .bss heap; user tasks + in standard heap) */ +_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000; + +_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024; +_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048; +_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024; +_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024; +_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024; + +_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */ + +/* Define Memories in the system */ +start_of_cold_mem = 0x03800000; +_COLD_MEM_SIZE = 0x04800000; +end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE; + +start_of_hot_mem = 0x07800000; +_HOT_MEM_SIZE = 0x00800000; +end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE; + +MEMORY +{ + /* user code 72M */ + COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */ + HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE + HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ +} + +REGION_ALIAS("RAM", COLD_MEMORY); + +ENTRY(vexStartup) diff --git a/include/api.h b/include/api.h index 7e92319..6b09de1 100644 --- a/include/api.h +++ b/include/api.h @@ -41,8 +41,8 @@ #define PROS_VERSION_MAJOR 3 #define PROS_VERSION_MINOR 8 -#define PROS_VERSION_PATCH 0 -#define PROS_VERSION_STRING "3.8.0" +#define PROS_VERSION_PATCH 3 +#define PROS_VERSION_STRING "3.8.3" #include "pros/adi.h" #include "pros/colors.h" @@ -56,8 +56,8 @@ #include "pros/misc.h" #include "pros/motors.h" #include "pros/optical.h" -#include "pros/rtos.h" #include "pros/rotation.h" +#include "pros/rtos.h" #include "pros/screen.h" #include "pros/vision.h" @@ -66,6 +66,7 @@ #include "pros/distance.hpp" #include "pros/gps.hpp" #include "pros/imu.hpp" +#include "pros/link.hpp" #include "pros/llemu.hpp" #include "pros/misc.hpp" #include "pros/motors.hpp" @@ -74,7 +75,6 @@ #include "pros/rtos.hpp" #include "pros/screen.hpp" #include "pros/vision.hpp" -#include "pros/link.hpp" #endif #endif // _PROS_API_H_ diff --git a/include/main.h b/include/main.h index 7be745d..288056e 100644 --- a/include/main.h +++ b/include/main.h @@ -4,7 +4,7 @@ * Contains common definitions and header files used throughout your PROS * project. * - * Copyright (c) 2017-2022, Purdue University ACM SIGBots. + * \copyright Copyright (c) 2017-2023, Purdue University ACM SIGBots. * All rights reserved. * * This Source Code Form is subject to the terms of the Mozilla Public @@ -22,7 +22,7 @@ * * For instance, E_CONTROLLER_MASTER has a shorter name: CONTROLLER_MASTER. * E_CONTROLLER_MASTER is pedantically correct within the PROS styleguide, but - * not convienent for most student programmers. + * not convenient for most student programmers. */ #define PROS_USE_SIMPLE_NAMES @@ -39,8 +39,7 @@ /** * You should add more #includes here */ -#include "okapi/api.hpp" -#include "Graphy/Grapher.hpp" +//#include "okapi/api.hpp" //#include "pros/api_legacy.h" /** @@ -53,7 +52,7 @@ */ // using namespace pros; // using namespace pros::literals; -using namespace okapi; +// using namespace okapi; /** * Prototypes for the competition control tasks are redefined here to ensure diff --git a/include/pros/gps.h b/include/pros/gps.h index 1b2e7e7..917f693 100644 --- a/include/pros/gps.h +++ b/include/pros/gps.h @@ -188,6 +188,91 @@ double gps_get_error(uint8_t port); */ gps_status_s_t gps_get_status(uint8_t port); +/** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_x_position(uint8_t port); + +/** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_y_position(uint8_t port); + +/** + * Gets the pitch of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The pitch in (-90,90] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_pitch(uint8_t port); + +/** + * Gets the roll of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The roll in (-180,180] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_roll(uint8_t port); + +/** + * Gets the yaw of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The yaw in (-180,180] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_yaw(uint8_t port); + /** * Get the heading in [0,360) degree values. * diff --git a/include/pros/gps.hpp b/include/pros/gps.hpp index fce40c2..7a32123 100644 --- a/include/pros/gps.hpp +++ b/include/pros/gps.hpp @@ -52,8 +52,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Cartesian 4-Quadrant X offset from center of turning (meters) @@ -77,8 +77,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Cartesian 4-Quadrant X offset from center of turning (meters) @@ -95,8 +95,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Pointer to cartesian 4-Quadrant X offset from center of turning (meters) @@ -113,8 +113,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xInitial * Initial 4-Quadrant X Position, with (0,0) being at the center of the field (meters) @@ -133,8 +133,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param rate * Data rate in milliseconds (Minimum: 5 ms) @@ -149,8 +149,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return Possible RMS (Root Mean Squared) error in meters for GPS position. * If the operation failed, returns PROS_ERR_F and errno is set. @@ -163,8 +163,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * * \return A struct (gps_status_s_t) containing values mentioned above. @@ -173,14 +173,89 @@ class Gps { */ virtual pros::c::gps_status_s_t get_status() const; + /** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_x_position() const; + + /** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_y_position() const; + + /** + * Gets the pitch of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The pitch in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_pitch() const; + + /** + * Gets the roll of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The roll in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_roll() const; + + /** + * Gets the yaw of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The yaw in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_yaw() const; + /** * Get the heading in [0,360) degree values. * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * * \return The heading in [0,360) degree values. If the operation failed, @@ -194,8 +269,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The heading in [DOUBLE_MIN, DOUBLE_MAX] values. If the operation * fails, returns PROS_ERR_F and errno is set. @@ -208,8 +283,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The elased heading in degrees. If the operation fails, returns * PROS_ERR_F and errno is set. @@ -222,8 +297,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param target * Target rotation value to set rotation value to @@ -238,8 +313,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -252,8 +327,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The raw gyroscope values. If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. @@ -266,8 +341,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating. * * \param port * The V5 GPS's port number from 1-21 diff --git a/include/pros/imu.h b/include/pros/imu.h index f5a1cdc..d87508c 100644 --- a/include/pros/imu.h +++ b/include/pros/imu.h @@ -29,11 +29,20 @@ namespace c { #endif typedef enum imu_status_e { - E_IMU_STATUS_CALIBRATING = 0x01, - E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is - // necessarily in an error state + E_IMU_STATUS_READY = 0, // IMU is connected but not currently calibrating + E_IMU_STATUS_CALIBRATING = 1, // IMU is calibrating + E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is + // necessarily in an error state } imu_status_e_t; +typedef enum imu_orientation_e { + E_IMU_Z_UP = 0, // IMU has the Z axis UP (VEX Logo facing DOWN) + E_IMU_Z_DOWN = 1, // IMU has the Z axis DOWN (VEX Logo facing UP) + E_IMU_X_UP = 2, // IMU has the X axis UP + E_IMU_X_DOWN = 3, // IMU has the X axis DOWN + E_IMU_Y_UP = 4, // IMU has the Y axis UP + E_IMU_Y_DOWN = 5, // IMU has the Y axis DOWN +} imu_orientation_e_t; typedef struct __attribute__((__packed__)) quaternion_s { double x; double y; @@ -91,10 +100,10 @@ int32_t imu_reset(uint8_t port); /** * Calibrate IMU and Blocks while Calibrating * - * Calibration takes approximately 2 seconds and blocks during this period, + * Calibration takes approximately 2 seconds and blocks during this period, * with a timeout for this operation being set a 3 seconds as a safety margin. - * Like the other reset function, this function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * Like the other reset function, this function also blocks until the IMU + * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. * * This function uses the following values of errno when an error state is @@ -296,7 +305,6 @@ imu_accel_s_t imu_get_accel(uint8_t port); * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating * * \param port * The V5 Inertial Sensor port number from 1-21 @@ -309,7 +317,7 @@ imu_status_e_t imu_get_status(uint8_t port); // void imu_set_mode(uint8_t port, uint32_t mode); // uint32_t imu_get_mode(uint8_t port); -//Value reset functions: +// Value reset functions: /** * Resets the current reading of the Inertial Sensor's heading to zero * @@ -422,7 +430,7 @@ int32_t imu_tare_euler(uint8_t port); */ int32_t imu_tare(uint8_t port); -//Value set functions: +// Value set functions: /** * Sets the current reading of the Inertial Sensor's euler values to * target euler values. Will default to +/- 180 if target exceeds +/- 180. @@ -463,7 +471,7 @@ int32_t imu_set_rotation(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's heading to target value * Target will default to 360 if above 360 and default to 0 if below 0. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -482,7 +490,7 @@ int32_t imu_set_heading(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's pitch to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -501,7 +509,7 @@ int32_t imu_set_pitch(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's roll to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -520,7 +528,7 @@ int32_t imu_set_roll(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's yaw to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -536,6 +544,21 @@ int32_t imu_set_roll(uint8_t port, double target); */ int32_t imu_set_yaw(uint8_t port, double target); +/** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ +imu_orientation_e_t imu_get_physical_orientation(uint8_t port); + #ifdef __cplusplus } } diff --git a/include/pros/imu.hpp b/include/pros/imu.hpp index 99b28c8..3f6f393 100644 --- a/include/pros/imu.hpp +++ b/include/pros/imu.hpp @@ -19,6 +19,7 @@ #define _PROS_IMU_HPP_ #include + #include "pros/imu.h" namespace pros { @@ -31,47 +32,47 @@ class Imu { /** * Calibrate IMU * - * Calibration takes approximately 2 seconds and blocks during this period if - * the blocking param is true, with a timeout for this operation being set a 3 - * seconds as a safety margin. This function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * Calibration takes approximately 2 seconds and blocks during this period if + * the blocking param is true, with a timeout for this operation being set a 3 + * seconds as a safety margin. This function also blocks until the IMU + * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor * EAGAIN - The sensor is already calibrating, or time out setting the status flag. * - * \param blocking + * \param blocking * Whether this function blocks during calibration. * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. */ virtual std::int32_t reset(bool blocking = false) const; /** - * Set the Inertial Sensor's refresh interval in milliseconds. - * - * The rate may be specified in increments of 5ms, and will be rounded down to - * the nearest increment. The minimum allowable refresh rate is 5ms. The default - * rate is 10ms. - * - * As values are copied into the shared memory buffer only at 10ms intervals, - * setting this value to less than 10ms does not mean that you can poll the - * sensor's values any faster. However, it will guarantee that the data is as - * recent as possible. - * - * This function uses the following values of errno when an error state is - * reached: - * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating - * - * \param rate - * The data refresh interval in milliseconds - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - */ + * Set the Inertial Sensor's refresh interval in milliseconds. + * + * The rate may be specified in increments of 5ms, and will be rounded down to + * the nearest increment. The minimum allowable refresh rate is 5ms. The default + * rate is 10ms. + * + * As values are copied into the shared memory buffer only at 10ms intervals, + * setting this value to less than 10ms does not mean that you can poll the + * sensor's values any faster. However, it will guarantee that the data is as + * recent as possible. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * EAGAIN - The sensor is still calibrating + * + * \param rate + * The data refresh interval in milliseconds + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + */ virtual std::int32_t set_data_rate(std::uint32_t rate) const; /** * Get the total number of degrees the Inertial Sensor has spun about the z-axis @@ -310,7 +311,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's heading to target value * Target will default to 360 if above 360 and default to 0 if below 0. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -345,7 +346,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's yaw to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -380,7 +381,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's roll to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -435,7 +436,6 @@ class Imu { * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating * * \param port * The V5 Inertial Sensor port number from 1-21 @@ -450,6 +450,21 @@ class Imu { * false if it is not. */ virtual bool is_calibrating() const; + + /** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The physical orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ + virtual pros::c::imu_orientation_e_t get_physical_orientation() const; }; using IMU = Imu; diff --git a/include/pros/screen.h b/include/pros/screen.h index 8076daa..5c6b538 100644 --- a/include/pros/screen.h +++ b/include/pros/screen.h @@ -67,7 +67,7 @@ typedef struct screen_touch_status_s { #define TEXT_MEDIUM pros::E_TEXT_MEDIUM #define TEXT_LARGE pros::E_TEXT_LARGE #define TEXT_MEDIUM_CENTER pros::E_TEXT_MEDIUM_CENTER -#define TEXT_LARGE_CENTER pros::E_LARGE_CENTER +#define TEXT_LARGE_CENTER pros::E_TEXT_LARGE_CENTER #define TOUCH_RELEASED pros::E_TOUCH_RELEASED #define TOUCH_PRESSED pros::E_TOUCH_PRESSED #define TOUCH_HELD pros::E_TOUCH_HELD diff --git a/project.pros b/project.pros index 506c0f2..36d1e0a 100644 --- a/project.pros +++ b/project.pros @@ -7,7 +7,7 @@ "kernel": { "py/object": "pros.conductor.templates.local_template.LocalTemplate", "py/state": { - "location": "/Users/jasonzhou/Library/Application Support/PROS/templates/kernel@3.8.0", + "location": "/Users/jasonzhou/Library/Application Support/PROS/templates/kernel@3.8.3", "metadata": { "cold_addr": "58720256", "cold_output": "bin/cold.package.bin", @@ -19,152 +19,152 @@ "name": "kernel", "supported_kernels": null, "system_files": [ - "include/display/lv_core/lv_vdb.h", - "include/display/lv_core/lv_core.mk", - "include/display/lv_misc/lv_math.h", - "include/display/lv_objx/lv_tabview.h", - "include/display/lv_misc/lv_color.h", - "include/display/lv_hal/lv_hal_indev.h", - "include/display/lv_fonts/lv_fonts.mk", - "include/display/lv_misc/lv_symbol_def.h", - "include/display/lv_hal/lv_hal.mk", - "include/display/lv_themes/lv_theme_night.h", - "include/display/lv_draw/lv_draw_triangle.h", - "include/pros/optical.hpp", - "include/display/lv_draw/lv_draw_vbasic.h", - "include/display/lv_objx/lv_objx_templ.h", - "include/display/lv_core/lv_refr.h", - "include/pros/link.hpp", - "include/display/lv_objx/lv_btnm.h", - "include/display/lv_objx/lv_cb.h", - "firmware/v5-common.ld", - "include/pros/ext_adi.h", - "include/pros/rotation.h", - "include/display/lv_objx/lv_spinbox.h", - "include/display/lv_misc/lv_circ.h", - "include/display/lv_misc/lv_mem.h", - "include/display/lv_objx/lv_page.h", - "include/display/lv_objx/lv_ddlist.h", - "include/display/lv_core/lv_group.h", - "include/display/lvgl.h", - "include/display/lv_objx/lv_chart.h", - "include/pros/distance.h", - "include/display/lv_objx/lv_list.h", - "include/pros/vision.h", - "include/pros/misc.hpp", - "include/display/lv_draw/lv_draw.h", - "include/display/lv_objx/lv_label.h", - "include/display/lv_misc/lv_font.h", - "include/display/lv_draw/lv_draw_img.h", - "include/display/lv_misc/lv_log.h", - "include/display/lv_misc/lv_templ.h", - "include/pros/llemu.h", - "include/display/lv_objx/lv_btn.h", - "include/display/lv_fonts/lv_font_builtin.h", - "include/display/lv_objx/lv_calendar.h", - "firmware/libm.a", - "include/display/lv_conf.h", - "include/display/lv_objx/lv_sw.h", - "include/display/lv_draw/lv_draw_rect.h", - "include/display/lv_objx/lv_cont.h", - "include/pros/vision.hpp", - "include/display/lv_objx/lv_mbox.h", - "include/pros/adi.hpp", - "include/pros/imu.hpp", - "include/display/lv_objx/lv_table.h", - "include/pros/screen.hpp", - "include/display/lv_draw/lv_draw_label.h", - "include/display/lv_misc/lv_txt.h", - "include/pros/api_legacy.h", - "include/display/lv_objx/lv_lmeter.h", - "include/display/lv_themes/lv_theme_templ.h", - "include/pros/apix.h", - "include/display/lv_draw/lv_draw.mk", - "include/display/lv_themes/lv_theme_alien.h", - "include/pros/colors.hpp", - "include/display/lv_objx/lv_img.h", - "firmware/libc.a", - "include/display/lv_themes/lv_theme_zen.h", - "include/display/lv_themes/lv_theme_material.h", - "include/display/lv_draw/lv_draw_arc.h", - "include/display/lv_themes/lv_theme_mono.h", - "include/display/lv_themes/lv_themes.mk", - "include/display/lv_objx/lv_slider.h", - "include/pros/serial.h", - "include/display/lv_themes/lv_theme.h", - "include/display/README.md", - "include/display/lv_objx/lv_canvas.h", - "include/pros/misc.h", - "include/display/lv_misc/lv_fs.h", - "include/pros/rtos.h", - "include/display/lv_core/lv_indev.h", - "include/pros/motors.hpp", - "include/display/lv_core/lv_style.h", - "include/display/lv_version.h", - "include/display/lv_core/lv_lang.h", - "include/api.h", - "include/display/lv_objx/lv_gauge.h", - "include/pros/rtos.hpp", - "include/display/lv_hal/lv_hal_disp.h", - "include/pros/motors.h", - "include/display/lv_objx/lv_led.h", - "include/display/lv_draw/lv_draw_rbasic.h", - "include/display/lv_objx/lv_kb.h", - "include/display/lv_conf_checker.h", - "include/display/lv_hal/lv_hal.h", - "include/display/lv_draw/lv_draw_line.h", - "include/pros/gps.hpp", - "include/display/lv_objx/lv_objx.mk", - "include/display/lv_objx/lv_win.h", - "include/display/lv_core/lv_obj.h", - "include/display/lv_objx/lv_arc.h", - "include/pros/link.h", - "include/display/lv_objx/lv_preload.h", - "include/display/lv_misc/lv_area.h", - "include/display/lv_misc/lv_ll.h", - "include/pros/optical.h", - "include/pros/serial.hpp", - "include/pros/screen.h", - "include/display/lv_themes/lv_theme_nemo.h", - "include/pros/llemu.hpp", - "firmware/libpros.a", - "include/display/lv_misc/lv_gc.h", - "include/display/lv_misc/lv_anim.h", - "include/display/lv_objx/lv_line.h", - "include/pros/distance.hpp", - "include/pros/rotation.hpp", - "include/pros/error.h", - "include/display/lv_objx/lv_tileview.h", - "include/pros/gps.h", - "include/display/lv_misc/lv_task.h", - "include/pros/imu.h", - "firmware/v5-hot.ld", - "include/display/lv_misc/lv_misc.mk", - "include/pros/colors.h", + "include\\display\\lv_themes\\lv_theme_mono.h", + "include\\display\\lv_themes\\lv_theme_nemo.h", + "include\\display\\lv_objx\\lv_calendar.h", + "include\\display\\lv_themes\\lv_theme_zen.h", + "include\\display\\lv_objx\\lv_spinbox.h", + "include\\pros\\screen.hpp", + "include\\display\\lv_objx\\lv_ddlist.h", + "include\\display\\lv_themes\\lv_theme.h", + "include\\display\\lv_hal\\lv_hal.h", + "include\\display\\lv_draw\\lv_draw_arc.h", + "include\\display\\lv_objx\\lv_list.h", + "include\\display\\lv_themes\\lv_themes.mk", + "include\\pros\\motors.hpp", + "include\\pros\\adi.h", + "include\\display\\lv_draw\\lv_draw.h", + "include\\pros\\colors.hpp", + "include\\display\\licence.txt", + "include\\display\\lv_draw\\lv_draw_img.h", + "include\\display\\lv_fonts\\lv_fonts.mk", + "include\\display\\lv_draw\\lv_draw_rect.h", + "include\\display\\lv_core\\lv_group.h", + "include\\display\\lv_draw\\lv_draw_label.h", + "include\\pros\\llemu.h", + "include\\pros\\error.h", + "include\\display\\lv_misc\\lv_ufs.h", + "firmware\\libm.a", + "include\\display\\lv_objx\\lv_led.h", + "include\\display\\lv_objx\\lv_btn.h", + "include\\display\\lv_misc\\lv_misc.mk", + "include\\display\\lv_objx\\lv_canvas.h", + "include\\display\\lv_objx\\lv_preload.h", + "include\\pros\\misc.hpp", + "include\\display\\lv_misc\\lv_fs.h", + "include\\pros\\rotation.hpp", + "include\\pros\\colors.h", + "include\\pros\\vision.hpp", + "include\\display\\lv_objx\\lv_img.h", + "include\\display\\lv_fonts\\lv_font_builtin.h", + "include\\display\\lv_objx\\lv_lmeter.h", + "include\\display\\lv_misc\\lv_font.h", + "firmware\\v5.ld", + "include\\display\\lv_objx\\lv_tileview.h", + "include\\display\\lv_hal\\lv_hal_tick.h", + "include\\display\\lv_core\\lv_vdb.h", + "include\\display\\lv_core\\lv_indev.h", + "include\\pros\\vision.h", + "firmware\\v5-hot.ld", + "include\\display\\lv_objx\\lv_kb.h", + "include\\display\\lv_misc\\lv_symbol_def.h", + "firmware\\libc.a", + "include\\display\\lv_objx\\lv_label.h", + "include\\display\\lv_objx\\lv_tabview.h", + "firmware\\libpros.a", + "include\\display\\lv_misc\\lv_ll.h", + "include\\display\\lv_misc\\lv_log.h", + "include\\pros\\screen.h", + "include\\display\\lv_hal\\lv_hal.mk", + "include\\pros\\serial.hpp", + "include\\pros\\optical.hpp", + "include\\display\\lv_misc\\lv_txt.h", + "include\\display\\lv_misc\\lv_task.h", + "firmware\\v5-common.ld", + "include\\pros\\optical.h", + "include\\pros\\rtos.hpp", + "include\\display\\lv_conf_checker.h", + "include\\display\\lv_misc\\lv_math.h", + "include\\display\\lv_draw\\lv_draw_rbasic.h", + "include\\display\\lv_themes\\lv_theme_alien.h", + "include\\pros\\motors.h", + "include\\pros\\misc.h", + "include\\display\\lv_themes\\lv_theme_default.h", + "include\\pros\\gps.h", + "include\\display\\lv_misc\\lv_templ.h", + "include\\display\\lv_misc\\lv_circ.h", + "include\\api.h", + "include\\display\\lv_objx\\lv_ta.h", + "include\\display\\lv_draw\\lv_draw_triangle.h", + "include\\display\\lv_misc\\lv_mem.h", + "include\\display\\lv_objx\\lv_imgbtn.h", + "include\\pros\\link.h", + "include\\display\\lv_version.h", + "include\\display\\lv_conf.h", + "include\\display\\lv_objx\\lv_mbox.h", + "include\\display\\lv_misc\\lv_anim.h", + "include\\display\\lv_hal\\lv_hal_indev.h", + "include\\display\\lv_objx\\lv_btnm.h", + "include\\display\\lv_misc\\lv_color.h", + "include\\display\\lv_draw\\lv_draw_vbasic.h", + "include\\pros\\distance.hpp", + "include\\display\\lv_objx\\lv_bar.h", + "include\\display\\lv_objx\\lv_gauge.h", + "include\\display\\lv_draw\\lv_draw.mk", + "include\\display\\lvgl.h", + "include\\display\\lv_objx\\lv_slider.h", + "include\\display\\lv_objx\\lv_objx.mk", + "include\\display\\README.md", + "include\\display\\lv_core\\lv_lang.h", + "include\\display\\lv_objx\\lv_arc.h", + "include\\pros\\serial.h", + "include\\pros\\llemu.hpp", + "include\\pros\\adi.hpp", + "include\\display\\lv_objx\\lv_table.h", + "include\\display\\lv_draw\\lv_draw_line.h", + "include\\display\\lv_misc\\lv_area.h", + "include\\display\\lv_core\\lv_core.mk", + "include\\display\\lv_objx\\lv_line.h", + "include\\display\\lv_hal\\lv_hal_disp.h", + "include\\display\\lv_misc\\lv_gc.h", + "include\\pros\\rotation.h", + "include\\display\\lv_themes\\lv_theme_material.h", + "include\\display\\lv_core\\lv_style.h", + "include\\display\\lv_objx\\lv_cb.h", + "include\\display\\lv_objx\\lv_chart.h", "common.mk", - "include/display/lv_objx/lv_roller.h", - "include/display/lv_objx/lv_bar.h", - "include/display/lv_themes/lv_theme_default.h", - "firmware/v5.ld", - "include/display/lv_misc/lv_ufs.h", - "include/display/lv_hal/lv_hal_tick.h", - "include/display/licence.txt", - "include/display/lv_objx/lv_ta.h", - "include/display/lv_objx/lv_imgbtn.h", - "include/pros/adi.h" + "include\\pros\\ext_adi.h", + "include\\display\\lv_objx\\lv_objx_templ.h", + "include\\display\\lv_core\\lv_refr.h", + "include\\display\\lv_core\\lv_obj.h", + "include\\pros\\api_legacy.h", + "include\\pros\\rtos.h", + "include\\pros\\imu.h", + "include\\display\\lv_objx\\lv_win.h", + "include\\display\\lv_objx\\lv_cont.h", + "include\\display\\lv_themes\\lv_theme_templ.h", + "include\\pros\\link.hpp", + "include\\pros\\distance.h", + "include\\display\\lv_objx\\lv_roller.h", + "include\\display\\lv_objx\\lv_sw.h", + "include\\pros\\imu.hpp", + "include\\pros\\gps.hpp", + "include\\display\\lv_themes\\lv_theme_night.h", + "include\\pros\\apix.h", + "include\\display\\lv_objx\\lv_page.h" ], "target": "v5", "user_files": [ - "src/main.cc", - ".gitignore", + "include\\main.h", + "src\\main.c", + "include\\main.hpp", + "include\\main.hh", + "src\\main.cpp", + "src\\main.cc", "Makefile", - "src/main.cpp", - "src/main.c", - "include/main.hpp", - "include/main.hh", - "include/main.h" + ".gitignore" ], - "version": "3.8.0" + "version": "3.8.3" } }, "okapilib": { diff --git a/src/main.cpp b/src/main.cpp index 2c78220..c2fbbf5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,23 +74,20 @@ void autonomous() {} * task, not resume it from where it left off. */ void opcontrol() { - std::shared_ptr kalmanFilter(new EKFFilter()); - std::shared_ptr emaFilter(new EmaFilter(0.1)); + pros::Controller master(pros::E_CONTROLLER_MASTER); + pros::Motor left_mtr(1); + pros::Motor right_mtr(2); - std::shared_ptr grapher(new graphy::AsyncGrapher("Flywheel Velocity vs. Time")); + while (true) { + pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2, + (pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1, + (pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0); + int left = master.get_analog(ANALOG_LEFT_Y); + int right = master.get_analog(ANALOG_RIGHT_Y); - grapher->addDataType("Ema Vel", COLOR_ORANGE); - grapher->addDataType("Desired Vel", COLOR_AQUAMARINE); - grapher->addDataType("Kalman Vel", COLOR_RED); + left_mtr = left; + right_mtr = right; - grapher->activateAutoZoom(); - - grapher->startTask(); - pros::ADIAnalogIn pot('A'); - while(true) { - grapher->update("Desired Vel", ((pot.get_value()-10) / 4095.0)); - grapher->update("Kalman Vel", kalmanFilter->filter(((pot.get_value()-10) / 4095.0))); - grapher->update("Ema Vel", emaFilter->filter(((pot.get_value()-10) / 4095.0))); - pros::delay(10); - } + pros::delay(20); + } }