Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Use cubic spline for initial guess #148

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
be4d354
add wpi files
bruingineer Apr 8, 2024
914314f
remove json. fix gcem include
bruingineer Apr 8, 2024
0cf5274
added spline initial guess
bruingineer Apr 8, 2024
4328fcf
Update OptimalTrajectoryGenerator.cpp
bruingineer Apr 8, 2024
4cf778e
account for control intervals
bruingineer Apr 8, 2024
4b31685
Update TrajoptUtil.inc
bruingineer Apr 8, 2024
b949f00
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer Apr 8, 2024
e18109b
spline init guess and rust bind
bruingineer Apr 9, 2024
210698e
debug prints
bruingineer Apr 9, 2024
588d51b
Update TrajoptUtil.inc
bruingineer Apr 9, 2024
fff8dd1
delete unused wpi
bruingineer Apr 9, 2024
40f1c2b
remove old spline init guess
bruingineer Apr 9, 2024
146ee68
Update EigenCore.h
bruingineer Apr 9, 2024
b7fcb9b
fix fn signatures
bruingineer Apr 9, 2024
0806543
add debug rotation
bruingineer Apr 9, 2024
982294b
wrap angle and push back theta
bruingineer Apr 9, 2024
b2dd682
remove prints, rename initialguess
bruingineer Apr 9, 2024
523069a
removing more files
bruingineer Apr 9, 2024
a513309
rename calc init guess (linear / spline)
bruingineer Apr 9, 2024
adc36f2
switch end spline heading
bruingineer Apr 9, 2024
dfd6524
Use FetchContent with allwpilib to avoid copy-paste
calcmogul Apr 9, 2024
5c782c4
Fix wpiformat warnings
calcmogul Apr 9, 2024
be0eb9c
Merge pull request #1 from calcmogul/use-fetchcontent-with-allwpilib
bruingineer Apr 10, 2024
3ee7027
Remove protobuf from WPILib
calcmogul Apr 11, 2024
eee055b
Install Eigen when using CasADi backend
calcmogul Apr 11, 2024
c55b37b
Fix wpimath linkage
calcmogul Apr 11, 2024
f03ab25
Rewrite WPILib patching script in Python
calcmogul Apr 11, 2024
1285978
Run wpiformat
calcmogul Apr 11, 2024
6e27e18
Enable check for git apply subprocess
calcmogul Apr 11, 2024
9c6f7cf
Remove more protobuf files
calcmogul Apr 11, 2024
a1560e1
Remove find_dependency(Protobuf) from wpiutil-config.cmake.in
calcmogul Apr 11, 2024
66a944f
Fix Linux example build
calcmogul Apr 11, 2024
ac2de27
Update TrajoptUtil.inc
bruingineer Apr 11, 2024
39d0e8e
rust api to return holonomic initial guess
bruingineer Apr 15, 2024
6a311f6
Update swerve.rs
bruingineer Apr 16, 2024
3e0c67e
init guess kinematics not implemented
bruingineer Apr 16, 2024
b8e51a8
add spline1d
bruingineer Apr 16, 2024
fb02f42
add pose holonomic spline
bruingineer Apr 16, 2024
0c98a92
Update CubicHermitePoseSplineHolonomic.h
bruingineer Apr 16, 2024
b0eb5c9
fix GenerateSplineInitialGuess arguments
bruingineer Apr 17, 2024
17a359d
Merge branch 'better-initial-guess-wpi-v2' into work-in-progress-init…
bruingineer Apr 17, 2024
b12c1cb
Run wpiformat
calcmogul Apr 17, 2024
b3599bd
Increase build timeout
calcmogul Apr 17, 2024
a91dbd6
added trajectory parameterize. WIP
bruingineer Apr 18, 2024
cae4649
Update SwervePathBuilder.cpp
bruingineer Apr 19, 2024
94e2a88
sample trajectory with current given control intervals
bruingineer Apr 20, 2024
c528786
use trajectory init guess
bruingineer Apr 20, 2024
01983bd
finding access error...
bruingineer Apr 20, 2024
3831abb
add debug prints
bruingineer Apr 20, 2024
daf4551
total time on rust
bruingineer Apr 20, 2024
d303669
fix indexing errors
bruingineer Apr 20, 2024
bf08e90
troubleshoot spline heading
bruingineer Apr 20, 2024
43a39e7
Update CubicHermitePoseSplineHolonomic.h
bruingineer Apr 20, 2024
ed7cedc
updated parameterizer to use the updated getpoint
bruingineer Apr 20, 2024
b42c034
comment prints
bruingineer Apr 20, 2024
1189d37
typo, move dt calc
bruingineer Apr 21, 2024
feac53b
print iterations, up iteration count
bruingineer Apr 21, 2024
14b9c5e
fix end control vector
bruingineer Apr 21, 2024
00d6b2e
print fmt
bruingineer Apr 21, 2024
e30c680
print idx
bruingineer Apr 21, 2024
a7ce083
fix indexing for guess waypoints
bruingineer Apr 21, 2024
4676022
remove comments and prints
bruingineer Apr 21, 2024
cf17781
add dt per sgmt
bruingineer Apr 21, 2024
1e17f21
same dt for all path
bruingineer Apr 21, 2024
29619e9
Merge branch 'better-initial-guess-wpi-v2' into wip-no-prints
bruingineer Apr 21, 2024
3e72c2c
run wpiformat
bruingineer Apr 21, 2024
acd0923
move dt to whole sgmt
bruingineer Apr 21, 2024
908826b
Merge branch 'main' into work-in-progress-init-guess
bruingineer Apr 21, 2024
fbc04b6
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer Apr 21, 2024
76448d1
Merge branch 'work-in-progress-init-guess' into better-initial-guess-…
bruingineer Apr 21, 2024
c63d6bb
wpiformat
bruingineer Apr 21, 2024
54a6db5
uncomment swerve.rs
bruingineer Apr 21, 2024
83c097f
dt doesn't work with init guess points
bruingineer Apr 21, 2024
d506ac7
prints and state indexing
bruingineer Apr 21, 2024
0fa599d
fix whole sgmt points count
bruingineer Apr 22, 2024
4ff9ed7
wpiformat
bruingineer Apr 22, 2024
1089b77
wpiformat
bruingineer Apr 22, 2024
49b78ec
fix another init guess point index issue
bruingineer Apr 22, 2024
42fdbbe
add prints
bruingineer Apr 23, 2024
8e3ed0c
wrap headings of sampled init guess
bruingineer Apr 23, 2024
b6dc225
delete comments
bruingineer Apr 23, 2024
187028c
remove comments
bruingineer Apr 23, 2024
211a3c7
remove unused fn
bruingineer Apr 23, 2024
96b4bbb
Update swerve.rs
bruingineer Apr 23, 2024
2db063e
Fix compiler warnings
calcmogul Apr 24, 2024
6b84ccd
Run cargo fmt
calcmogul Apr 24, 2024
05e6f29
Suppress unknown pragma warnings on MinGW
calcmogul Apr 24, 2024
e00b275
Fix clang-tidy warnings
calcmogul Apr 24, 2024
0bfd0f8
Ignore unknown pragmas in wpiutil
calcmogul Apr 24, 2024
f76508e
Make wpiutil emscripten backtrace a no-op
calcmogul Apr 24, 2024
2b46242
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Apr 24, 2024
f88645e
Fix -Wno-unknown-pragmas guard
calcmogul Apr 24, 2024
864c151
Don't compress debug info with MinGW
calcmogul Apr 24, 2024
451f098
Try to fix debug info compression
calcmogul Apr 24, 2024
d815307
Try to remove -gz=zlib option
calcmogul Apr 24, 2024
9c460af
Remove -gz=none option
calcmogul Apr 24, 2024
3baae3b
Run wpiformat
calcmogul Apr 24, 2024
4c4b7ee
add kinematics to init guess
bruingineer Apr 24, 2024
ca204dc
link wpiutil to rust
bruingineer Apr 24, 2024
413dbe9
switch wpiutil order in build.rs
bruingineer Apr 24, 2024
74febce
fix init guess index sampling. make poseSpline hold a cubic instead o…
bruingineer Apr 25, 2024
30b5d5d
Run wpiformat
calcmogul Apr 25, 2024
a04bb57
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer Apr 25, 2024
c5b793a
inc iterations, move print dt addition
bruingineer Apr 25, 2024
a996bbd
Update SwervePathBuilder.cpp
bruingineer Apr 25, 2024
b66b2d6
Update SwervePathBuilder.cpp
bruingineer Apr 25, 2024
d0b3016
traj per sgmt
bruingineer Apr 27, 2024
e2fa1db
Merge branch 'send-new-control-intervals-to-choreo' into apply-constr…
bruingineer Apr 27, 2024
ebdddd6
Update SwervePathBuilder.cpp
bruingineer Apr 27, 2024
bcb0f8b
Update SwervePathBuilder.cpp
bruingineer Apr 27, 2024
b720e85
super messy wip
bruingineer Apr 29, 2024
3617b5b
refactor init guess spline fn
bruingineer May 7, 2024
8c53512
refactor updates
bruingineer May 9, 2024
b3633f2
refactor spline util
bruingineer May 9, 2024
3ab68e8
update swerve path builder
bruingineer May 9, 2024
0cdf62f
Merge branch 'main' into send-new-control-intervals-to-choreo
bruingineer May 9, 2024
7d96aed
Merge branch 'main' into send-new-control-intervals-to-choreo
bruingineer May 9, 2024
e8cbfb9
remove includes
bruingineer May 9, 2024
f6a50fb
Update SwervePathBuilder.cpp
bruingineer May 9, 2024
410c78e
wpiformat
bruingineer May 9, 2024
c0bcc3a
wpiformat
bruingineer May 9, 2024
963c2bd
Update SwervePathBuilder.cpp
bruingineer May 9, 2024
8d1da90
fix typo
bruingineer May 17, 2024
cf1121c
restore set int count on rust
bruingineer May 17, 2024
bb490fc
build.rs add wpimath and wpiutil
bruingineer May 17, 2024
a2c7bf5
Update SwervePathBuilder.cpp
bruingineer May 17, 2024
a633371
trajectories between all points
bruingineer May 17, 2024
1d0cd69
fix comments and prints
bruingineer May 20, 2024
2d584b5
working
bruingineer May 21, 2024
1297553
Merge branch 'main' into send-new-control-intervals-to-choreo
bruingineer May 21, 2024
b139657
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer May 21, 2024
58ef24e
Merge branch 'better-initial-guess-wpi-v2' into send-new-control-inte…
bruingineer May 21, 2024
2764b1b
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer Jun 20, 2024
f72b955
Update SwervePathBuilder.cpp
bruingineer Jun 20, 2024
2efed95
Increase CI timeouts
calcmogul Jun 20, 2024
729b74b
Increase native build CI timeout more
calcmogul Jun 20, 2024
d400e38
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jun 20, 2024
b25a904
Remove casadi if statement
calcmogul Jun 20, 2024
c2e2e35
Disable psabi warning
calcmogul Jun 20, 2024
83879b5
Disable psabi warning in wpimath build
calcmogul Jun 20, 2024
a6274f0
Set number of jobs to 4
calcmogul Jun 20, 2024
4974655
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jun 21, 2024
748dd18
Reduce build timeout
calcmogul Jun 21, 2024
8c58da8
Upgrade WPIMath
calcmogul Jun 21, 2024
f8ce53e
Add comment about WPIMath revision
calcmogul Jun 21, 2024
a0e32a0
Remove find_dependency(Protobuf) line from wpiutil
calcmogul Jun 21, 2024
40325b8
Remove more protobuf stuff
calcmogul Jun 21, 2024
1f059fb
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jun 21, 2024
b0fd9e7
Clean up includes
calcmogul Jun 21, 2024
5878e5d
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jun 21, 2024
c5bdff7
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer Jun 25, 2024
2cdb72a
Initial Guess Point to Pose2d. Constraint members const public
bruingineer Jun 25, 2024
f97a6aa
building, spline guess needs to be fixed
bruingineer Jun 25, 2024
e4e2901
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jun 25, 2024
74efa9b
Run wpiformat
calcmogul Jun 25, 2024
fefe591
Fix Doxygen warnings
calcmogul Jun 25, 2024
ff86e74
Fix Linux compilation errors
calcmogul Jun 25, 2024
bbed620
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jun 25, 2024
6d717da
Cleanup
calcmogul Jun 25, 2024
f8598cf
fix sample index
bruingineer Jun 25, 2024
adb2f53
format
bruingineer Jun 25, 2024
9b24db4
Merge branch 'main' into better-initial-guess-wpi-v2
bruingineer Jun 29, 2024
e94f7f4
clean up
bruingineer Jun 29, 2024
5fb02f0
move spline guess to util
bruingineer Jun 29, 2024
8366504
WIP refactor spline guess
bruingineer Jun 29, 2024
b9be9ab
fix control interval return ref
bruingineer Jun 29, 2024
1c2f6e1
spline refactor
bruingineer Jul 1, 2024
1b297c6
Update GenerateSplineInitialGuess.hpp
bruingineer Jul 1, 2024
d9b5c6f
size_t in for loop
bruingineer Jul 1, 2024
6736b33
Update GenerateSplineInitialGuess.hpp
bruingineer Jul 1, 2024
cb5efb6
initialize all fields in swervesolution
bruingineer Jul 1, 2024
7b9e6e9
Merge branch 'main' into better-initial-guess-wpi-v2
calcmogul Jul 2, 2024
6a4130a
Fix #include sorting
calcmogul Jul 2, 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
2 changes: 1 addition & 1 deletion .github/workflows/build-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
build:
timeout-minutes: 10
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
build:
timeout-minutes: 10
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
build:
timeout-minutes: 10
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cppSrcFileInclude {
}

modifiableFileExclude {
\.patch$
expected$
\.patch$
}
Expand Down
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)

# Allow overriding options in parent projects
cmake_policy(SET CMP0077 NEW)

project(TrajoptLib LANGUAGES CXX)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down Expand Up @@ -116,6 +119,30 @@ set(BUILD_EXAMPLES ${BUILD_EXAMPLES_SAVE})

target_link_libraries(TrajoptLib PUBLIC Sleipnir)

# wpimath dependency
set(WITH_CSCORE OFF CACHE INTERNAL "With CSCore")
set(WITH_GUI OFF CACHE INTERNAL "With GUI")
set(WITH_JAVA OFF CACHE INTERNAL "With Java")
set(WITH_NTCORE OFF CACHE INTERNAL "With NTCore")
set(WITH_SIMULATION_MODULES OFF CACHE INTERNAL "With Simulation Modules")
set(WITH_TESTS OFF CACHE INTERNAL "With Tests")
set(WITH_WPIMATH ON CACHE INTERNAL "With WPIMath")
set(WITH_WPILIB OFF CACHE INTERNAL "With WPILib")
find_package(Python REQUIRED COMPONENTS Interpreter)
fetchcontent_declare(
wpilib
GIT_REPOSITORY https://github.com/wpilibsuite/allwpilib.git
# main on 2024-06-20
GIT_TAG e2893fc1a36720b9c3986f2fc6c9607cea35c8fd
PATCH_COMMAND
${Python_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/allwpilib_patch.py
${CMAKE_CURRENT_SOURCE_DIR}
UPDATE_DISCONNECTED 1
)
fetchcontent_makeavailable(wpilib)
target_link_libraries(TrajoptLib PUBLIC wpimath Eigen3::Eigen)

target_include_directories(
TrajoptLib
PUBLIC
Expand Down
4 changes: 4 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ fn main() {
.include("src")
.include(format!("{}/include", cmake_dest.display()))
.include(format!("{}/include/eigen3", cmake_dest.display()))
.include(format!("{}/include/wpimath", cmake_dest.display()))
.include(format!("{}/include/wpiutil", cmake_dest.display()))
.std("c++20");

if cfg!(target_os = "windows") {
Expand All @@ -44,6 +46,8 @@ fn main() {
println!("cargo:rustc-link-lib=TrajoptLib");
println!("cargo:rustc-link-lib=Sleipnir");
println!("cargo:rustc-link-lib=fmt");
println!("cargo:rustc-link-lib=wpimath");
println!("cargo:rustc-link-lib=wpiutil");

println!("cargo:rerun-if-changed=src/trajoptlibrust.hpp");
println!("cargo:rerun-if-changed=src/trajoptlibrust.cpp");
Expand Down
12 changes: 12 additions & 0 deletions cmake/allwpilib-disable-psabi-warning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/cmake/modules/CompileWarnings.cmake b/cmake/modules/CompileWarnings.cmake
index 5de103201..78a5c3009 100644
--- a/cmake/modules/CompileWarnings.cmake
+++ b/cmake/modules/CompileWarnings.cmake
@@ -5,6 +5,7 @@ macro(wpilib_target_warnings target)
-pedantic
-Wextra
-Wno-unused-parameter
+ -Wno-psabi
${WPILIB_TARGET_WARNINGS}
)
if(NOT NO_WERROR)
131 changes: 131 additions & 0 deletions cmake/allwpilib_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/env python3

import os
import re
import shutil
import subprocess
import sys
import typing


def get_linesep(contents):
"""Returns string containing autodetected line separator for file.

Keyword arguments:
contents -- file contents string
"""
# Find potential line separator
pos = contents.find("\n")

# If a newline character was found and the character preceding it is a
# carriage return, assume CRLF line endings. LF line endings are assumed
# for empty files.
if pos > 0 and contents[pos - 1] == "\r":
return "\r\n"
else:
return "\n"


def modify_file(filename, func: typing.Callable[[list[str]], list[str]]):
"""
Reads a file, modifies the contents with func, then writes the file.
"""
with open(filename, encoding="utf-8") as f:
contents = f.read()

sep = get_linesep(contents)
lines = contents.split(sep)
lines = func(lines)

with open(filename, "w", encoding="utf-8") as f:
f.write(sep.join(lines))


def remove_protobuf_support():
shutil.rmtree("wpimath/src/main/native/cpp/controller/proto", ignore_errors=True)
shutil.rmtree("wpimath/src/main/native/cpp/geometry/proto", ignore_errors=True)
shutil.rmtree("wpimath/src/main/native/cpp/kinematics/proto", ignore_errors=True)
shutil.rmtree("wpimath/src/main/native/cpp/system/plant/proto", ignore_errors=True)
shutil.rmtree("wpimath/src/main/native/cpp/trajectory/proto", ignore_errors=True)
shutil.rmtree("wpiutil/src/main/native/cpp/protobuf", ignore_errors=True)
shutil.rmtree(
"wpimath/src/main/native/include/frc/controller/proto", ignore_errors=True
)
shutil.rmtree(
"wpimath/src/main/native/include/frc/geometry/proto", ignore_errors=True
)
shutil.rmtree(
"wpimath/src/main/native/include/frc/kinematics/proto", ignore_errors=True
)
shutil.rmtree(
"wpimath/src/main/native/include/frc/system/plant/proto", ignore_errors=True
)
shutil.rmtree(
"wpimath/src/main/native/include/frc/trajectory/proto", ignore_errors=True
)
shutil.rmtree("wpiutil/src/main/native/thirdparty/protobuf", ignore_errors=True)
shutil.rmtree("wpiutil/src/main/native/cpp/DataLog.cpp", ignore_errors=True)
shutil.rmtree("wpiutil/src/main/native/include/wpi/DataLog.h", ignore_errors=True)

modify_file(
"CMakeLists.txt",
lambda lines: [
line for line in lines if line != "find_package(Protobuf REQUIRED)"
],
)
modify_file(
"wpiutil/CMakeLists.txt",
lambda lines: [line.replace("protobuf::libprotobuf", "") for line in lines],
)
modify_file(
"wpiutil/wpiutil-config.cmake.in",
lambda lines: [line for line in lines if line != "find_dependency(Protobuf)"],
)

filenames = [os.path.join(dp, f) for dp, dn, fn in os.walk("wpimath") for f in fn]

def fix(lines):
# Remove lines mentioning protobuf
lines = [
line
for line in lines
if "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/protobuf>" not in line
and not re.search(r"#include \"\w+\.pb\.h\"", line)
and not re.search(r"#include \"frc/.*?Proto\.h\"", line)
]

# Remove protobuf_generate_cpp() call
filtered_lines = []
found = False
for i in range(len(lines)):
if lines[i].startswith("# workaround for makefiles"):
found = True
if not found:
filtered_lines.append(lines[i])
if found and lines[i].startswith(")"):
found = False
lines = filtered_lines

return lines

for filename in filenames:
modify_file(filename, fix)


def main():
remove_protobuf_support()

# Disable psabi warning
subprocess.run(
[
"git",
"apply",
"--ignore-whitespace",
os.path.join(sys.argv[1], "cmake/allwpilib-disable-psabi-warning.patch"),
],
check=True,
)


if __name__ == "__main__":
main()
55 changes: 44 additions & 11 deletions examples/swerve.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
use trajoptlib::{SwerveDrivetrain, SwerveModule, SwervePathBuilder};
use trajoptlib::{Pose2d, SwerveDrivetrain, SwerveModule, SwervePathBuilder};

fn main() {
let drivetrain = SwerveDrivetrain {
mass: 45.0,
mass: 80.0,
moi: 6.0,
modules: vec![
SwerveModule {
x: 0.6,
y: 0.6,
wheel_radius: 0.04,
wheel_max_angular_velocity: 70.0,
wheel_max_torque: 2.0,
wheel_max_torque: 0.9,
},
SwerveModule {
x: 0.6,
y: -0.6,
wheel_radius: 0.04,
wheel_max_angular_velocity: 70.0,
wheel_max_torque: 2.0,
wheel_max_torque: 0.9,
},
SwerveModule {
x: -0.6,
y: 0.6,
wheel_radius: 0.04,
wheel_max_angular_velocity: 70.0,
wheel_max_torque: 2.0,
wheel_max_torque: 0.9,
},
SwerveModule {
x: -0.6,
y: -0.6,
wheel_radius: 0.04,
wheel_max_angular_velocity: 70.0,
wheel_max_torque: 2.0,
wheel_max_torque: 0.9,
},
],
};
Expand All @@ -41,11 +41,44 @@ fn main() {
path.set_drivetrain(&drivetrain);
path.set_bumpers(1.3, 1.3);
path.pose_wpt(0, 0.0, 0.0, 0.0);
path.pose_wpt(1, 1.0, 0.0, 0.0);
// path.sgmt_initial_guess_points(
// 0,
// &vec![
// Pose2d {
// x: 1.,
// y: 0.5,
// heading: -0.5,
// },
// Pose2d {
// x: 2.,
// y: -0.5,
// heading: -0.5,
// },
// ],
// );
// path.pose_wpt(1, 0.25, 0.0, 0.0);
path.sgmt_initial_guess_points(
0,
&vec![Pose2d {
x: 2.0,
y: 0.0,
heading: 0.0,
}],
);
let end_idx = 1;
path.pose_wpt(end_idx, 4.0, 0., 0.0);
path.wpt_linear_velocity_max_magnitude(0, 0.0);
path.wpt_linear_velocity_max_magnitude(end_idx, 0.0);
path.wpt_angular_velocity_max_magnitude(0, 0.0);
path.wpt_angular_velocity_max_magnitude(1, 0.0);
path.sgmt_circle_obstacle(0, 1, 0.5, 0.1, 0.2);
path.set_control_interval_counts(vec![40]);
path.wpt_angular_velocity_max_magnitude(end_idx, 0.0);
// path.sgmt_circle_obstacle(0, 1, 0.5, 0.1, 0.2);
let counts = path.calculate_control_interval_counts();
println!("counts; {:#?}", &counts);
path.set_control_interval_counts(vec![4, 3, 2]);

println!("setup complete");
println!("{:?}", path.generate(true, 0));
// path.calculate_control_interval_counts();
// println!("linear: {:#?}", path.calculate_linear_initial_guess());
println!("spline: {:#?}", path.calculate_spline_initial_guess());
// println!("{:#?}", path.generate(true, 0));
}
1 change: 1 addition & 0 deletions include/.styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ modifiableFileExclude {

includeOtherLibs {
^Eigen/
^frc/
^sleipnir/
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace trajopt {
*/
class TRAJOPT_DLLEXPORT AngularVelocityMaxMagnitudeConstraint {
public:
/// The maximum angular velocity magnitude.
double m_maxMagnitude;

/**
* Constructs an AngularVelocityMaxMagnitudeConstraint.
*
Expand Down Expand Up @@ -52,9 +55,6 @@ class TRAJOPT_DLLEXPORT AngularVelocityMaxMagnitudeConstraint {
problem.SubjectTo(angularVelocity <= m_maxMagnitude);
}
}

private:
double m_maxMagnitude;
};

} // namespace trajopt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace trajopt {
*/
class TRAJOPT_DLLEXPORT LinearVelocityMaxMagnitudeConstraint {
public:
/// The maximum linear velocity magnitude.
double m_maxMagnitude;

/**
* Constructs a LinearVelocityMaxMagnitudeConstraint.
*
Expand Down Expand Up @@ -53,9 +56,6 @@ class TRAJOPT_DLLEXPORT LinearVelocityMaxMagnitudeConstraint {
m_maxMagnitude * m_maxMagnitude);
}
}

private:
double m_maxMagnitude;
};

} // namespace trajopt
Loading
Loading