RVR Collision Response in JavaScript

The RVR does not appear to respond to an OnCollision event, and I have seen some forum conversations that confirm my observation. I encountered one conversation indicating a workaround using the gyroscope, but there was no code example. It seems intuitive to me that a robot like RVR should be able to collide with a chair leg, back up a bit, and head off in another direction until it bumps into something else, etc. and indefinitely respond in that way. Has anyone done this with the API using JavaScript? Has anyone solved the problem with a Raspberry Pi and appropriate sensor? (That is the direction I am heading after getting some fun, basic JavaScript programs working.)

1 Like

Hey @jfgibson!

You are right that it does seem intuitive that a sophisticated robot would have collision detection built-in; that was originally an intended feature, but we opted to remove it as we wanted to discourage people from intentionally colliding RVR with obstacles. In our testing, we found that, because RVR has the same awesome accelerometer as our other bots, but has a much larger mass, collisions between RVR and other objects were much more impactful and, therefore, had a much higher potential to cause damage to RVR’s internal systems.

Given the expandability of RVR, we focused on providing ways for users to add their own sensors through the UART and USB ports, for things like collision detection and beyond! An example of how you might accomplish this with Raspberry Pi can be found on our SDK site and one of our awesome users created a method with micro:bit :slight_smile:

I hope this helps out and can’t wait to see what you accomplish with your RVR! Please keep reaching out and keep us updated on your progress!


1 Like

Kelsey, thanks for referring me to this project. Sounds like the perfect solution!