Skip to content

Commit

Permalink
Merge pull request #1 from NoozAbooz/rewrite
Browse files Browse the repository at this point in the history
Rewrite
  • Loading branch information
NoozAbooz authored Aug 15, 2024
2 parents 3992dc0 + 90ec5fd commit 2837139
Show file tree
Hide file tree
Showing 40 changed files with 378 additions and 875 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
<br />
<div align="center">
<a href="https://github.com/2088S">
<img src="https://raw.githubusercontent.com/NoozAbooz/2088S-HighStakes-2025/V1/logo.png" alt="Logo" width="200">
<img src="https://raw.githubusercontent.com/NoozAbooz/210K-HighStakes-2025/V1/logo.png" alt="Logo" width="200">
</a>

<h1 align="center">High Stakes</h1>

<p align="center">
VRC Team 2088S - "Straitis"
VRC 210K Killswitch
<br/>
3rd year HS VRC team based in Calgary, Alberta
<br/>
Part of the Western Mechatronics Robotics Club
Western Mechatronics Robotics Club
<br/>
<br/>
<a href="https://www.robotevents.com/teams/VRC/2088S">RobotEvents</a>
<a href="https://www.robotevents.com/teams/VRC/210K">RobotEvents</a>
</p>
</div>

Expand Down
Binary file modified firmware/LemLib.a
Binary file not shown.
9 changes: 9 additions & 0 deletions firmware/asset.mk → firmware/hot-cold-asset.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# if "template" is in the make command, do not include static.lib files
ifneq (,$(findstring template,$(MAKECMDGOALS)))
ASSET_FILES=$(wildcard static/*)
else
ASSET_FILES=$(wildcard static/*) $(wildcard static.lib/*)
endif

TEMPLATE_FILES+=$(wildcard static/*) $(wildcard firmware/hot-cold-asset.mk)

ASSET_OBJ=$(addprefix $(BINDIR)/, $(addsuffix .o, $(ASSET_FILES)) )

GETALLOBJ=$(sort $(call ASMOBJ,$1) $(call COBJ,$1) $(call CXXOBJ,$1)) $(ASSET_OBJ)

.SECONDEXPANSION:
$(ASSET_OBJ): $$(patsubst bin/%,%,$$(basename $$@))
$(VV)mkdir -p $(BINDIR)/static
$(VV)mkdir -p $(BINDIR)/static.lib
@echo "ASSET $@"
$(VV)$(OBJCOPY) -I binary -O elf32-littlearm -B arm $^ $@
8 changes: 1 addition & 7 deletions include/abstractGlobals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ extern rd_view_t *gifview;
extern Gif gif;

/* Functions */
// Slapper
void refreshSlapper();

// Lift
void refreshLift();

// DT
void arcadeDrive();

// Intake
void refreshIntake();

// Wings
void refreshWings();
void refreshClamp();
77 changes: 56 additions & 21 deletions include/deviceGlobals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,67 @@
#include "main.h"

// Controller
extern pros::Controller controller;
inline pros::Controller controller(pros::E_CONTROLLER_MASTER);

// Drivetrain
extern pros::MotorGroup leftDrive;
extern pros::MotorGroup rightDrive;

extern lemlib::Chassis chassis;
inline pros::MotorGroup leftDrive({-1, -2, -3});
inline pros::MotorGroup rightDrive({16, 17, 18});

// Intake
extern pros::Motor intake;

// Catapult
extern pros::Motor slapper;

// Inertial
extern pros::Imu inertial;
extern pros::Imu inertial2;
inline pros::Motor intake(10);

extern pros::Rotation verticalEncoder;
extern pros::Rotation horizontalEncoder;
// Pneumatics
inline pros::adi::DigitalOut clampPiston('D');
inline pros::adi::DigitalOut ptoPiston('X');

extern pros::adi::Potentiometer potentiometer;
/* Declare sensors */
inline pros::Imu inertial1(2);
inline pros::Imu inertial2(3);

extern pros::adi::DigitalOut leftWingPiston;
extern pros::adi::DigitalOut rightWingPiston;
inline pros::Rotation verticalEncoder(15);
inline pros::Rotation horizontalEncoder(16);
// horizontal tracking wheel
inline lemlib::TrackingWheel vertical_tracking_wheel(&verticalEncoder, lemlib::Omniwheel::NEW_275, -5.75);
// vertical tracking wheel
inline lemlib::TrackingWheel horizontal_tracking_wheel(&horizontalEncoder, lemlib::Omniwheel::NEW_275, -2.5);

extern pros::adi::DigitalOut liftPiston;
extern pros::adi::DigitalOut tailPiston;
extern pros::adi::DigitalOut ptoPiston;
// drivetrain settings
inline lemlib::Drivetrain drivetrain(&leftDrive, // left motor group
&rightDrive, // right motor group
10.5, // 25 hole track width
lemlib::Omniwheel::NEW_325,
450, // drivetrain rpm
2 // chase power is 2. If we had traction wheels, it would have been 8
);
// lateral motion controller
inline lemlib::ControllerSettings linearController(21, // proportional gain (kP)
0, // integral gain (kI)
24, // derivative gain (kD)
3, // anti windup
1, // small error range, in inches
100, // small error range timeout, in milliseconds
3, // large error range, in inches
500, // large error range timeout, in milliseconds
20 // maximum acceleration (slew)
);
// angular motion controller
inline lemlib::ControllerSettings angularController(5, // proportional gain (kP)
0, // integral gain (kI)
50, // derivative gain (kD)
3, // anti windup
1, // small error range, in degrees
100, // small error range timeout, in milliseconds
3, // large error range, in degrees
500, // large error range timeout, in milliseconds
0 // maximum acceleration (slew)
);
// sensors for odometry
// note that in this example we use internal motor encoders, so we don't pass vertical tracking wheels
inline lemlib::OdomSensors sensors(nullptr, // vertical tracking wheel 1, set to nullptr as we don't have one
nullptr, // vertical tracking wheel 2, set to nullptr as we don't have one
nullptr, // horizontal tracking wheel 1
nullptr, // horizontal tracking wheel 2, set to nullptr as we don't have a second one
&inertial1 // inertial sensor
);
// create the chassis
inline lemlib::Chassis chassis(drivetrain, linearController, angularController, sensors);
10 changes: 5 additions & 5 deletions include/lemlib/api.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "lemlib/pid.hpp"
#include "lemlib/pose.hpp"
#include "lemlib/util.hpp"
#include "lemlib/pid.hpp" // IWYU pragma: keep
#include "lemlib/pose.hpp" // IWYU pragma: keep
#include "lemlib/util.hpp" // IWYU pragma: keep
#include "lemlib/chassis/chassis.hpp"
#include "lemlib/chassis/trackingWheel.hpp"
#include "lemlib/logger/logger.hpp"
#include "lemlib/chassis/trackingWheel.hpp" // IWYU pragma: keep
#include "lemlib/logger/logger.hpp" // IWYU pragma: keep

// using to shorten lemlib::AngularDirection to just AngularDirection
using lemlib::AngularDirection;
Expand Down
12 changes: 11 additions & 1 deletion include/lemlib/asset.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include <stdint.h>
#include <cstddef>
#include <cstdint>
#ifndef _ASSET_H_
#define _ASSET_H_

extern "C" {

Expand All @@ -16,3 +18,11 @@ typedef struct __attribute__((__packed__)) _asset {
extern uint8_t _binary_static_##x##_start[], _binary_static_##x##_size[]; \
static asset x = {_binary_static_##x##_start, (size_t)_binary_static_##x##_size}; \
}

#define ASSET_LIB(x) \
extern "C" { \
extern uint8_t _binary_static_lib_##x##_start[], _binary_static_lib_##x##_size[]; \
static asset x = {_binary_static_lib_##x##_start, (size_t)_binary_static_lib_##x##_size}; \
}

#endif // _ASSET_H_
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "main.h"

namespace strait {
namespace ks {
class LateralPID {
public:
LateralPID();
Expand All @@ -14,5 +14,5 @@ namespace strait {
void move_lateral_pid(double target, double maxSpeed, double minSpeed);

};
extern strait::LateralPID pid;
extern ks::LateralPID pid;
}
7 changes: 7 additions & 0 deletions include/libKS/drivetrain/chassis.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
#include "main.h"

namespace ks {
double driveCurve(double input, double curve);
void arcadeDrive(int linCurve, int rotCurve, double turnScale);
}
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "main.h"

namespace strait
namespace ks
{
class Position{
public:
Expand All @@ -10,6 +10,4 @@ namespace strait
};

extern Position odom_pos;

void odomViewInit();
}
13 changes: 13 additions & 0 deletions include/libKS/killswitch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once
#include "main.h"

#include <math.h>
#include <cmath>
#include <vector>

#include "libKS/drivetrain/chassis.hpp"
#include "libKS/drivetrain/movement.hpp"
#include "libKS/drivetrain/odom.hpp"
#include "libKS/drivetrain/PID.hpp"

#include "libKS/utilities.hpp"
16 changes: 16 additions & 0 deletions include/libKS/utilities.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once
#include "main.h"
#include <deque>

namespace ks
{
double vector_average(const std::vector<double>& v);
double median_filter(std::deque<double>& buffer, double newVal, int windowSize);
float to_milivolt(float input);
bool isDriverControl();

double to_rad(double angle_deg);
double to_deg(double angle_rad);

void calibrateIMU(pros::Imu inertial1, pros::Imu inertial2);
}
10 changes: 0 additions & 10 deletions include/libSTRAITIS/drivetrain/chassis.hpp

This file was deleted.

8 changes: 0 additions & 8 deletions include/libSTRAITIS/drivetrain/opcontrol.hpp

This file was deleted.

15 changes: 0 additions & 15 deletions include/libSTRAITIS/strait.hpp

This file was deleted.

13 changes: 0 additions & 13 deletions include/libSTRAITIS/util/selector.hpp

This file was deleted.

32 changes: 0 additions & 32 deletions include/libSTRAITIS/util/utilities.hpp

This file was deleted.

3 changes: 2 additions & 1 deletion include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ void opcontrol(void);
#include "deviceGlobals.hpp"

// libSTRAIT
#include "libSTRAITIS/strait.hpp"
#include "libKS/killswitch.hpp"

//#include <iostream>
#endif

Expand Down
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2837139

Please sign in to comment.