Skip to content

Conversation

@Mobby42
Copy link
Contributor

@Mobby42 Mobby42 commented Mar 22, 2025

No description provided.

@Mobby42 Mobby42 added the help wanted Extra attention is needed label Mar 22, 2025
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@Levercpu Levercpu Mar 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also branch needs to be tested.

@Levercpu
Copy link
Contributor

An example of the vector stuff I was talking about @Mobby42 #291

@noahheller
Copy link
Contributor

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.

@Levercpu
Copy link
Contributor

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.

@Levercpu
Copy link
Contributor

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.

Are accelerometers more accurate at getting accurate acceleration? Maybe we can use this instead of velocity as an alternative measurement.

@Levercpu Levercpu added the low priority Not Important label Mar 28, 2025
@Levercpu Levercpu changed the title Jk collision detection Jk collision detection - improving poseEstimation Mar 28, 2025
@Levercpu Levercpu added needs testing Needs testing on real robot small PR labels Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed low priority Not Important needs testing Needs testing on real robot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants