There are plenty of tutorials online about integrating I2C sensors with ROS, take a look at those. Also, you wouldn't be using the ultrasonic sensor to stabilize flight, that would be done with the on IMU. The 750,00+ lines of ardupilot code take care of this. What you want is to be able to track your position based using the ultrasonic sensor, not necessarily use that sensor to stabilize and fly the drone.
The way I see it, to do the localization you have two choices. First, you can use the ultrasonic sensor alone (which would be okay for simple flights in straight lines and with no tilt). The second and more sophisticated option would be to implement a dead reckoning algorithm on the IMU data and use ultrasonic data to correct and prevent drift, as well as some mapping.
The problem with using the ultrasonic sensor alone is that once your drone starts to do more complex flights which could involves tilts or rotations, you're no longer looking straight at the walls/barriers and the ultrasonic data is not very useful. You have to be able to extract the orientation of the drone in order to be able make sense of that data. This would involve using the accelerometer, gyroscope, and even magnetometer to extract the orientation and then filtering the raw data to get useful information. Since you're going through the work of constantly keeping track of the orientation of the drone you might as well start dead-reckoning to add to the accuracy to your localization. (Dead reckoning is simply tracking location by constantly double integrating acceleration and updating position). You can use the newly filtered ultrasonic data to track your relative velocity to the walls and then use that to correct the drift in your dead reckoning algorithm.
Obviously that's a lot to take in at once. My advice would be to first get the drone flying with an RC. (Always have an RC in case you need to unexpectedly take control during an autonomous flight). Once you have that down start doing simply flights (back and forth in a straight line) and use 1 ultrasonic sensor to track your position in one dimension. Then extract your 1 -dimensional speed. Then start to look into orientation tracking, quaternions and dead reckoning algorithms. It'll come slowly, but it is definitely worth it.