The Princess Royal has taken on a new role in Portsmouth to mark a significant anniversary.