The Queen: When you first greet the queen you should refer to her as "Your Majesty," and then call her "ma'am" from then on.
Other royals: If a royal has "HRH" or "His/Her Royal Highness" honorifics before their name, they should be referred to as "Your Royal Highness" when you first greet them and then either "sir" or "ma'am" moving forward. This applies to most high-profile royals like the Duke and Duchess of Cambridge, Prince Philip, Prince Charles, and Prince Harry.
By law, the HRH honorific only applies to daughters and sons of the sovereign and all legitimate male grandchildren. That means that royals like Zara Phillips and Princesses Beatrice and Eugenie do not necessarily need to be addressed by the "Royal Highness" title. However, they typically are referred to by HRH, including on the royals’ official websites, so, to play it safe, you can call them “Your Royal Highness” if you want to be super traditional.