Jk collision detection - improving poseEstimation#285
Conversation
| double x = MathUtil.applyDeadband(vertVal, 0.05) * Constants.MAX_VELOCITY / 10; | ||
| currentVelValue = accelerometer.getVelocityValue(); | ||
| predictedVelValue = Math.sqrt(Math.pow(y, 2) + Math.pow(x, 2)); | ||
| if (Math.abs(currentVelValue - predictedVelValue) > Constants.COLLISION_VALUE) { |
There was a problem hiding this comment.
This current math just checks the magnitude of the velocities; it would be interesting if we could instead use vectors, and after subtracting the two vectors, we could do the vector.norm method to find the magnitude of the vector and then see if that's greater than the collision value squared. Now that I am also obsessed with optimization, this can be improved even further if we change the constant to constants. Collision_Value_squared and do Vector.dot(Vector), which is more efficient as the square root is computationally expensive. Alternatively, we can also do the two velocity vectors (gyro and odometry) and also dot them together, which will scale with both of their magnitudes and the angle between them.
There was a problem hiding this comment.
Should this apply deadband and have Max_Velocity as its third parameter instead? Also, why are we multiplying by Max_velocity /10? (This one i dont really know.)
There was a problem hiding this comment.
also branch needs to be tested.
|
sadly we found out that the accelerometer did not give us accurate data. We are looking into using a different IMU but for now we will just have to manage without this PR. |
Do you mean the NavX2? I heard the pigeon 2 might be better. |
Are accelerometers more accurate at getting accurate acceleration? Maybe we can use this instead of velocity as an alternative measurement. |
No description provided.