For biparental, three and four-way crosses Identity by Descent
(IBD) probabilities can be calculated using Hidden Markov Models and
inheritance vectors following Lander and Green
(< https://www.jstor.org/stable/29713>) and Huang
(

statgenIBD is an R package for calculating Identity By Descent (IBD)
probabilities for biparental, three and four-way crosses. Calculations
are based on Hidden Markov Models (HMM) and inheritance vectors. The HMM
calculations are implemented in Rcpp/C++.
For more complicated pedigrees RABBIT can be used to calculate the IBDs.
install.packages("statgenIBD")
remotes::install_github("Biometris/statgenIBD", ref = "develop", dependencies = TRUE)