Skip to content

Commit

Permalink
Merge branch 'develop' into encoder-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
calebchalmers committed Nov 23, 2024
2 parents f372757 + 38bb8b8 commit 882b481
Show file tree
Hide file tree
Showing 77 changed files with 2,201 additions and 744 deletions.
170 changes: 170 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Based on template from https://github.com/gitattributes/gitattributes

# Auto detect text files and perform LF normalization
* text=auto

#
# Common
#

# Documents
*.bibtex text diff=bibtex
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text diff=markdown
*.mdx text diff=markdown
*.tex text diff=tex
*.adoc text
*.textile text
*.mustache text
*.csv text eol=crlf
*.tab text
*.tsv text
*.txt text
*.sql text
*.epub diff=astextplain

# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as text by default.
*.svg text
# If you want to treat it as binary,
# use the following line instead.
# *.svg binary
*.eps binary

# Scripts
*.bash text eol=lf
*.fish text eol=lf
*.ksh text eol=lf
*.sh text eol=lf
*.zsh text eol=lf
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# Serialisation
*.json text
*.toml text
*.xml text
*.yaml text
*.yml text

# Archives
*.7z binary
*.bz binary
*.bz2 binary
*.bzip2 binary
*.gz binary
*.lz binary
*.lzma binary
*.rar binary
*.tar binary
*.taz binary
*.tbz binary
*.tbz2 binary
*.tgz binary
*.tlz binary
*.txz binary
*.xz binary
*.Z binary
*.zip binary
*.zst binary

# Text files where line endings should be preserved
*.patch -text

#
# C++
#

# Sources
*.c text diff=cpp
*.cc text diff=cpp
*.cxx text diff=cpp
*.cpp text diff=cpp
*.cpi text diff=cpp
*.c++ text diff=cpp
*.hpp text diff=cpp
*.h text diff=cpp
*.h++ text diff=cpp
*.hh text diff=cpp

# Compiled Object files
*.slo binary
*.lo binary
*.o binary
*.obj binary

# Precompiled Headers
*.gch binary
*.pch binary

# Compiled Dynamic libraries
*.so binary
*.dylib binary
*.dll binary

# Compiled Static libraries
*.lai binary
*.la binary
*.a binary
*.lib binary

# Executables
*.exe binary
*.out binary
*.app binary

#
# Python
#

# Source files
*.pxd text diff=python
*.py text diff=python
*.py3 text diff=python
*.pyw text diff=python
*.pyx text diff=python
*.pyz text diff=python
*.pyi text diff=python

# Binary files
*.db binary
*.p binary
*.pkl binary
*.pickle binary
*.pyc binary export-ignore
*.pyo binary export-ignore
*.pyd binary

# Jupyter notebook
*.ipynb text eol=lf

# Note: .db, .p, and .pkl files are associated
# with the python modules ``pickle``, ``dbm.*``,
# ``shelve``, ``marshal``, ``anydbm``, & ``bsddb``
# (among others).

#
# Exclude files from exporting
#

.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fetch-depth: 0

- name: Lint
uses: super-linter/super-linter/slim@v6.3.0
uses: super-linter/super-linter/slim@v7
env:
VALIDATE_CLANG_FORMAT: true
VALIDATE_ALL_CODEBASE: false
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ gcov-result

docs/_build
docs/api
docs/doxyoutput
docs/doxyoutput

.DS_Store
2 changes: 1 addition & 1 deletion taproot
Submodule taproot updated from 6d87b0 to 22b708
16 changes: 16 additions & 0 deletions ut-robomaster/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
<option name="taproot:board:analog_in_pins"></option>
<option name="taproot:board:pwm_pins">C1,C2,C3,C4,C5,C6,C7,Buzzer,ImuHeater</option>

<option name="taproot:modm-project.xml:modm_hal_modules">
modm:platform:i2c:2
modm:platform:rtt
</option>

<option name="taproot:modm-project.xml:modm_hal_options">
modm:platform:rtt:buffer.rx 0,00,000,0000
modm:platform:rtt:buffer.tx 1024,0b10000000000,0o2000,0x400
modm:platform:uart:1:buffer.rx 256
modm:platform:uart:1:buffer.tx 256
modm:platform:uart:3:buffer.tx 256
modm:platform:uart:3:buffer.rx 256
modm:platform:uart:6:buffer.rx 256
modm:platform:uart:6:buffer.tx 256
</option>

</options>
<modules>
<module>taproot:core</module>
Expand Down
8 changes: 7 additions & 1 deletion ut-robomaster/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ static void updateIo(src::Drivers *drivers)
drivers->remote.read();
}

static void updateImu(src::Drivers *drivers)
{
drivers->bmi088.read();
drivers->bmi088.periodicIMUUpdate();
}

src::Drivers drivers;
RobotControl control{&drivers};

Expand All @@ -61,7 +67,7 @@ int main()

if (refreshTimer.execute())
{
PROFILE(drivers.profiler, drivers.bmi088.periodicIMUUpdate, ());
PROFILE(drivers.profiler, updateImu, (&drivers));
PROFILE(drivers.profiler, drivers.commandScheduler.run, ());
PROFILE(drivers.profiler, drivers.djiMotorTxHandler.encodeAndSendCanData, ());
PROFILE(drivers.profiler, drivers.terminalSerial.update, ());
Expand Down
43 changes: 8 additions & 35 deletions ut-robomaster/src/robots/common/common_control_manual.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
#include "tap/control/toggle_command_mapping.hpp"

#include "robots/common/common_control.hpp"
#include "subsystems/chassis/command_move_chassis_joystick.hpp"
#include "subsystems/chassis/command_move_chassis_keyboard.hpp"
#include "subsystems/chassis/command_move_chassis.hpp"
#include "subsystems/flywheel/command_flywheel_off.hpp"
#include "subsystems/flywheel/command_rotate_flywheel.hpp"
#include "subsystems/turret/command_move_turret.hpp"
#include "subsystems/turret/command_move_turret_aimbot.hpp"
#include "subsystems/turret/command_move_turret_joystick.hpp"
#include "subsystems/turret/command_move_turret_mouse.hpp"

class CommonControlManual : protected CommonControl
{
Expand All @@ -27,56 +25,31 @@ class CommonControlManual : protected CommonControl
drivers->commandMapper.addMap(&keyGToggled);

// Controller
drivers->commandMapper.addMap(&rightSwitchUp);
drivers->commandMapper.addMap(&rightSwitchMid);
// drivers->commandMapper.addMap(&rightSwitchDown);
drivers->commandMapper.addMap(&leftSwitchMid);

chassis.setDefaultCommand(&move_Keyboard);
turret.setDefaultCommand(&look_Mouse);
chassis.setDefaultCommand(&move);
turret.setDefaultCommand(&look);
}

// Commands
CommandMoveChassisJoystick moveChassisRelative_Joystick{drivers, &chassis, &turret};
CommandMoveChassisJoystick moveTurretRelative_Joystick{drivers, &chassis, &turret, true};
CommandMoveChassisKeyboard move_Keyboard{drivers, &chassis, &turret};
CommandMoveChassisKeyboard moveAndBeyblade_Keyboard{drivers, &chassis, &turret, true};
CommandMoveChassis move{drivers, &chassis, &turret, true, false};
CommandMoveChassis moveBeyblade{drivers, &chassis, &turret, true, true};

CommandRotateFlywheel rotateFlywheel_Keyboard{drivers, &flywheel};
CommandRotateFlywheel rotateFlywheel_SwitchUp{drivers, &flywheel};
CommandRotateFlywheel rotateFlywheel_SwitchMid{drivers, &flywheel};

CommandMoveTurretJoystick look_Joystick_SwitchMid{drivers, &turret};
CommandMoveTurretJoystick look_Joystick_SwitchUp{drivers, &turret};
CommandMoveTurretMouse look_Mouse{drivers, &turret};
CommandMoveTurret look{drivers, &turret};

// Keyboard mappings
ToggleCommandMapping keyRToggled{
drivers,
{&moveAndBeyblade_Keyboard},
RemoteMapState({Remote::Key::R})};
ToggleCommandMapping keyRToggled{drivers, {&moveBeyblade}, RemoteMapState({Remote::Key::R})};

ToggleCommandMapping keyGToggled{
drivers,
{&rotateFlywheel_Keyboard},
RemoteMapState({Remote::Key::G})};

// Controller mappings
HoldCommandMapping rightSwitchUp{
drivers,
{&moveTurretRelative_Joystick, &look_Joystick_SwitchUp},
RemoteMapState(Remote::Switch::RIGHT_SWITCH, Remote::SwitchState::UP)};

HoldCommandMapping rightSwitchMid{
drivers,
{&moveChassisRelative_Joystick, &look_Joystick_SwitchMid},
RemoteMapState(Remote::Switch::RIGHT_SWITCH, Remote::SwitchState::MID)};

// HoldCommandMapping rightSwitchDown{
// drivers,
// {&move_Keyboard, &look_Mouse},
// RemoteMapState(Remote::Switch::RIGHT_SWITCH, Remote::SwitchState::DOWN)};

HoldCommandMapping leftSwitchMid{
drivers,
{&rotateFlywheel_SwitchUp},
Expand Down
20 changes: 15 additions & 5 deletions ut-robomaster/src/subsystems/agitator/agitator_subsystem.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#include "agitator_subsystem.hpp"

#include "subsystems/subsystem.hpp"

namespace subsystems::agitator
{

using tap::algorithms::compareFloatClose;
using tap::arch::clock::getTimeMilliseconds;

/**
* AgitatorSubsystem class instantiation
*/
#if defined(TARGET_STANDARD) || defined(TARGET_SENTRY)
AgitatorSubsystem::AgitatorSubsystem(
src::Drivers* drivers,
Expand Down Expand Up @@ -48,9 +46,11 @@ void AgitatorSubsystem::refresh()
return;
#endif

setAmputated(!hardwareOk());

float time = getTimeMilliseconds() / 1000.0f;
float velocity = getShapedVelocity(time, 1.0f, 0.0f, ballsPerSecond);
bool killSwitch = drivers->isKillSwitched() || !flywheel->isActive();
bool killSwitch = drivers->isKillSwitched() || isAmputated() || !flywheel->isActive();

agitator.setActive(!killSwitch);
agitator.updateVelocity(velocity);
Expand All @@ -70,4 +70,14 @@ float AgitatorSubsystem::getShapedVelocity(float time, float a, float phi, float
void AgitatorSubsystem::setBallsPerSecond(float bps) { ballsPerSecond = bps; }
float AgitatorSubsystem::getPosition() { return agitator.measurePosition(); }
float AgitatorSubsystem::getVelocity() { return agitator.measureVelocity(); }

bool AgitatorSubsystem::hardwareOk()
{
#ifdef TARGET_HERO
return agitator.isOnline() && feeder.isOnline();
#else
return agitator.isOnline();
#endif
}

} // namespace subsystems::agitator
Loading

0 comments on commit 882b481

Please sign in to comment.