A device for charging a service robot, comprising a machine-readable storage medium and a processor that are communicatively connected by an internal bus, the machine-readable storage medium stores a computer program executable by the processor, and when executed by the processor the computer program implements the method the steps as following:
- collecting an audio signal generated by a sound source of a charging pile;
- determining a direction of the sound source according to the collected audio signal;
- controlling a robot main body to move toward the sound source direction, to shorten a distance between the robot main body and the charging pile;
- judging whether an infrared receiver array on the robot main body has received an infrared pulse signal emitted by an infrared emitter array of the charging pile;
- and
- when the infrared receiver array has received the infrared pulse signal, controlling the robot main body to move toward a direction of the charging pile according to the infrared pulse signal, to engage a charging component of the robot main body with a charging contact element of the charging pile;
- wherein the step of controlling the robot main body to move toward a direction of the charging pile according to the infrared pulse signal comprises:
- when the robot main body is perfectly facing the charging pile and is normally charged, receiving an infrared pulse signal emitted by a first infrared emitter of the charging pile by using a first infrared receiver in the infrared receiver array, and receiving an infrared pulse signal emitted by a second infrared emitter of the charging pile by using a second infrared receiver in the infrared receiver array, wherein emission frequencies of the first infrared emitter and the second infrared emitter are different, wherein the emission frequency of the first infrared emitter is a first frequency, and the emission frequency of the second infrared emitter is a second frequency;
- determining the direction of the charging pile according to frequencies and intensities of the infrared pulse signals that are received by the first infrared receiver and the second infrared receiver;
- and
- controlling the robot main body to move toward the direction of the charging pile according to the direction of the charging pile;
- and
- the step of determining the direction of the charging pile according to the frequencies and the intensities of the infrared pulse signals that are received by the first infrared receiver and the second infrared receiver comprises:
- if it is determined that the first infrared receiver has received a very strong infrared pulse signal of the second frequency and a very weak infrared pulse signal of the first frequency, it indicates that the robot main body is deviated to the second infrared emitter with respect to the position of the charging pile, and the robot main body is required to move in a direction toward the first infrared emitter;
- and
- if it is determined that the second infrared receiver has received a very strong infrared pulse signal of the first frequency and a very weak infrared pulse signal of the second frequency, it indicates that the robot main body is deviated to the first infrared emitter with respect to the position of the charging pile, and the robot main body is required to move in a direction toward the second infrared emitter.