Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
258 commits
Select commit Hold shift + click to select a range
526ffbe
Added Barc simulation node, still needs launch-file to be started (to…
maxb91 Sep 13, 2016
a37e2ec
Merge branch 'devel-max' of https://github.com/BARCproject/barc into …
maxb91 Sep 13, 2016
0ae2712
Merge branch 'devel-max' of https://github.com/BARCproject/barc into …
maxb91 Sep 13, 2016
c165956
Merge branch 'devel-max' of https://github.com/BARCproject/barc into …
maxb91 Sep 13, 2016
adfbaaf
added launch file for MPC-follow-trajectory simulation
maxb91 Sep 13, 2016
d23fefa
deleted outlier detection in state estimator (didn't work properly) a…
maxb91 Sep 13, 2016
574decb
changed paths of log files to make them platform-independent
maxb91 Sep 14, 2016
69705dd
Merged with branch devel-felix and did little cleanups
maxb91 Sep 14, 2016
99c8fd9
Added addition logging to simulator (logs measurements, estimation an…
maxb91 Sep 15, 2016
b1b5ab5
Merge branch 'MPC-follow-trajectory' of https://github.com/BARCprojec…
maxb91 Sep 15, 2016
b566d4b
Changed message format to float64, added s_start to message pos_info,…
maxb91 Sep 15, 2016
1bb4eae
Modified racetrack creation: Start/Finish is at middle of straight li…
maxb91 Sep 15, 2016
afc1d78
Transposed matrices so that they're ordered columnwise (instead of ro…
maxb91 Sep 16, 2016
1ec68f3
reduced number of matrices in coeffConstCost to make calculations fas…
maxb91 Sep 16, 2016
875df3a
Added profiler LMPC function (just for simulation and profiling), add…
maxb91 Sep 16, 2016
192906a
Changed subscriber so that it writes into passed arguments instead of…
maxb91 Sep 16, 2016
0ae8cde
Changed entire problem formulation structure so that there are no mor…
maxb91 Sep 17, 2016
de561fd
LMPC simulation works with multiple laps. Still oscillating a bit aro…
maxb91 Sep 19, 2016
3b8bff8
Added evaluation functions, changed tabs to spaces (in python code), …
maxb91 Sep 20, 2016
753de90
Added function to create smoother tracks (continuous derivative of cu…
maxb91 Sep 20, 2016
38b48de
Changed cmd-publish structure so that commands are published at the b…
maxb91 Sep 20, 2016
6d15f5b
Added new method to model racetrack (by stacking curves together). Ch…
maxb91 Sep 20, 2016
e06975c
Added method to create racetracks with Bezier curves.
maxb91 Sep 21, 2016
7752f6e
Added Bezier function to create racetracks (didn't work at previous c…
maxb91 Sep 21, 2016
fd3c33b
Added more tools to analyze predictive control. Currently no perfect …
maxb91 Sep 21, 2016
a7fe1f1
Working version. LMPC learns and is stable (if the parameters are cho…
maxb91 Sep 23, 2016
9911110
Added precompiling (to speed up code) and evaluation functions (to vi…
maxb91 Sep 23, 2016
6305f58
Working version of LMPC. Works well with wide track (about 0.6m width).
maxb91 Sep 24, 2016
ff13d4b
Modified state estimation: predicts state by 0.1s (linear prediction)
maxb91 Sep 24, 2016
4303291
Added dynamic model to state estimation. Added evaluation functions t…
maxb91 Sep 28, 2016
af828ea
added dynamic system to simulator. Not yet working properly.
maxb91 Sep 28, 2016
02a25a0
Changed simulation model to dynamic model (including dynamic steering…
maxb91 Sep 28, 2016
c683172
Merge branch 'dynamic-estimation' into dynamic-simulation
maxb91 Sep 28, 2016
58bb34a
Added dynamic estimator to dynamic simulation. Might need some tuning…
maxb91 Sep 28, 2016
bf3d27e
Merge with LMPC
maxb91 Sep 29, 2016
b700ef9
Added predictive dynamic estimator
maxb91 Sep 29, 2016
1bdff90
Deleted files and replaced them with the submodule
maxb91 Oct 6, 2016
804307f
Merged (dynamic) simulation node with submodule
maxb91 Oct 6, 2016
3f904f0
Updated submodule reference
maxb91 Oct 6, 2016
56ca47b
Adapted LMPC node to new submodule. LMPC node now uses dynamic estima…
maxb91 Oct 6, 2016
ffe385f
Updated submodule.
maxb91 Oct 6, 2016
09e9959
Adapted evaluation and added psi measurement to Kalman filter. LMPC w…
maxb91 Oct 7, 2016
f661744
Small changes in simulation model
maxb91 Oct 7, 2016
4e2157c
Small changes in evaluation and logging, changed queue-sizes to 1, ad…
maxb91 Oct 10, 2016
8871526
Combined position and ey-epsi-estimation in one node and deleted loca…
maxb91 Oct 10, 2016
590e263
Adapted to new submodule, went back to GPS estimation only (no yaw or…
maxb91 Oct 11, 2016
3d03726
Added one-step error logging
maxb91 Oct 11, 2016
b50cdf4
Added launchfile for BARC
maxb91 Oct 11, 2016
25030ab
Added env loader for odroid
maxb91 Oct 11, 2016
49d5d40
Added env loader for pc
maxb91 Oct 11, 2016
2119b75
Corrected low-level controller
maxb91 Oct 11, 2016
23fd5c9
Fixed 64/32bit issue, completed launchfile.
maxb91 Oct 11, 2016
07311df
Added node to record sensor and command data.
maxb91 Oct 12, 2016
0f9c190
Added julia functions to analyze recorded data.
maxb91 Oct 12, 2016
bf66b83
Added sensor test launchfile.
maxb91 Oct 12, 2016
8dbf111
Fixed bug so python scripts work on odroid as well.
maxb91 Oct 12, 2016
7c97c1a
Simplified dynamic state estimation: Only position info is published.…
maxb91 Oct 12, 2016
9ef7b53
Changed Arduino code to send average velocity (from encoders), adapte…
maxb91 Oct 13, 2016
9a8b91c
Fixed arduino code. Somehow only 2 of 4 magnets are recognized by enc…
maxb91 Oct 13, 2016
baee219
Estimator: added option to account for yaw drift. Fixed wrapping erro…
maxb91 Oct 14, 2016
6c6ad26
Added official marvelmind-package to receive gps-data. Adapted subscr…
maxb91 Oct 14, 2016
a375478
Optimized julia codes for speed, cleaned code.
maxb91 Oct 15, 2016
975f204
Improved simulation model (added artificial sensor disturbances)
maxb91 Oct 16, 2016
93728b7
Introduced extrapolation of GPS and psiDot values, added outlier dete…
maxb91 Oct 19, 2016
3b2f76b
Cleaned code (first time working with Lint)2
maxb91 Oct 19, 2016
1b5bfd1
Added headers to custom messages and adapted code accordingly. Restru…
maxb91 Oct 20, 2016
3c98c68
Switched to ROS time as global clock. Messages are logged with publis…
maxb91 Oct 20, 2016
2fe7857
Cleaned code, added open loop julia control file.
maxb91 Oct 20, 2016
61bbe8b
Restructured logging strategy, fixed open loop simulator/recorder.
maxb91 Oct 20, 2016
344252a
Updated submodule.
maxb91 Oct 20, 2016
430948b
Deleted obsolete messages (fixes rosserial make_libraries bug).
maxb91 Oct 21, 2016
5541ee4
Fixed arduino code.
maxb91 Oct 21, 2016
93d4982
Added variables to pos_info, adapted Arduino code to 3-wheel decoders.
maxb91 Oct 25, 2016
b8ef2c9
Added Kalman filter simulation scripts. Changed estimation to adaptiv…
maxb91 Oct 27, 2016
7525b96
Added Kalman variations for testing.
maxb91 Oct 28, 2016
17a2ccc
Added more evaluation scripts and Kalman filter variations. Adapted v…
maxb91 Nov 2, 2016
98f0123
Added 4-wheel encoder logging, added simpler kinematic estimator (not…
maxb91 Nov 3, 2016
fb0d6bc
Fixed arduino code, extended evaluation scripts
maxb91 Nov 4, 2016
0b51006
Fixed Arduino code.
maxb91 Nov 4, 2016
659b059
Added simple track, added 2-step-delay to Kalman filter, adapted eval…
maxb91 Nov 9, 2016
52a9adb
Started working on more general oldTraj structure.
maxb91 Nov 9, 2016
28d5d69
Removed s_start
maxb91 Nov 9, 2016
8615de7
Merged no-s-start
maxb91 Nov 9, 2016
58aa4f9
Changed oldTraj structure
maxb91 Nov 10, 2016
4aabff9
Added pure sensor-based Kalman filter (good performance in tests), ra…
maxb91 Nov 11, 2016
a555836
Updated low level control parameters, normalized acceleration measure…
maxb91 Nov 12, 2016
77fa57d
Updated parameters
maxb91 Nov 18, 2016
b3c0ea9
Optimized Localization helpers
maxb91 Nov 28, 2016
d2f7229
Added perfect state information for simulation, added evaluation func…
maxb91 Nov 28, 2016
7d34583
Updated Kalman filter and Kalman filter simulation.
maxb91 Nov 28, 2016
487a3fb
Added evaluation functions (incl. animation)
maxb91 Nov 30, 2016
6ea5b07
Updated parameters and wifi settings.
maxb91 Dec 1, 2016
df7a79d
Updated paramters
maxb91 Dec 2, 2016
37be4e6
Went back to 4-parameter xDot sysID, updated plots.
maxb91 Dec 4, 2016
22a5af0
Added filtered state in LMPC and evaluation
maxb91 Dec 4, 2016
cb8e506
Fixed filter formulation.
maxb91 Dec 4, 2016
f121503
Last optimizations.
maxb91 Dec 5, 2016
f2b8442
Updated localization (decreased polynomial to 3rd order), added debug…
maxb91 Dec 6, 2016
70923be
Good tuning.
urosolia Dec 6, 2016
9d9105a
Updated localization parameters
urosolia Dec 6, 2016
0614ced
Updated localization parameters, increased oldTrajectory buffer for h…
urosolia Dec 6, 2016
ffe35b1
Added evaluation functions for thesis.
maxb91 Dec 7, 2016
47764b4
Merge branch 'acc-filter' of https://github.com/MPC-Berkeley/barc int…
maxb91 Dec 7, 2016
e5283d8
Added evaluation functions.
maxb91 Dec 8, 2016
63f74f7
Deleted submodule, replaced it with normal directory
maxb91 Dec 8, 2016
ad1878b
Cleaned source code, added Readme file.
maxb91 Dec 9, 2016
dd80add
Cleaned evaluation folder and added Readme.
maxb91 Dec 15, 2016
ba0e33e
Changing reference speed in path following as the motor performance h…
urosolia Dec 15, 2016
bfb4c45
Settings used for video (1/15/17)
urosolia Jan 16, 2017
724618f
Video settings, 2nd day (1/16/)
urosolia Jan 16, 2017
7c0fd32
Commit after merge, video settings day 2
urosolia Jan 16, 2017
0ed89ab
Experimtne second day final (1/16/2017)
urosolia Jan 16, 2017
bf81da2
Add small comment
urosolia Jan 16, 2017
6d82309
Fix bug in equation for simulatior
urosolia Jan 17, 2017
505c062
Changing uncertanty values
urosolia Feb 20, 2017
2b3fa67
Adding a tutorial for date evaluation
urosolia Feb 20, 2017
720b5f4
new tuning
urosolia Apr 26, 2017
859e3f2
changes 26 sept 17
francescoricciuti Sep 26, 2017
a4d907a
changed frequency of pos_info, refined tuning, refined system ID
francescoricciuti Nov 8, 2017
ed51a0e
first steps towards obstacle avoidance
francescoricciuti Nov 9, 2017
5bc8bf5
new tuning
francescoricciuti Nov 14, 2017
6592997
new plot functionalities
francescoricciuti Nov 15, 2017
486f304
added slack variables to the problem, new tuning, now working
jonmgonzales Nov 16, 2017
9ea3c20
new tuning
jonmgonzales Nov 17, 2017
3b33574
added working obstacle avoidance
jonmgonzales Nov 21, 2017
6df6d65
minor changes to plotting
jonmgonzales Nov 22, 2017
1a8ffa9
modified scripts for connection with arduino and minor changes on the…
jonmgonzales Dec 4, 2017
f4497fa
new tuning
jonmgonzales Dec 4, 2017
aa52c0f
added env loader script and testing code for LMPC
jonmgonzales Dec 8, 2017
87b2eac
setup for experiments
jonmgonzales Jan 16, 2018
b3b679b
minor changes
jonmgonzales Jan 17, 2018
a680929
new tuning
jonmgonzales Jan 18, 2018
1999837
small changes to plots for debugging
jonmgonzales Jan 18, 2018
80fddcb
added codes for mapping of accelleration
jonmgonzales Jan 22, 2018
fd011ac
modified track
jonmgonzales Jan 22, 2018
564e031
changed settings for mapping tests
jonmgonzales Jan 23, 2018
3d1732f
small changes for mapping
jonmgonzales Jan 23, 2018
bef7bb0
added script for deceleration mapping
jonmgonzales Jan 24, 2018
168db48
added plots for debugging
jonmgonzales Jan 25, 2018
d9097d3
minor changes in plots
jonmgonzales Jan 25, 2018
30e11be
new plots added
jonmgonzales Jan 26, 2018
595f5a4
minor corrections on plots
jonmgonzales Jan 27, 2018
f08a99c
new tuning
jonmgonzales Jan 29, 2018
e4783d9
new tuning
jonmgonzales Jan 30, 2018
120a3a9
restored original track
jonmgonzales Jan 30, 2018
b7e2a64
New changes for new GPS pkg
urosolia Feb 1, 2018
a8b0ba0
tuning
jonmgonzales Feb 2, 2018
81f05a5
Merge branch 'obstacle_LMPC' into obstacle_LMPC
francescoricciuti Feb 2, 2018
0d44aef
Merge pull request #30 from francescoricciuti/obstacle_LMPC
urosolia Feb 2, 2018
1d27f32
tuning for simulator
jonmgonzales Feb 5, 2018
2c54c0f
Merge branch 'obstacle_LMPC' of https://github.com/francescoricciuti/…
jonmgonzales Feb 5, 2018
56f2e5e
new tuning for experiments
jonmgonzales Feb 6, 2018
3bd19a8
Merge pull request #33 from francescoricciuti/obstacle_LMPC
urosolia Feb 6, 2018
49dbeb8
added solver status to plots
jonmgonzales Feb 7, 2018
8ea3ac3
new tuning for experiments
jonmgonzales Feb 8, 2018
ecba949
new tuning for simulation
jonmgonzales Feb 10, 2018
657e2a5
Merge pull request #34 from francescoricciuti/obstacle_LMPC
urosolia Feb 10, 2018
149e37b
Good Tuning
urosolia Feb 10, 2018
62d954d
added boolean variable for obtacle tuning
jonmgonzales Feb 12, 2018
605e74e
added plots for obstacle avoidance
jonmgonzales Feb 13, 2018
159d4e7
Merge branch 'obstacle_LMPC' into obstacle_LMPC
urosolia Feb 13, 2018
9da2101
Merge pull request #35 from francescoricciuti/obstacle_LMPC
urosolia Feb 13, 2018
34fe374
cleaning code from useless lines. CHECK TUNING BEFORE MERGING WITH BASE
jonmgonzales Feb 16, 2018
db7e652
Latest Tuning
urosolia Feb 16, 2018
4c11138
added one lap for system ID
jonmgonzales Feb 17, 2018
24143c7
Merge branch 'obstacle_LMPC' of https://github.com/francescoricciuti/…
jonmgonzales Feb 17, 2018
7771e72
best tuning
jonmgonzales Feb 17, 2018
ac91d9d
Merge branch 'obstacle_LMPC' into obstacle_LMPC
urosolia Feb 17, 2018
7f8502a
Merge pull request #40 from francescoricciuti/obstacle_LMPC
urosolia Feb 17, 2018
84362eb
Good Tuning
urosolia Feb 17, 2018
a98e9c1
Changes in eval function
urosolia Feb 17, 2018
132d9ac
Transition from simulation to BARC
Apr 18, 2018
6bb1929
First working version from simulation to BARC
Apr 18, 2018
e912716
second day working on BARC
Apr 19, 2018
fc7c5f0
Modified view_trajectory, the next task is collecting sys_ID data
Apr 19, 2018
c1a6c51
feature data first version is collected. Quality of the data remains …
Apr 20, 2018
5ec9304
Finish debugging for pF: epsi%2pi problem, keep debugging for LMPC
Apr 20, 2018
1d7a463
Finish setting up quicking debugging for LMPC, keep debbugging for LMPC
Apr 20, 2018
4b5d5bf
Finished debugging for Interface, but invalid number detected in Ipop…
Apr 23, 2018
d3fdaa0
Finish debugging for LMPC, next is tuning and code cleaning
Apr 23, 2018
5ae800f
LMPC is working, keep debugging for SS selection
Apr 24, 2018
2e443fc
Finish debugging for SS cantacation, keep debugging for performance
Apr 24, 2018
84874f2
keep debugging for meaningless braking on cornering
Apr 25, 2018
6deb1ca
SYS ID still has problems. SS cantacation have some problems when swi…
Apr 26, 2018
74f495d
Finish debugging for SYS_ID, keep working on MPC parameter tuning
Apr 27, 2018
e72097d
Finish debugging for kin_linear with iden_tv forecasting
Apr 27, 2018
bb835bf
Finish sparse GPR, but the performance remains to be checked
Apr 28, 2018
7c5b3d9
Code used for experiment
Apr 30, 2018
68e156c
Code ready for experiment
May 1, 2018
a6da019
code reaady for feature data collecting experiment
May 1, 2018
4c2feba
experiment setting
May 3, 2018
d9e5840
setting for experiment from mpcubuntu
jonmgonzales May 3, 2018
42125c9
update from virtualbox
May 3, 2018
413d750
ready for experiment
jonmgonzales May 4, 2018
6ea080c
ready for experiment
jonmgonzales May 4, 2018
cf1a4cb
cleanning code
jonmgonzales May 5, 2018
167ee64
keep debugging...
May 7, 2018
8b340bf
keep debugging for SYS_ID and lap switching cost and LMPC node criterion
jonmgonzales May 10, 2018
53b5ee4
Keep debugging for SYS_ID on vy
jonmgonzales May 11, 2018
d042804
keep debugging for SYS_ID_KIN_LIN
jonmgonzales May 12, 2018
9abf9cb
GP_full is working
jonmgonzales May 15, 2018
0d8c80d
after 0516 testing, needs to add low level controller
jonmgonzales May 17, 2018
a35e1cb
Added new low level mapping from Bike and update the visualization ch…
May 17, 2018
808848c
update track data for 3110
May 17, 2018
7fd2b61
commit after 0517 testing, keep working on estimation
jonmgonzales May 18, 2018
e971338
keep adding more useful debugging signals and figure out al signal flows
May 18, 2018
6885742
commit before checkout to obstacle
jonmgonzales May 19, 2018
ef65b16
keep tuning on state estimator to give a better yaw
jonmgonzales May 20, 2018
b313939
Commit before estimator code cleanning
jonmgonzales May 23, 2018
e6ae104
keep cleanning
jonmgonzales May 24, 2018
f1ce01f
keep cleaning
jonmgonzales May 24, 2018
b2227a4
first clean version of estimator to be tested in the experiment
jonmgonzales May 24, 2018
f2d3df9
Finish cleanning for estimator and Localization_helper.
jonmgonzales May 24, 2018
4043f1a
EKF and UKF are working in experiment
jonmgonzales May 25, 2018
4f4170b
keep debugging for the clean estimator
jonmgonzales May 26, 2018
e523330
good tuning for clean estimator
jonmgonzales May 29, 2018
984edcf
folder cleaning
jonmgonzales May 30, 2018
737c2f5
Added and edited files for multi-agent racing
jonmgonzales May 30, 2018
6554645
Added and updated some env loaders
jonmgonzales May 30, 2018
a410c28
for testing on ubuntu MPC
May 30, 2018
6b29cb0
Merge branch 'GP_LMPC' of github.com:ShuqiXu/barc into GP_LMPC
May 30, 2018
05ebf27
change back to old estimator
jonmgonzales May 30, 2018
372d3d6
Lukas commit before creating new branch
jonmgonzales May 30, 2018
c077b3b
Good first testing
jonmgonzales May 31, 2018
3e6202d
LMPC KIN is working in simulation
May 31, 2018
a3589c9
Adding author info
May 31, 2018
0620847
prepare the track for 3110 testing
May 31, 2018
af81c42
Experiment tuning of May 31st
jonmgonzales May 31, 2018
11e0927
keep cleanning on simulator, working on new sys id, and looking into …
jonmgonzales Jun 2, 2018
eb90e8c
start programming and try for new sys id
Jun 2, 2018
178980a
Merge branch 'GP_LMPC' of github.com:ShuqiXu/barc into GP_LMPC
Jun 2, 2018
92f7a34
start writing new simulator
Jun 2, 2018
352145e
clean simulator is working
Jun 2, 2018
4638bb8
clean simulator is finished
Jun 2, 2018
54c37f9
add steering brake into the simulator
Jun 2, 2018
07eb3ac
continue working from mpcubuntu
Jun 4, 2018
ff088fb
high frequyency kin controller is working
Jun 4, 2018
de3fed3
high frequency controller experiment
jonmgonzales Jun 5, 2018
08ad3f8
Removed two-step delay from LMPC and tuning of parameters
jonmgonzales Jun 9, 2018
6d56e5b
estimator not working
jonmgonzales Jun 10, 2018
167bbcc
estimator debugging
jonmgonzales Jun 11, 2018
34c31a9
Getting yaw measurement using two beacons
jonmgonzales Jun 12, 2018
c459bf9
commit before switching to clean branch
jonmgonzales Jun 13, 2018
b12d344
commit before switching to clean branch
jonmgonzales Jun 13, 2018
c6e2181
tuning estimator using approximated yaw from gps
jonmgonzales Jun 13, 2018
ca2de5c
commit before switching
jonmgonzales Jun 14, 2018
de49ca0
Promising tuning of estimator using dyanmics
jonmgonzales Jun 17, 2018
7d48822
More tuning on the estimator with the dynamic model
jonmgonzales Jun 17, 2018
f71f71f
Commit before switching to the other branch
jonmgonzales Jun 18, 2018
d60923b
renamed files for creation of low level map
jonmgonzales Jun 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 35 additions & 0 deletions OA
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/workspace/src/barc/src/barc_lib/LMPC/functions.jl b/workspace/src/barc/src/barc_lib/LMPC/functions.jl
index e4e90fb..2e7a0a8 100644
--- a/workspace/src/barc/src/barc_lib/LMPC/functions.jl
+++ b/workspace/src/barc/src/barc_lib/LMPC/functions.jl
@@ -64,13 +64,13 @@ function InitializeParameters(mpcParams::MpcParams,mpcParams_pF::MpcParams,track
mpcParams.Q_term = 1.0*[20.0,1.0,10.0,20.0,50.0] # weights for terminal constraints (LMPC, for xDot,yDot,psiDot,ePsi,eY).Not used if using convex hull
mpcParams.R = 0*[10.0,10.0] # put weights on a and d_f
mpcParams.QderivZ = 10.0*[1,1,1,1,1,1] # cost matrix for derivative cost of states
- mpcParams.QderivU = 1.0*[5.0,1.0] #NOTE Set this to [5.0, 0/40.0] # cost matrix for derivative cost of inputs
+ mpcParams.QderivU = 1.0*[10.0,1.0] #NOTE Set this to [5.0, 0/40.0] # cost matrix for derivative cost of inputs
mpcParams.Q_term_cost = 3 # scaling of Q-function
mpcParams.delay_df = 3 # steering delay
mpcParams.delay_a = 1 # acceleration delay
mpcParams.Q_lane = 1 # weight on the soft constraint for the lane
mpcParams.Q_vel = 1 # weight on the soft constraint for the maximum velocity
- mpcParams.Q_slack = 1*[5*20.0,20.0,10.0,30.0,80.0,50.0]#[20.0,10.0,10.0,30.0,80.0,50.0] #vx,vy,psiDot,ePsi,eY,s
+ mpcParams.Q_slack = 1*[5*20.0,1*20.0,1*10.0,30.0,80.0,50.0]#[20.0,10.0,10.0,30.0,80.0,50.0] #vx,vy,psiDot,ePsi,eY,s
mpcParams.Q_obs = ones(Nl*selectedStates.Np)# weight to esclude some of the old trajectories

elseif selectedStates.simulator == true # if the simulator is in use
diff --git a/workspace/src/barc/src/state_estimation_SensorKinematicModel.py b/workspace/src/barc/src/state_estimation_SensorKinematicModel.py
index dc2d986..93c7f26 100755
--- a/workspace/src/barc/src/state_estimation_SensorKinematicModel.py
+++ b/workspace/src/barc/src/state_estimation_SensorKinematicModel.py
@@ -224,8 +224,8 @@ def state_estimation():

Q = diag([1/20*dt**5*qa,1/20*dt**5*qa,1/3*dt**3*qa,1/3*dt**3*qa,dt*qa,dt*qa,1/3*dt**3*qp,dt*qp,0.1, 0.2,0.2,1.0,1.0,0.1])
R = diag([5.0,5.0,1.0,10.0,100.0,1000.0,1000.0, 5.0,5.0,10.0,1.0, 10.0,10.0])
- #R = diag([20.0,20.0,1.0,10.0,100.0,1000.0,1000.0, 20.0,20.0,10.0,1.0, 10.0,10.0])
- # x,y,v,psi,psiDot,a_x,a_y, x, y, psi, v
+ #R = diag([4*5.0,4*5.0,1.0,10.0,2*100.0,2*1000.0,2*1000.0, 4*5.0,4*5.0,10.0,1.0, 2*10.0,10.0])
+ # x, y, v, psi,psiDot,a_x,a_y, x, y, psi, v

# Set up track parameters
l = Localization()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ controller.py
Dator/db.sqlite3
workspace/src/barc/rosbag/
*.ropeproject/
.DS_Store
File renamed without changes.
182 changes: 127 additions & 55 deletions arduino/arduino_nano328_node/arduino_nano328_node.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ WARNING:

// include libraries
#include <ros.h>
#include <barc/Ultrasound.h>
#include <barc/Encoder.h>
//#include <barc/Ultrasound.h>
#include <barc/Vel_est.h>
#include <barc/ECU.h>
#include <Servo.h>
#include "Maxbotix.h"
#include <EnableInterrupt.h>
#include <std_msgs/Int32.h>
#include <std_msgs/Float32.h>

/**************************************************************************
CAR CLASS DEFINITION (would like to refactor into car.cpp and car.h but can't figure out arduino build process so far)
Expand All @@ -48,13 +49,23 @@ class Car {
int getEncoderFR();
int getEncoderBL();
int getEncoderBR();
unsigned long getEncoder_dTime_FL(); //(ADDED BY TOMMI 7JULY2016)
unsigned long getEncoder_dTime_FR(); //(ADDED BY TOMMI 7JULY2016)
unsigned long getEncoder_dTime_BL(); //(ADDED BY TOMMI 7JULY2016)
unsigned long getEncoder_dTime_BR(); //(ADDED BY TOMMI 7JULY2016)
// Interrupt service routines
void incFR();
void incFL();
void incBR();
void incBL();
void calcThrottle();
void calcSteering();
float getVelocityEstimate();
float vel_FL = 0;
float vel_FR = 0;
float vel_BL = 0;
float vel_BR = 0;

private:
// Pin assignments
const int ENC_FL_PIN = 2;
Expand All @@ -68,13 +79,13 @@ class Car {

// Car properties
// unclear what this is for
const int noAction = 0;
const float noAction = 0.0;

// Motor limits
// TODO are these the real limits?
const int MOTOR_MAX = 120;
const int MOTOR_MIN = 40;
const int MOTOR_NEUTRAL = 90;
const float MOTOR_MAX = 150.0;
const float MOTOR_MIN = 40.0;
const float MOTOR_NEUTRAL = 90.0;
// Optional: smaller values for testing safety
/* const int MOTOR_MAX = 100; */
/* const int MOTOR_MIN = 75; */
Expand All @@ -84,10 +95,10 @@ class Car {
// 120] judging from the sound of the servo pushing beyond a mechanical limit
// outside that range. The offset may be 2 or 3 deg and the d_theta_max is then
// ~31.
const int D_THETA_MAX = 30;
const int THETA_CENTER = 90;
const int THETA_MAX = THETA_CENTER + D_THETA_MAX;
const int THETA_MIN = THETA_CENTER - D_THETA_MAX;
const float D_THETA_MAX = 30.0;
const float THETA_CENTER = 90.0;
const float THETA_MAX = THETA_CENTER + D_THETA_MAX;
const float THETA_MIN = THETA_CENTER - D_THETA_MAX;

// Interfaces to motor and steering actuators
Servo motor;
Expand Down Expand Up @@ -122,12 +133,33 @@ class Car {
int BL_count = 0;
int BR_count = 0;

// Delta time withing two magnets //(ADDED BY TOMMI 7JULY2016)
// F = front, B = back, L = left, R = right //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long FL_new_time = 0; //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long FR_new_time = 0; //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long BL_new_time = 0; //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long BR_new_time = 0; //(ADDED BY TOMMI 7JULY2016)

volatile unsigned long FL_old_time = 0; //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long FR_old_time = 0; //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long BL_old_time = 0; //(ADDED BY TOMMI 7JULY2016)
volatile unsigned long BR_old_time = 0; //(ADDED BY TOMMI 7JULY2016)

unsigned long FL_DeltaTime = 0; //(ADDED BY TOMMI 7JULY2016)
unsigned long FR_DeltaTime = 0; //(ADDED BY TOMMI 7JULY2016)
unsigned long BL_DeltaTime = 0; //(ADDED BY TOMMI 7JULY2016)
unsigned long BR_DeltaTime = 0; //(ADDED BY TOMMI 7JULY2016)


// Utility functions
uint8_t microseconds2PWM(uint16_t microseconds);
float saturateMotor(float x);
float saturateServo(float x);
};

// Boolean keeping track of whether the Arduino has received a signal from the ECU recently
int received_ecu_signal = 0;

// Initialize an instance of the Car class as car
Car car;

Expand All @@ -137,6 +169,7 @@ Car car;
// figure it out, please atone for my sins.
void ecuCallback(const barc::ECU& ecu) {
car.writeToActuators(ecu);
received_ecu_signal = 1;
}
void incFLCallback() {
car.incFL();
Expand All @@ -160,29 +193,18 @@ void calcThrottleCallback() {
// Variables for time step
volatile unsigned long dt;
volatile unsigned long t0;
volatile unsigned long ecu_t0;

// Global message variables
// Encoder, RC Inputs, Electronic Control Unit, Ultrasound
barc::ECU ecu;
barc::ECU rc_inputs;
barc::Encoder encoder;
barc::Ultrasound ultrasound;
barc::Vel_est vel_est;


ros::NodeHandle nh;

ros::Publisher pub_encoder("encoder", &encoder);
ros::Publisher pub_rc_inputs("rc_inputs", &rc_inputs);
ros::Publisher pub_ultrasound("ultrasound", &ultrasound);
ros::Subscriber<barc::ECU> sub_ecu("ecu_pwm", ecuCallback);


// Set up ultrasound sensors
/*
Maxbotix us_fr(14, Maxbotix::PW, Maxbotix::LV); // front
Maxbotix us_bk(15, Maxbotix::PW, Maxbotix::LV); // back
Maxbotix us_rt(16, Maxbotix::PW, Maxbotix::LV); // right
Maxbotix us_lt(17, Maxbotix::PW, Maxbotix::LV); // left
*/
ros::Publisher pub_vel_est("vel_est", &vel_est); // vel est publisher

/**************************************************************************
ARDUINO INITIALIZATION
Expand All @@ -191,21 +213,27 @@ void setup()
{
// Set up encoders, rc input, and actuators
car.initEncoders();
car.initRCInput();
//car.initRCInput();
car.initActuators();

// Start ROS node
nh.initNode();

// Publish and subscribe to topics
nh.advertise(pub_encoder);
nh.advertise(pub_rc_inputs);
nh.advertise(pub_ultrasound);
// nh.advertise(pub_encoder);
//nh.advertise(pub_encoder_dt_FL); //(ADDED BY TOMMI 7JULY2016)
//nh.advertise(pub_encoder_dt_FR); //(ADDED BY TOMMI 7JULY2016)
//nh.advertise(pub_encoder_dt_BL); //(ADDED BY TOMMI 7JULY2016)
//nh.advertise(pub_encoder_dt_BR); //(ADDED BY TOMMI 7JULY2016)
//nh.advertise(pub_rc_inputs);
//nh.advertise(pub_ultrasound);
nh.advertise(pub_vel_est);
nh.subscribe(sub_ecu);

// Arming ESC, 1 sec delay for arming and ROS
car.armActuators();
t0 = millis();
ecu_t0 = millis();

}

Expand All @@ -217,29 +245,28 @@ void loop() {
// compute time elapsed (in ms)
dt = millis() - t0;

// kill the motor if there is no ECU signal within the last 1s
if( (millis() - ecu_t0) >= 200){
if(!received_ecu_signal){
car.killMotor();
} else{
received_ecu_signal = 0;
}
ecu_t0 = millis();
}

if (dt > 50) {
car.readAndCopyInputs();

// TODO make encoder and rc_inputs private properties on car? Then
// car.publishEncoder(); and car.publishRCInputs();
encoder.FL = car.getEncoderFL();
encoder.FR = car.getEncoderFR();
encoder.BL = car.getEncoderBL();
encoder.BR = car.getEncoderBR();
pub_encoder.publish(&encoder);

rc_inputs.motor = car.getRCThrottle();
rc_inputs.servo = car.getRCSteering();
pub_rc_inputs.publish(&rc_inputs);

// publish ultra-sound measurement
/*
ultrasound.front = us_fr.getRange();
ultrasound.back = us_bk.getRange();
ultrasound.right = us_rt.getRange();
ultrasound.left = us_lt.getRange();
pub_ultrasound.publish(&ultrasound);
*/
vel_est.vel_est = car.getVelocityEstimate();
vel_est.vel_fl = car.vel_FL;
vel_est.vel_fr = car.vel_FR;
vel_est.vel_bl = car.vel_BL;
vel_est.vel_br = car.vel_BR;
vel_est.header.stamp = nh.now();
pub_vel_est.publish(&vel_est); // publish estimated velocity
////////////////////////////////////////////////!!!!

t0 = millis();
}

Expand Down Expand Up @@ -279,10 +306,10 @@ void Car::initEncoders() {
pinMode(ENC_FL_PIN, INPUT_PULLUP);
pinMode(ENC_BR_PIN, INPUT_PULLUP);
pinMode(ENC_BL_PIN, INPUT_PULLUP);
enableInterrupt(ENC_FR_PIN, incFRCallback, CHANGE);
enableInterrupt(ENC_FL_PIN, incFLCallback, CHANGE);
enableInterrupt(ENC_BR_PIN, incBRCallback, CHANGE);
enableInterrupt(ENC_BL_PIN, incBLCallback, CHANGE);
enableInterrupt(ENC_FR_PIN, incFRCallback, FALLING); //enables interrupts from Pin ENC_FR_PIN, when signal changes (CHANGE). And it call the function 'incFRCallback'
enableInterrupt(ENC_FL_PIN, incFLCallback, FALLING);
enableInterrupt(ENC_BR_PIN, incBRCallback, FALLING);
enableInterrupt(ENC_BL_PIN, incBLCallback, FALLING);
}

void Car::initRCInput() {
Expand All @@ -306,7 +333,7 @@ void Car::armActuators() {
void Car::writeToActuators(const barc::ECU& ecu) {
float motorCMD = saturateMotor(ecu.motor);
float servoCMD = saturateServo(ecu.servo);
motor.write(motorCMD);
motor.writeMicroseconds( (uint16_t) (1500 + (motorCMD-90.0)*1000.0/180.0))
steering.write(servoCMD);
}

Expand Down Expand Up @@ -339,21 +366,29 @@ void Car::calcSteering() {

void Car::incFL() {
FL_count_shared++;
FL_old_time = FL_new_time; //(ADDED BY TOMMI 7JULY2016)
FL_new_time = micros(); // new instant of passing magnet is saved //(ADDED BY TOMMI 7JULY2016)
updateFlagsShared |= FL_FLAG;
}

void Car::incFR() {
FR_count_shared++;
FR_old_time = FR_new_time; //(ADDED BY TOMMI 7JULY2016)
FR_new_time = micros(); // new instant of passing magnet is saved //(ADDED BY TOMMI 7JULY2016)
updateFlagsShared |= FR_FLAG;
}

void Car::incBL() {
BL_count_shared++;
BL_old_time = BL_new_time; //(ADDED BY TOMMI 7JULY2016)
BL_new_time = micros(); // new instant of passing magnet is saved //(ADDED BY TOMMI 7JULY2016)
updateFlagsShared |= BL_FLAG;
}

void Car::incBR() {
BR_count_shared++;
BR_old_time = BR_new_time; //(ADDED BY TOMMI 7JULY2016)
BR_new_time = micros(); // new instant of passing magnet is saved //(ADDED BY TOMMI 7JULY2016)
updateFlagsShared |= BR_FLAG;
}

Expand All @@ -375,15 +410,19 @@ void Car::readAndCopyInputs() {
}
if(updateFlags & FL_FLAG) {
FL_count = FL_count_shared;
FL_DeltaTime = FL_new_time - FL_old_time; //(ADDED BY TOMMI 7JULY2016)
}
if(updateFlags & FR_FLAG) {
FR_count = FR_count_shared;
FR_DeltaTime = FR_new_time - FR_old_time; //(ADDED BY TOMMI 7JULY2016)
}
if(updateFlags & BL_FLAG) {
BL_count = BL_count_shared;
BL_DeltaTime = BL_new_time - BL_old_time; //(ADDED BY TOMMI 7JULY2016)
}
if(updateFlags & BR_FLAG) {
BR_count = BR_count_shared;
BR_DeltaTime = BR_new_time - BR_old_time; //(ADDED BY TOMMI 7JULY2016)
}
// clear shared update flags and turn interrupts back on
updateFlagsShared = 0;
Expand All @@ -410,3 +449,36 @@ int Car::getEncoderBL() {
int Car::getEncoderBR() {
return BR_count;
}

unsigned long Car::getEncoder_dTime_FL() { //(ADDED BY TOMMI 7JULY2016)
return FL_DeltaTime; //(ADDED BY TOMMI 7JULY2016)
} //(ADDED BY TOMMI 7JULY2016)
unsigned long Car::getEncoder_dTime_FR() { //(ADDED BY TOMMI 7JULY2016)
return FR_DeltaTime; //(ADDED BY TOMMI 7JULY2016)
} //(ADDED BY TOMMI 7JULY2016)+
unsigned long Car::getEncoder_dTime_BL() { //(ADDED BY TOMMI 7JULY2016)
return BL_DeltaTime; //(ADDED BY TOMMI 7JULY2016)
} //(ADDED BY TOMMI 7JULY2016)
unsigned long Car::getEncoder_dTime_BR() { //(ADDED BY TOMMI 7JULY2016)
return BR_DeltaTime; //(ADDED BY TOMMI 7JULY2016)
} //(ADDED BY TOMMI 7JULY2016)

float Car::getVelocityEstimate() {
vel_FL = 0.0;
vel_FR = 0.0;
vel_BL = 0.0;
vel_BR = 0.0;
if(FL_DeltaTime > 0){
vel_FL = 2.0*3.141593*0.036/2.0*1.0/FL_DeltaTime*1000000.0;
}
if(FR_DeltaTime > 0){
vel_FR = 2.0*3.141593*0.036/2.0*1.0/FR_DeltaTime*1000000.0;
}
if(BL_DeltaTime > 0){
vel_BL = 2.0*3.141593*0.036/2.0*1.0/BL_DeltaTime*1000000.0;
}
if(BR_DeltaTime > 0){
vel_BR = 2.0*3.141593*0.036/2.0*1.0/BR_DeltaTime*1000000.0;
}
return ( vel_FL + vel_FR ) / 2.0;
}
Loading