I think you want a magnet that can be turned on and off. This is an electromagnet. It is basically a coil of wire on an iron core that is shaped so the magnetic field is where it is needed. It could be U shaped in your case (horseshoe), or a cylindrical variation of that. The magnetic strength is proportional to the number of turns and the electrical current that flows, as well as the iron core characteristics. It will need hundreds of turns. It is true that some relays may be a good start, something to dismantle. I suggest a 6V coil is good, with a resitance of about 15 to 20 ohms. The thicker the wire the more turns you can have, but the weight and size increases. It is a tradeoff on how big and how heavy and how strong. It will be important everything in the robot is as light as possible. Unfortunately it needs to be powered while the magnet is activated. There is no other way. These can be as strong as the best permanent magnets. The weight of the battery and robot will be an issue. Go for a lithium battery that is well matched to the current drawn by the electromagnet, for its lighter weight. When the magnet is turned off it generates a high voltage across the coil connection as the field collapses. I expect you are using some sort of a programmed system to control the action. Electronic components like transistors of suitable current rating can be used to switch the magnet on and off, but need protection from this "back emf". The simplest protection is to connect a 1 amp diode across the coil, in the reverse direction, so it does not short out the battery, but does short out the reverse voltage spike. It might be possible to use permanent magnets. A spoked wheel not using the rim. The magnets are like boots on the end of the spokes. As one is are levered up by the rotation, the next one comes down first to hold the position. This might be trickier than it seems, but I have heard that it can be made to work.