Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop back into remote-debug branch #121

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
72eb90e
Added code for encoder, need to resolve initialization error
vinle0 Mar 6, 2024
72993e1
Interface to read/write angle to encoder
vinle0 Mar 8, 2024
d3069e1
Bigger, better sounds
calebchalmers Mar 13, 2024
000ab3d
Add spider dance song
calebchalmers Mar 15, 2024
d2a70d7
Add looping
calebchalmers Mar 20, 2024
08cb9bb
Rebuild taproot with I2C channel 2
calebchalmers Mar 20, 2024
6bdc57b
Merge remote-tracking branch 'origin' into encoder
vinle0 Mar 22, 2024
1cda71c
unjamming logic
JasonKlm Mar 23, 2024
80a4e28
Writing for individual transaction
vinle0 Mar 23, 2024
afce283
revised unjam logic
JasonKlm Mar 29, 2024
03964c7
revised unjam math
JasonKlm Mar 29, 2024
d2e04b2
reverted changes
JasonKlm Mar 29, 2024
6198e23
Attempt to add debugging to encoder. Fix error possibly with template…
vinle0 Mar 30, 2024
04ed435
Attempt to add debugging to encoder. Fix error possibly with template…
vinle0 Mar 30, 2024
de47c41
Merge branch 'encoder' of https://github.com/ut-ras/robomaster into e…
vinle0 Mar 30, 2024
eec7d6b
Revert VSCode settings
calebchalmers Mar 31, 2024
d0e942d
Move encoder impl to header
calebchalmers Mar 31, 2024
91ab1d6
Refactor unjam code, add constants
calebchalmers Mar 31, 2024
8a90613
Adjust robot constants
calebchalmers Mar 31, 2024
f3d6837
Merge pull request #107 from ut-ras/agitator-unjam
calebchalmers Mar 31, 2024
6397f28
Fix some encoder things
calebchalmers Apr 5, 2024
01e797e
Merge branch 'encoder' of https://github.com/ut-ras/robomaster into e…
vinle0 Apr 5, 2024
1a95ffd
created demo constants
Redfalcon5-ai Apr 5, 2024
2856f9e
Add encoder driver
calebchalmers Apr 13, 2024
8c757c3
Encoder works!!
calebchalmers Apr 14, 2024
4e8ff82
Move and rename driver stuff
calebchalmers Apr 14, 2024
c69ebb1
Remove test encoder from drivers
calebchalmers Apr 14, 2024
4e80479
Fix main `updateIo`
calebchalmers Apr 14, 2024
2c11325
Merge pull request #104 from ut-ras/better-sounds
calebchalmers Apr 17, 2024
6de9428
Add generic encoder interface
calebchalmers Apr 18, 2024
3bea353
Add double yaw motor controller using encoder
calebchalmers Apr 18, 2024
7fa740f
Merge branch 'encoder' of https://github.com/ut-ras/robomaster into e…
vinle0 Apr 18, 2024
3e16f31
Reorganized constants & added motor struct
JasonKlm Apr 26, 2024
b5d6d1b
Modified double yaw for conditions
vinle0 May 15, 2024
d57405f
Add turret motor struct constants
calebchalmers May 15, 2024
87e8bcb
Finish converting motor constants to structs
calebchalmers May 16, 2024
7545cdb
Adjust standard demo mode turret speeds
calebchalmers May 16, 2024
6d274e4
Reorder a few constants
calebchalmers May 16, 2024
2230af5
Merge pull request #117 from ut-ras/demo-mode
calebchalmers May 16, 2024
e33b85a
Remove double turret stuff from turret subsystem
calebchalmers May 16, 2024
5b2d2c1
Revert unneeded changes
calebchalmers May 16, 2024
139953d
Merge branch 'develop' into encoder
calebchalmers May 16, 2024
9d0e6d0
Fix formatting error
calebchalmers May 16, 2024
8654c08
Merge pull request #108 from ut-ras/encoder
calebchalmers May 16, 2024
6b25d3c
Add isOnline to turret motor classes
calebchalmers May 16, 2024
6192b15
Rename motor structs
calebchalmers May 16, 2024
2ddc4ff
Move motor utils and use configs for turret motors
calebchalmers May 16, 2024
753ba88
Scale double yaw outputs for M3508 motors
calebchalmers May 16, 2024
f6b567e
Incorporate double-yaw into standard and hero
calebchalmers May 16, 2024
64a4645
Fix encoder direction
calebchalmers May 17, 2024
af8dcb7
Merge pull request #119 from ut-ras/double-yaw
calebchalmers May 17, 2024
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
32 changes: 16 additions & 16 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Hardware",
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"preLaunchTask": "Flash - Debug",
"executable": "./ut-robomaster/build/hardware/scons-debug/ut-robomaster.elf",
"device": "STM32F427II",
"configFiles": [
"./ut-robomaster/openocd.cfg"
]
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Debug Hardware",
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"preLaunchTask": "Flash - Debug",
"executable": "./ut-robomaster/build/hardware/scons-debug/ut-robomaster.elf",
"device": "STM32F427II",
"configFiles": [
"./ut-robomaster/openocd.cfg"
]
}
]
}
192 changes: 99 additions & 93 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,96 +1,102 @@
{
"editor.tabSize": 4,
"editor.formatOnSave": true,
"terminal.integrated.cwd": "ut-robomaster",
"files.associations": {
"array": "cpp",
"string": "cpp",
"string_view": "cpp",
"functional": "cpp",
"limits": "cpp",
"any": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cuchar": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"scoped_allocator": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"SConstruct": "python",
"SConscript": "python",
"stop_token": "cpp",
"cassert": "cpp"
"editor.tabSize": 4,
"editor.formatOnSave": true,
"terminal.integrated.cwd": "ut-robomaster",
"files.associations": {
"array": "cpp",
"string": "cpp",
"string_view": "cpp",
"functional": "cpp",
"limits": "cpp",
"any": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cuchar": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"scoped_allocator": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"SConstruct": "python",
"SConscript": "python",
"stop_token": "cpp",
"cassert": "cpp",
"bit": "cpp",
"compare": "cpp",
"concepts": "cpp",
"numbers": "cpp",
"ranges": "cpp",
"span": "cpp"
},
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.default.includePath": [
"ut-robomaster/src",
"ut-robomaster/taproot/src",
],
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.default.cStandard": "c11",
"[markdown]": {
"editor.wordWrap": "off",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
},
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.default.includePath": [
"ut-robomaster/src",
"ut-robomaster/taproot/src",
],
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.default.cStandard": "c11",
"[markdown]": {
"editor.wordWrap": "off",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
},
"editor.rulers": [
100
]
}
"editor.rulers": [
100
]
}
}
16 changes: 16 additions & 0 deletions ut-robomaster/src/board.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include "tap/board/board.hpp"

namespace Board
{
using I2cSda = DigitalInPinPF0;
using I2cScl = DigitalInPinPF1;
using I2cMaster = I2cMaster2;

inline void initialize_i2c()
{
I2cMaster::connect<I2cSda::Sda, I2cScl::Scl>(I2cMaster::PullUps::Internal);
I2cMaster::initialize<SystemClock>();
}
} // namespace Board
57 changes: 28 additions & 29 deletions ut-robomaster/src/drivers.hpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
#ifndef DRIVERS_HPP_
#define DRIVERS_HPP_

#include "tap/drivers.hpp"

#include "communication/cv_board.hpp"
#include "utils/robot_comms.hpp"

namespace src
{
class Drivers : public tap::Drivers
{
friend class DriversSingleton;

#ifdef ENV_UNIT_TESTS
public:
#endif
Drivers() : tap::Drivers(), cvBoard(this), terminal(this) {}

public:
communication::CVBoard cvBoard;
comms::RobotComms terminal;

bool isKillSwitched() { return !remote.isConnected(); }
}; // class Drivers

} // namespace src

#endif // DRIVERS_HPP_
#ifndef DRIVERS_HPP_
#define DRIVERS_HPP_

#include "tap/drivers.hpp"

#include "communication/cv_board.hpp"
#include "utils/robot_comms.hpp"

namespace src
{
class Drivers : public tap::Drivers
{
friend class DriversSingleton;

#ifdef ENV_UNIT_TESTS
public:
#endif
Drivers() : tap::Drivers(), cvBoard(this), terminal(this) {}

public:
communication::CVBoard cvBoard;
comms::RobotComms terminal;
bool isKillSwitched() { return !remote.isConnected(); }
}; // class Drivers

} // namespace src

#endif // DRIVERS_HPP_
61 changes: 61 additions & 0 deletions ut-robomaster/src/drivers/as5600.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#pragma once

#include "modm/architecture/interface/i2c_device.hpp"
#include "modm/processing/protothread/protothread.hpp"

#include "board.hpp"
#include "encoder.hpp"

namespace driver
{
using Board::I2cMaster;
class As5600 : public Encoder, public modm::I2cDevice<I2cMaster, 1>, public modm::pt::Protothread
{
public:
As5600() : modm::I2cDevice<I2cMaster, 1>(ADDRESS){};

void update() { run(); }

bool run()
{
PT_BEGIN();

while (true)
{
buffer[0] = uint8_t(Register::RAWANGLE);
PT_WAIT_UNTIL(this->startWriteRead(buffer, 1, buffer, 2));
PT_WAIT_WHILE(this->isTransactionRunning());

if (this->wasTransactionSuccessful())
{
angle = (buffer[0] << 8) | buffer[1];
}
}

PT_END();
}

float getAngle() override { return angle / 4096.0f; }

protected:
enum class Register : uint8_t
{
ZPOS = 0x01,
MPOS = 0x03,
CONF = 0x07,

RAWANGLE = 0x0C,
ANGLE = 0x0E,

STATUS = 0x0B,
AGC = 0x1A,
MAG = 0x1B,
};

private:
static const uint8_t ADDRESS = 0x36;
uint16_t angle = 0;
uint8_t buffer[2];
};

}; // namespace driver
14 changes: 14 additions & 0 deletions ut-robomaster/src/drivers/encoder.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

namespace driver
{
class Encoder
{
public:
virtual ~Encoder() {}

/// @brief Get current measured angle of the encoder
/// @return Angle (revs)
virtual float getAngle() = 0;
};
} // namespace driver
3 changes: 3 additions & 0 deletions ut-robomaster/src/drivers/encoder_test.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

void populate_frequencies(void);
int func();
Loading