compounds of the formula : wherein r , r1 and r4 are defined in the specification , and pharmaceutically acceptable salts , esters and tautomers thereof , having activity at peripheral cannabinoid receptors , commonly designated the cb2 receptor class . the compounds are useful for therapy , especially in the treatment of pain , inflammation and autoimmune disease .