Just like you, I was new to ROS just 3 months ago. So my idea of "programming a robot" was to write codes that will run on a microcontroller (that pretty much runs everything from the motor control to the sensors and communication).
How I finally got my two wheel robot running using ROS:
- The tutorials (the publishing/subscribing one that Dimitar pointed out was very useful)
- Looking at the codes for turtlebotsim and turtlebot
- Using the tutorials to see how the turtlebot codes are related (in particular what each node publishes, and which nodes subscribe to that topic)
- The easiest was the 'cmd_vel' topic where you can see the result in both turtlebotsim and turtlebot (if you have it). So this was the starting point to get my own robot working.
- With the turtlebot_teleop node/code already there, I started writing my own subscriber to printout what was on 'cmd_vel' while running the teleop program, and then progressing to pushing the 'cmd_vel' values out onto my robot motors.
- Once I got the basic idea of how the nodes run separately, yet are connected through ROS topics, I progressed to writing publishers/subscribers for sensor data.
I think the crucial step for me while learning ROS was the understanding that there is no longer a need for a central brain/control to tell the robot to 'do this at this time'. Instead, each robot module (sensors, motors) would just do what they do best when they see something published. Eg. motors subscribe to a robot velocity command and convert that into wheel velocity; sensors just keep reading and publishing their readings, without the need to know what the readings are used for.