While trying to drive a Choreo trajectory, our robot crashed on trying to run the path. The error, which occurred on line 147 of ChoreoTrajectoryState.java message was complaining about “moduleForcesX” being null. After some digging, I found our .traj file never contained any refrence to “moduleForcesX” (or Y for that matter). I tried adding the forces to the file, (linked below) which ended up causing our auto to run perfectly.
The file in question (with added moduleForces. Originally they didn’t exist):
{
"samples": [
{
"x": 1.394942164421087,
"y": 5.518360614776611,
"heading": 1.84875077287886e-27,
"angularVelocity": 1.4822655113841015e-28,
"velocityX": -1.213236692173835e-15,
"velocityY": -3.5166330252367655e-17,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0
},
{
"x": 1.566563541858529,
"y": 5.523335154995097,
"heading": 4.4814092376389406e-18,
"angularVelocity": 4.416590645552437e-17,
"velocityX": 1.6913907478799162,
"velocityY": 0.04902589308007284,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.10146761039845839
},
{
"x": 1.854327139843972,
"y": 5.531676141494075,
"heading": -1.217031906378743e-18,
"angularVelocity": -5.616019854503447e-17,
"velocityX": 2.8360143385203562,
"velocityY": 0.08220343877443201,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.20293522079691678
},
{
"x": 2.1420907378196676,
"y": 5.5400171279903745,
"heading": -4.390783265163983e-19,
"angularVelocity": 7.667013887088083e-18,
"velocityX": 2.8360143384246648,
"velocityY": 0.0822034387480355,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.30440283119537515
},
{
"x": 2.429854335795379,
"y": 5.54835811448738,
"heading": 2.4080647720013254e-18,
"angularVelocity": 2.8059624992562243e-17,
"velocityX": 2.836014338424463,
"velocityY": 0.082203438754986,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.40587044159383356
},
{
"x": 2.717617933780805,
"y": 5.556699100986467,
"heading": 1.2009921267360191e-17,
"angularVelocity": 9.46297686109725e-17,
"velocityX": 2.836014338520325,
"velocityY": 0.08220343877551237,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.507338051992292
},
{
"x": 2.889239311218251,
"y": 5.561673641204834,
"heading": -3.671238763508741e-27,
"angularVelocity": -1.183621155643953e-16,
"velocityX": 1.6913907478799504,
"velocityY": 0.04902589307890398,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.6088056623907504
},
{
"x": 2.8892393112182564,
"y": 5.561673641204834,
"heading": -1.8147394434364714e-27,
"angularVelocity": 4.115586734992291e-28,
"velocityX": -6.601455250783312e-16,
"velocityY": -1.9134691080238238e-17,
"moduleForcesX": [0.0, 0.0, 0.0, 0.0],
"moduleForcesY": [0.0, 0.0, 0.0, 0.0],
"timestamp": 0.7102732727892088
}
],
"eventMarkers": []
}
I have many questions:
Could this be an issue with the fact we don’t use the WPI Command-Based framework? Why hasn’t anyone else experienced this issue? Will we have to add empty moduleForces to every traj file? What are these moduleForces even used for?
If someone wants our code, the link is here. Just look in the Autonomous.kt for the frankenstein auto code.