-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from ad101-lab/ad-tank-simulator
Tank drive pure pursuit simulator
- Loading branch information
Showing
30 changed files
with
744 additions
and
315 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,95 +1,106 @@ | ||
{ | ||
"files.associations": { | ||
"ios": "cpp", | ||
"type_traits": "cpp", | ||
"cmath": "cpp", | ||
"valarray": "cpp", | ||
"hash_map": "cpp", | ||
"deque": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"system_error": "cpp", | ||
"__hash_table": "cpp", | ||
"__split_buffer": "cpp", | ||
"__tree": "cpp", | ||
"filesystem": "cpp", | ||
"map": "cpp", | ||
"pros": "json", | ||
"set": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"compare": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"random": "cpp", | ||
"string_view": "cpp", | ||
"tuple": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"new": "cpp", | ||
"ostream": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"cinttypes": "cpp", | ||
"typeindex": "cpp", | ||
"typeinfo": "cpp", | ||
"chrono": "cpp", | ||
"clocale": "cpp", | ||
"codecvt": "cpp", | ||
"concepts": "cpp", | ||
"condition_variable": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"ratio": "cpp", | ||
"iomanip": "cpp", | ||
"mutex": "cpp", | ||
"numbers": "cpp", | ||
"semaphore": "cpp", | ||
"stop_token": "cpp", | ||
"thread": "cpp", | ||
"variant": "cpp", | ||
"__bit_reference": "cpp", | ||
"__bits": "cpp", | ||
"__config": "cpp", | ||
"__debug": "cpp", | ||
"__errc": "cpp", | ||
"__functional_base": "cpp", | ||
"__locale": "cpp", | ||
"__mutex_base": "cpp", | ||
"__node_handle": "cpp", | ||
"__nullptr": "cpp", | ||
"__string": "cpp", | ||
"__threading_support": "cpp", | ||
"__tuple": "cpp", | ||
"locale": "cpp", | ||
"queue": "cpp", | ||
"stack": "cpp" | ||
} | ||
"ios": "cpp", | ||
"type_traits": "cpp", | ||
"cmath": "cpp", | ||
"valarray": "cpp", | ||
"hash_map": "cpp", | ||
"deque": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"system_error": "cpp", | ||
"__hash_table": "cpp", | ||
"__split_buffer": "cpp", | ||
"__tree": "cpp", | ||
"filesystem": "cpp", | ||
"map": "cpp", | ||
"pros": "json", | ||
"set": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"compare": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"random": "cpp", | ||
"string_view": "cpp", | ||
"tuple": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"new": "cpp", | ||
"ostream": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"cinttypes": "cpp", | ||
"typeindex": "cpp", | ||
"typeinfo": "cpp", | ||
"chrono": "cpp", | ||
"clocale": "cpp", | ||
"codecvt": "cpp", | ||
"concepts": "cpp", | ||
"condition_variable": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"ratio": "cpp", | ||
"iomanip": "cpp", | ||
"mutex": "cpp", | ||
"numbers": "cpp", | ||
"semaphore": "cpp", | ||
"stop_token": "cpp", | ||
"thread": "cpp", | ||
"variant": "cpp", | ||
"__bit_reference": "cpp", | ||
"__bits": "cpp", | ||
"__config": "cpp", | ||
"__debug": "cpp", | ||
"__errc": "cpp", | ||
"__functional_base": "cpp", | ||
"__locale": "cpp", | ||
"__mutex_base": "cpp", | ||
"__node_handle": "cpp", | ||
"__nullptr": "cpp", | ||
"__string": "cpp", | ||
"__threading_support": "cpp", | ||
"__tuple": "cpp", | ||
"locale": "cpp", | ||
"queue": "cpp", | ||
"stack": "cpp", | ||
"any": "cpp", | ||
"cfenv": "cpp", | ||
"charconv": "cpp", | ||
"complex": "cpp", | ||
"csetjmp": "cpp", | ||
"csignal": "cpp", | ||
"cuchar": "cpp", | ||
"regex": "cpp", | ||
"future": "cpp", | ||
"scoped_allocator": "cpp", | ||
"shared_mutex": "cpp" | ||
} | ||
} |
This file contains 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 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,17 @@ | ||
#pragma once | ||
|
||
namespace Pronounce { | ||
/** | ||
* @brief Abstract class to be used in both the pure pursuit simulator and on the robot. | ||
* | ||
*/ | ||
class AbstractDrivetrain { | ||
private: | ||
|
||
public: | ||
AbstractDrivetrain(); | ||
|
||
~AbstractDrivetrain(); | ||
}; | ||
|
||
} // namespace Pronounce |
This file contains 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,44 @@ | ||
#pragma once | ||
|
||
#include "abstractDrivetrain.hpp" | ||
#include "utils/utils.hpp" | ||
|
||
namespace Pronounce { | ||
class AbstractTankDrivetrain : public AbstractDrivetrain { | ||
private: | ||
double trackWidth; | ||
public: | ||
AbstractTankDrivetrain(); | ||
AbstractTankDrivetrain(double trackWidth); | ||
|
||
double getTrackWidth() { | ||
return trackWidth; | ||
} | ||
|
||
void setTrackWidth(double trackWidth) { | ||
this->trackWidth = trackWidth; | ||
} | ||
|
||
void driveCurvature(double speed, double curvature) { | ||
double leftSpeed = speed * (2.0 - curvature * trackWidth) / 2.0; | ||
double rightSpeed = speed * (2.0 + curvature * trackWidth) / 2.0; | ||
|
||
double maxSpeed = max(abs(leftSpeed), abs(rightSpeed)); | ||
|
||
if (maxSpeed > abs(speed)) { | ||
double multiplier = abs(speed) / maxSpeed; | ||
leftSpeed *= multiplier; | ||
rightSpeed *= multiplier; | ||
} | ||
|
||
this->tankSteerVelocity(leftSpeed, rightSpeed); | ||
} | ||
|
||
virtual void skidSteerVelocity(double speed, double turn) {} | ||
|
||
virtual void tankSteerVelocity(double leftSpeed, double rightSpeed) {} | ||
|
||
~AbstractTankDrivetrain(); | ||
}; | ||
} // namespace Pronounce | ||
|
Oops, something went wrong.