A position sensor comprising: a magnet configured to move together with a moving body; a magnetic sensor configured to detect a magnetic flux generated by the magnet; another magnetic sensor configured to detect a magnetic flux generated by the magnet, the other magnetic sensor being different from the magnetic sensor; and a detector configured to detect an anomaly of the magnetic sensor based on a detection value detected by the magnetic sensor, wherein: the magnetic sensor is set so as to detect the detection value taking a value on a locus preset in accordance with a position of the moving body, and the locus is set so that a change rate of the detection value corresponding to change of the position of the moving body differs for each of a plurality of sections set within a movement range of the moving body; the other magnetic sensor is set so as to detect a second detection value taking a value on a second locus preset in accordance with the position of the moving body, and the second locus is set so as to have a preset relation with the locus for each of the sections; the plurality of sections include a first section in which no change rate is set, a second section in which a change rate is set, and a third section in which a change rate larger than that of the second section is set; and the detector is configured to detect the anomaly of the magnetic sensor based on a relation between a first detection value that is the detection value detected by the magnetic sensor and the second detection value detected by the other magnetic sensor wherein: the second locus is set so that a change rate of the second detection value is substantially identical to the change rate of the first detection value for each of the sections; and the detector is configured to detect the anomaly of the magnetic sensor based on the relation between the first detection value and the second detection value. a magnet configured to move together with a moving body; a magnetic sensor configured to detect a magnetic flux generated by the magnet; another magnetic sensor configured to detect a magnetic flux generated by the magnet, the other magnetic sensor being different from the magnetic sensor; and a detector configured to detect an anomaly of the magnetic sensor based on a detection value detected by the magnetic sensor, wherein: the magnetic sensor is set so as to detect the detection value taking a value on a locus preset in accordance with a position of the moving body, and the locus is set so that a change rate of the detection value corresponding to change of the position of the moving body differs for each of a plurality of sections set within a movement range of the moving body; the other magnetic sensor is set so as to detect a second detection value taking a value on a second locus preset in accordance with the position of the moving body, and the second locus is set so as to have a preset relation with the locus for each of the sections; the plurality of sections include a first section in which no change rate is set, a second section in which a change rate is set, and a third section in which a change rate larger than that of the second section is set; and the detector is configured to detect the anomaly of the magnetic sensor based on a relation between a first detection value that is the detection value detected by the magnetic sensor and the second detection value detected by the other magnetic sensor wherein: the second locus is set so that a change rate of the second detection value is substantially identical to the change rate of the first detection value for each of the sections; and the detector is configured to detect the anomaly of the magnetic sensor based on the relation between the first detection value and the second detection value. the magnetic sensor is set so as to detect the detection value taking a value on a locus preset in accordance with a position of the moving body, and the locus is set so that a change rate of the detection value corresponding to change of the position of the moving body differs for each of a plurality of sections set within a movement range of the moving body; the other magnetic sensor is set so as to detect a second detection value taking a value on a second locus preset in accordance with the position of the moving body, and the second locus is set so as to have a preset relation with the locus for each of the sections; the plurality of sections include a first section in which no change rate is set, a second section in which a change rate is set, and a third section in which a change rate larger than that of the second section is set; and the detector is configured to detect the anomaly of the magnetic sensor based on a relation between a first detection value that is the detection value detected by the magnetic sensor and the second detection value detected by the other magnetic sensor wherein: the second locus is set so that a change rate of the second detection value is substantially identical to the change rate of the first detection value for each of the sections; and the detector is configured to detect the anomaly of the magnetic sensor based on the relation between the first detection value and the second detection value. the second locus is set so that a change rate of the second detection value is substantially identical to the change rate of the first detection value for each of the sections; and the detector is configured to detect the anomaly of the magnetic sensor based on the relation between the first detection value and the second detection value.