-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/actual claw #37
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
Merged
Merged
Feat/actual claw #37
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
17d2885
added hardware files
b8d2f6e
changed names of motors
b64846a
defined
d0d54e7
labeled buttons
2a914ec
arm sw, hw, cpp, and IO
ce32b48
changed file names
AbbeySieg dcc6c2d
renamed more files
AbbeySieg e277766
added swerve drive to branch
AbbeySieg 72adfe6
changed hw, actua, and sen names
7db2094
changed names
e9bf872
it's being weird
db16ef7
test commit
X-EX3-X 91016a4
functions added I think
X-EX3-X c15cb65
last changes for 1-21-23, added parameter,util
X-EX3-X b7b9314
I update the hardware and software interfaces
8e06a1e
I changed the software and hardware interfaces and I defined function…
c102f34
Merge branch 'feat/actual_claw' of https://github.com/Team-OKC-Roboti…
d43dd10
fleshed out claw subsystem
df6ec31
Merge branch 'master' into feat/actual_claw
f8333d7
IT WORKSSSS EVERYTHING WORKSSSSSSSSSSSSSSS
b2d58fb
fixed include error, added Reset() to claw
69e94f8
The changes Justin asked for
X-EX3-X 4fa5a99
final changes i think
X-EX3-X 3e6ad25
fixed errors
X-EX3-X 9203b9e
Merge branch 'master' into feat/actual_claw
X-EX3-X 0ee8017
final changes hopefully
X-EX3-X dfabc38
changing the #include
X-EX3-X b705eca
solving the case errors
X-EX3-X 3a3b2f5
removed claw files for fix
X-EX3-X b3e2f7a
added files back
X-EX3-X ec4a031
change backwards slash to a forwards slash because maybe that's makin…
danielbrownmsm 4ae2d05
fix backward->forward slash in ClawIO.cpp
danielbrownmsm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,29 @@ | ||
|
|
||
| #include "io/ClawIO.h" | ||
|
|
||
| void ClawIO::Periodic() { | ||
| // Process all the inputs and outputs to/from high level software. | ||
| VOKC_CALL(ProcessIO()); | ||
| } | ||
|
|
||
| void ClawIO::SimulationPeriodic() { | ||
| // SimulationPeriodic | ||
| } | ||
|
|
||
| bool ClawIO::ProcessIO() { | ||
| OKC_CHECK(sw_interface_ != nullptr); | ||
| OKC_CHECK(hw_interface_ != nullptr); | ||
|
|
||
| // Set the software outputs | ||
| // If the encoder should be reset, reset it | ||
| if (sw_interface_->reset_claw_open_and_close) { | ||
| hw_interface_->claw_open_and_close_encoder->SetPosition (0); | ||
| // Lower the encoder reset flag | ||
| sw_interface_->reset_claw_open_and_close = false; | ||
| } | ||
| hw_interface_->claw_open_and_close_motor->Set (sw_interface_->claw_open_and_close_power); | ||
X-EX3-X marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sw_interface_->encoder_reading = hw_interface_->claw_open_and_close_encoder->GetPosition(); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
This file contains hidden or 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,33 @@ | ||
| #include "Parameters.h" | ||
|
|
||
| namespace RobotParams { | ||
| toml::table parameters; | ||
|
|
||
| // Save parameter file location. | ||
| std::string param_file = | ||
| frc::filesystem::GetDeployDirectory() + "/parameters.toml"; | ||
|
|
||
| bool LoadParameters(const std::string &path) { | ||
| // Load the parameters from a file. | ||
| try { | ||
| parameters = toml::parse_file(path.c_str()); | ||
| } catch (const toml::parse_error &err) { | ||
| std::cerr << "Parsing failed:\n" << err << "\n"; | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| bool SaveParameters(const std::string &path) { | ||
| // Output the parameters table to the file. | ||
| std::ofstream file; | ||
| file.open(path, std::ofstream::out | std::ofstream::trunc); | ||
| file << parameters << std::flush; | ||
| file.close(); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| } // namespace RobotParams | ||
|
|
This file contains hidden or 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,21 @@ | ||
| #include "Utils.h" | ||
|
|
||
| namespace TeamOKC { | ||
| // TODO: make this a templated function. | ||
| bool Clamp(const double &lower, const double &upper, double *value) { | ||
| OKC_CHECK(value != nullptr); | ||
|
|
||
| // Ensure value is not lower than the minimum or higher than the | ||
| // maximum. If it is out of the bounds, set it to the boundary value it | ||
| // violates. | ||
| if (*value < lower) { | ||
| *value = lower; | ||
| } else if (*value > upper) { | ||
| *value = upper; | ||
| } else { | ||
| // Nothing to do here, value is within the range. | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
| } // namespace TeamOKC |
This file contains hidden or 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,21 @@ | ||
| #include "subsystems/Claw.h" | ||
|
|
||
X-EX3-X marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bool Claw::Init(){ | ||
| return true; | ||
| } | ||
|
|
||
| bool Claw::ResetPositionEncoder(){ | ||
| return true; | ||
| } | ||
| bool Claw::ResetPositionPID(){ | ||
| return true; | ||
| } | ||
| bool Claw::SetPosition(){ | ||
| // SetPosition (30); //cone | ||
| // SetPosition (0); //close | ||
| // SetPosition (50);//cube | ||
| return true; | ||
| } | ||
| bool Claw::Reset(){ | ||
| return true; | ||
| } | ||
This file contains hidden or 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,28 @@ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <fstream> | ||
| #include <string.h> | ||
|
|
||
| #include <frc/Filesystem.h> | ||
|
|
||
| #include "Utils.h" | ||
| #include "third_party/toml.hpp" | ||
|
|
||
| namespace RobotParams { | ||
| extern toml::table parameters; | ||
| extern std::string param_file; | ||
|
|
||
| bool LoadParameters(const std::string &path); | ||
| bool SaveParameters(const std::string &path); | ||
|
|
||
| template <typename T> | ||
| T GetParam(const std::string_view &path, T default_val) { | ||
| return parameters.at_path(path).value_or(default_val); | ||
| } | ||
|
|
||
| template <typename T> bool SetParam(const std::string_view &path, T value) { | ||
| parameters.insert_or_assign(path, value); | ||
| return true; | ||
| } | ||
| } // namespace RobotParams |
This file contains hidden or 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
This file contains hidden or 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,61 @@ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <iostream> | ||
|
|
||
X-EX3-X marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Despite what VS Code highlighting might suggest, this uses __FUNCTION__ when | ||
| // compiliing using Visual Studio on Windows, and otherwise uses | ||
| // __PRETTY_FUNCTION__ | ||
| #if !defined(__PRETTY_FUNCTION__) && !defined(__GNUC__) | ||
| #define __SHOW_LINE_INFO__ __FUNCTION__ | ||
| #else | ||
| #define __SHOW_LINE_INFO__ __PRETTY_FUNCTION__ | ||
| #endif | ||
|
|
||
| #define OKC_CALL(res) \ | ||
| if (!(res)) { \ | ||
| std::cerr << "OKC_CHECK FAIL [" << __FILE__ << ":" << __LINE__ \ | ||
| << "] - " << __SHOW_LINE_INFO__ << std::endl; \ | ||
| return false; \ | ||
| } | ||
|
|
||
| #define OKC_CHECK(check) \ | ||
| if (!(check)) { \ | ||
| std::cerr << "OKC_CHECK FAIL [" << __FILE__ << ":" << __LINE__ \ | ||
| << "] - " << __SHOW_LINE_INFO__ << std::endl; \ | ||
| return false; \ | ||
| } | ||
|
|
||
| #define OKC_CHECK_MSG(check, msg) \ | ||
| if (!(check)) { \ | ||
| std::cerr << "OKC_CHECK FAIL [" << __FILE__ << ":" << __LINE__ \ | ||
| << "] - " << __SHOW_LINE_INFO__ << ": " << msg << std::endl; \ | ||
| return false; \ | ||
| } | ||
|
|
||
| #define VOKC_CALL(res) \ | ||
| if (!(res)) { \ | ||
| std::cerr << "OKC_CHECK FAIL [" << __FILE__ << ":" << __LINE__ \ | ||
| << "] - " << __SHOW_LINE_INFO__ << std::endl; \ | ||
| return; \ | ||
| } | ||
|
|
||
| #define VOKC_CHECK(check) \ | ||
| if (!(check)) { \ | ||
| std::cerr << "OKC_CHECK FAIL [" << __FILE__ << ":" << __LINE__ \ | ||
| << "] - " << __SHOW_LINE_INFO__ << std::endl; \ | ||
| return; \ | ||
| } | ||
|
|
||
| #define VOKC_CHECK_MSG(check, msg) \ | ||
| if (!(check)) { \ | ||
| std::cerr << "OKC_CHECK FAIL [" << __FILE__ << ":" << __LINE__ \ | ||
| << "] - " << __SHOW_LINE_INFO__ << ": " << msg << std::endl; \ | ||
| return; \ | ||
| } | ||
|
|
||
| namespace TeamOKC { | ||
|
|
||
| bool Clamp(const double &lower, const double &upper, double *value); | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.