Compared to biological systems, existing learning systems lack the ability to learn autonomously, especially in changing and dynamic environments. This paper addresses the issue of autonomous learning by developing a self-learning spiking neural network (SNN) and demonstrating its autonomous learning capability using a simple robot controller application. Our proposed learning rule exploits an inherit property of the existing Spike-Timing-Dependent Plasticity (STDP) rule in that if the instantaneous presynaptic frequency decreases, then for a conventional Hebbian window the STDP rule potentiates. Conversely if the instantaneous frequency increases the STDP rule depresses: the opposite is true for anti-Hebbian window. This paper will also show that obstacle avoidance is achievable using a conventional Hebbian learning window while object tracking can be learned using an anti-Hebbian learning window. Hence the proposed learning paradigm is novel in that it does not require external supervisions for either these tasks. The proposed learning paradigm also uses a previously explored astrocyte neuron interaction where a periodic Slow Inward Current (SIC) from an astrocyte can potentiate a postsynaptic neuron for a period of time: this time window can be used to strengthen/weaken synaptic pathways. An obstacle avoidance task is used for the performance analysis and results show that the SNN based robot controller has autonomous learning capabilities under the dynamic conditions.