-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
427 additions
and
649 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,168 +1,66 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: WebKit | ||
AccessModifierOffset: 0 | ||
# Generated from CLion C/C++ Code Style settings | ||
BasedOnStyle: LLVM | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: Align | ||
AlignArrayOfStructures: Left | ||
AlignConsecutiveAssignments: | ||
Enabled: true | ||
AcrossEmptyLines: true | ||
AcrossComments: true | ||
AlignCompound: true | ||
PadOperators: true | ||
AlignConsecutiveBitFields: | ||
Enabled: true | ||
AcrossEmptyLines: true | ||
AcrossComments: true | ||
AlignConsecutiveDeclarations: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: true | ||
AlignConsecutiveMacros: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: true | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AlignConsecutiveAssignments: None | ||
AlignOperands: Align | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllConstructorInitializersOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Always | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: true | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLambdasOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: Always | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
BitFieldColonSpacing: Both | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: true | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BreakAfterJavaFieldAnnotations: false | ||
SplitEmptyRecord: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeConceptDeclarations: Never | ||
BreakBeforeInheritanceComma: false | ||
BreakConstructorInitializers: BeforeComma | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakInheritanceList: AfterComma | ||
BreakBeforeTernaryOperators: false | ||
BreakStringLiterals: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
ColumnLimit: 0 | ||
CommentPragmas: "^ IWYU pragma:" | ||
CompactNamespaces: true | ||
ConstructorInitializerIndentWidth: 2 | ||
CompactNamespaces: false | ||
ContinuationIndentWidth: 2 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- for | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
- Regex: '.*\.generated\.h' | ||
Priority: 100 | ||
- Regex: ".*(PCH).*" | ||
Priority: -1 | ||
- Regex: '".*"' | ||
Priority: 1 | ||
- Regex: '^<.*\.(h)>' | ||
Priority: 3 | ||
- Regex: "^<.*>" | ||
Priority: 4 | ||
IncludeIsMainRegex: "([-_](test|unittest))?$" | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
IndentExternBlock: AfterExternBlock | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: "" | ||
MacroBlockEnd: "" | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Never | ||
ObjCBlockIndentWidth: 2 | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MaxEmptyLinesToKeep: 2 | ||
NamespaceIndentation: All | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
RawStringFormats: | ||
- Language: Cpp | ||
Delimiters: | ||
- cc | ||
- CC | ||
- cpp | ||
- Cpp | ||
- CPP | ||
- "c++" | ||
- "C++" | ||
CanonicalDelimiter: "" | ||
BasedOnStyle: google | ||
- Language: TextProto | ||
Delimiters: | ||
- pb | ||
- PB | ||
- proto | ||
- PROTO | ||
EnclosingFunctions: | ||
- EqualsProto | ||
- EquivToProto | ||
- PARSE_PARTIAL_TEXT_PROTO | ||
- PARSE_TEST_PROTO | ||
- PARSE_TEXT_PROTO | ||
- ParseTextOrDie | ||
- ParseTextProtoOrDie | ||
CanonicalDelimiter: "" | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
PointerAlignment: Right | ||
ReflowComments: false | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterTemplateKeyword: true | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: true | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesBeforeTrailingComments: 0 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Auto | ||
TabWidth: 2 | ||
UseTab: Never | ||
|
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,22 @@ | ||
#pragma once | ||
|
||
#include "robotparam.h" | ||
#include <math.h> | ||
|
||
typedef struct { | ||
bool finish; | ||
float xset; | ||
float speed; | ||
float x; | ||
float startSpeed; | ||
float uniformSpeed; | ||
float endSpeed; | ||
float aimx; | ||
float speedUpDis; | ||
float speedDownDis; | ||
} LineTraj; | ||
|
||
void LineTrajSpeedUp(LineTraj* linetraj); | ||
void LineTrajSpeedDown(LineTraj* linetraj); | ||
void LineTrajRun(LineTraj* linetraj, float xnow); | ||
void LineTrajInit(LineTraj* linetraj, float startspeed, float uniformspeed, float endspeed, float aimx, float speedUpDis, float speedDownDis); |
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
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,47 @@ | ||
#include "linetraj.h" | ||
|
||
void LineTrajSpeedUp(LineTraj* linetraj) { | ||
if (linetraj->speed < linetraj->uniformSpeed) | ||
linetraj->speed = linetraj->startSpeed + (linetraj->uniformSpeed - linetraj->startSpeed) * sqrtf(linetraj->x / linetraj->speedUpDis); | ||
} | ||
|
||
void LineTrajSpeedDown(LineTraj* linetraj) { | ||
float surplusDis = linetraj->aimx - linetraj->x; | ||
if (surplusDis <= linetraj->speedDownDis) | ||
linetraj->speed = linetraj->endSpeed + (linetraj->uniformSpeed - linetraj->endSpeed) * sqrtf(surplusDis / linetraj->speedDownDis); | ||
} | ||
|
||
void LineTrajRun(LineTraj* linetraj, float xnow) { | ||
if (linetraj->finish) { | ||
linetraj->xset = linetraj->aimx; | ||
linetraj->speed = 0; | ||
return; | ||
} | ||
linetraj->x = xnow; | ||
if (linetraj->x < 0) | ||
linetraj->x = 0; | ||
if (xnow < linetraj->speedUpDis) | ||
LineTrajSpeedUp(linetraj); | ||
else if (xnow > linetraj->aimx) { | ||
linetraj->finish = true; | ||
linetraj->x = linetraj->aimx; | ||
linetraj->speed = 0; | ||
} else if (xnow > linetraj->aimx - linetraj->speedDownDis) | ||
LineTrajSpeedDown(linetraj); | ||
else | ||
linetraj->speed = linetraj->uniformSpeed; | ||
linetraj->xset += linetraj->speed * 0.005f; | ||
} | ||
|
||
void LineTrajInit(LineTraj* linetraj, float startspeed, float uniformspeed, float endspeed, float aimx, float speedUpDis, float speedDownDis) { | ||
linetraj->finish = false; | ||
linetraj->startSpeed = startspeed; | ||
linetraj->uniformSpeed = uniformspeed; | ||
linetraj->endSpeed = endspeed; | ||
linetraj->aimx = aimx; | ||
linetraj->speedUpDis = speedUpDis; | ||
linetraj->speedDownDis = speedDownDis; | ||
linetraj->x = 0; | ||
linetraj->xset = 0; | ||
linetraj->speed = 0; | ||
} |
Oops, something went wrong.