Whenever the court, before or during the hearing on the petition, is of the opinion that the minor is mentally disordered or if the court is in doubt concerning the mental health of any such person, the court may proceed as provided in Section 6550 of this code or Section 4011.6 of the Penal Code.