<< What is the best way to straighten them. >>
It may not be possible. Treated wood is often bundled and shipped wet, so
warping can occur. Premium treated stuff is selected with better stock
(somewhat like quarter-sawed lumber) and will survive a natural drying cycle
better. Picking out better boards at the box store may help.
If the warpage you have is a real concern you might replace the rafters with
common lumber since the treated wood is most useful for ground contact or bug
resistance. Where you live will determine best course of action. Good luck.