What kind of sensor are you planning to use? You mentioned using analog pins and that you will power your sensor with voltage source supplied by rosbot. You probably meant 5V exposed on the back panel of rosbot (hExt/hSesn). Some of the exposed microcontroller gpio pins have analog in functionality, but you have to remember that in that mode they only support 3.3V logic. Have that in mind, otherwise you can accidently damage your robot if your sensor outputs 5V signal.
If it comes to customizing the firmware code for the ROSbot internal mcu, the best start would be to visit mbed-os documentation. The
mbed-os project is a library/framework that also includes RTOS. We use it for the rosbot firmware. Developing new functionality for the firmware should be like writing any other mbed application. The microcontroller used in rosbot is ST STM32F407ZG (TARGET_CORE2 in mbed). All pins and their aliases (e.g. SENS4_PIN1 = PC_5) are defined in the file PinNames.h. You can inspect pin functionalities in the file PeripherialPins.c or in the reference manual of the mcu.
To communicate with the ros system the microcontrolller uses rosserial library. This examples should help you to add ros interface for your sensor (pulisher/subscriber etc.).
We will (probably soon) rewrite the firmware for mbed6, but it will still use the same rosserial library (at least for ros1) and much of the codebase will stay the same so moving your newly developed functionalities to a new version should be a matter of copy & paste.
Let me know if you need more specific assistance with your case.