robot-name: collision detection not convincing
See original GitHub issuedifferentRobotsHaveDifferentNames
and resetName
are not proper tests for detecting collisions. They need many more iterations to be convincing (~1/670000).
Here is my modified test:
import org.junit.Test;
import java.util.stream.IntStream;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
public class RobotTest {
private static final String EXPECTED_ROBOT_NAME_PATTERN = "\\w{2}\\d{3}";
private final Robot robot1 = new Robot();
private final Robot robot2 = new Robot();
@Test
public void hasName() {
assertIsValidName(robot1.getName());
}
@Test
public void differentRobotsHaveDifferentNames() {
IntStream.range(0, 300000).forEach(x -> {
assertThat(robot1.getName(), not(equalTo(new Robot().getName())));
});
}
@Test
public void resetName() {
IntStream.range(0, 300000).forEach(x -> {
final String name = robot2.getName();
robot2.reset();
final String name2 = robot2.getName();
assertThat(name, not(equalTo(name2)));
assertIsValidName(name2);
});
}
private static void assertIsValidName(String name) {
assertThat(name.matches(EXPECTED_ROBOT_NAME_PATTERN), is(true));
}
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Collision detection not working unity - Stack Overflow
The physics Layer Collision Matrix is set to not detect collision between the layers the objects are (enter Edit > Project > Phisics...
Read more >Self-collision avoidance — NAO Software 1.14.5 documentation
Collision detection and avoidance only works for Joint methods but not for Cartesian and Whole body methods. It also works when making the...
Read more >Unexpected behaviour of checkCollision for robot collision ...
I want to use the function with no or very small z-offset in order to do a realistic collision detection. Is this just...
Read more >Advanced Collision Detection — NVIDIA PhysX SDK 3.4.0 ...
Then next frame, the SDK's contact generation takes over and generates a convincing motion. There are some subtle details not described here, but...
Read more >Collision detection - Coppelia Robotics
CoppeliaSim can detect collisions between two collidable entities in a flexible way. The calculation is an exact interference calculation. Collision detection, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a feeling that the specification of this exercise disallows convincing tests. There’s no canonical test data. If anyone is interested in picking this up in the future I’d recommend starting by reviewing the tests in other tracks to see if this conundrum has already been worked around someplace else.
Closing until there’s interest in actively working on this again.