Lance, contrary to popular belief, was actually great when it came to mechanics.
However when he entered the garrison, he was going after fighter pilot and didn’t want to be put into a different class.
Now, in space, there were already pidge and hunk to figure out all the mechanical stuff and he didn’t want to take that away from them. Even if he was able to figure out most situations far before the two combined were able to figure it out.
However after a particularly bad mission, where Lance had gotten kidnapped by a rogue group of aliens, he wasn’t able to sleep much without nightmares.
So while everyone in the ship was asleep Lance was in the lab building.
He was at it for days. And by the time he was finished he had made about a dozen mini robots and was able to control them with a glove he created.
He didn’t didn’t know what to do with them so he locked them away and mostly forgot about them. Until two months later when the ship was boarded by a group of galra soldiers and the team was captured.
Lance reactivated his robots and single-handedly took down every Galra soldier on the ship.