A resource selection method, wherein the method comprises: performing, by a first terminal device, resource selection at time n, and determining, by the first terminal device, a candidate resource set for transmitting sidelink data according to a sensing result, wherein the sensing result comprises: a first sensing result that is obtained by the first terminal device performing sensing on A time units after the time n, and A is a positive integer; wherein the method further comprises: determining, by the first terminal device, at least one transmission period within a sensing range before the time n according to a sensing configuration parameter, and determining Y time units which need to be sensed in each of the at least one transmission period, wherein Y is an integer greater than or equal to 1; and performing, by the first terminal device, sensing on the Y time units in the at least one transmission period to obtain a fourth sensing result; wherein determining, by the first terminal device, the candidate resource set for transmitting sidelink data according to the sensing result comprises: determining, according to the first sensing result and the fourth sensing result, the candidate resource set for transmitting the sidelink data from the Y time units within a resource selection window. performing, by a first terminal device, resource selection at time n, and determining, by the first terminal device, a candidate resource set for transmitting sidelink data according to a sensing result, wherein the sensing result comprises: a first sensing result that is obtained by the first terminal device performing sensing on A time units after the time n, and A is a positive integer; wherein the method further comprises: determining, by the first terminal device, at least one transmission period within a sensing range before the time n according to a sensing configuration parameter, and determining Y time units which need to be sensed in each of the at least one transmission period, wherein Y is an integer greater than or equal to 1; and performing, by the first terminal device, sensing on the Y time units in the at least one transmission period to obtain a fourth sensing result; wherein determining, by the first terminal device, the candidate resource set for transmitting sidelink data according to the sensing result comprises: determining, according to the first sensing result and the fourth sensing result, the candidate resource set for transmitting the sidelink data from the Y time units within a resource selection window. a first sensing result that is obtained by the first terminal device performing sensing on A time units after the time n, and A is a positive integer; wherein the method further comprises: determining, by the first terminal device, at least one transmission period within a sensing range before the time n according to a sensing configuration parameter, and determining Y time units which need to be sensed in each of the at least one transmission period, wherein Y is an integer greater than or equal to 1; and performing, by the first terminal device, sensing on the Y time units in the at least one transmission period to obtain a fourth sensing result; wherein determining, by the first terminal device, the candidate resource set for transmitting sidelink data according to the sensing result comprises: determining, according to the first sensing result and the fourth sensing result, the candidate resource set for transmitting the sidelink data from the Y time units within a resource selection window. determining, by the first terminal device, at least one transmission period within a sensing range before the time n according to a sensing configuration parameter, and determining Y time units which need to be sensed in each of the at least one transmission period, wherein Y is an integer greater than or equal to 1; and performing, by the first terminal device, sensing on the Y time units in the at least one transmission period to obtain a fourth sensing result; wherein determining, by the first terminal device, the candidate resource set for transmitting sidelink data according to the sensing result comprises: determining, according to the first sensing result and the fourth sensing result, the candidate resource set for transmitting the sidelink data from the Y time units within a resource selection window.