First, scientists made a special dune out of sand from the Arizona desert. They painted marks on snakes in order to watch their movements.
They then used a robotic snake to work out the best way for snakes and robots to climb the slopes without slipping.
Surfaces like sand dunes are unstable and are difficult for animals and robots to cross.