This paper introduces a new approach for complete drift modeling and compensation for Scanning Probe Microscopes (SPMs) as conventional nanorobots. Although, before this, drift was described as remained error after hysteresis and creep compensation, it can seriously affect SPM performance.Since experimental work accentuated that thermal strain has a dominant contribution, the present model includes only thermal effects. As a significant contribution, an analytical relationship is introduced for heat generation in piezotubes. Then, based on classic heat transfer, the thermal drift for the piezoscanner and microcantilever is modeled. As sub-micro (nano) parts for tip and interfaces in nanoimaging and nanomanipulation modes, the thermal circuit is introduced. Finally, the transfer functions of thermal drift versus ambient temperature variations and piezoscanner heat generation are derived. In this paper, it is not assumed that drift velocity is constant, whereas this assumption was a major drawback of previously presented procedures. This paper, by introducing a comprehensive model and an approximated analytical model, and comparing existent experimental results, shows that the present model is e effective and mathematically traceable in both modes.