I have noticed everywhere that professional robotics companies use hydraulics over electric motors. I want to know why that is. Why can they make custom electric motors that are really powerful. Surely that would be cheaper than buying hydraulic fluid, solenoids, pumps, etc. Could someone please explain why that is?
Hydraulics and pneumatics let you separate the mechanical power generation component (compressor, hydraulic power unit, etc.) from the actuator. In the case of something like a robotic arm, this means that you only have to move the actuator.
Consider a gripper on a robotic arm. If you're going to use a motor, then you have to determine how quickly you want the gripper to open and close and how much force you want the gripper to be able to apply; this would determine the gearing and motor specifications.
You can use a smaller motor and get high grip forces with a high gearing, but then you are moving at a slow speed. If you want a high-speed, high-force gripper, then you need to have a larger motor.
The issue then is that your motor, driving the gripper, is at the very end of the robot arm. This increases the torque requirements on all the other joint motors, which have to support that large motor on the end effector.
The alternative is to use hydraulics or pneumatics. A cylinder is a hollow metal tube with a plunger inside. The weight of the actuator is relatively independent of the hydraulic motor, which can be moved off the arm.
When you move the motor off the arm you reduce the weight limit on the other joints, but you also reduce your motor requirements. You are now able to use a low-efficiency (read: cheap) motor to pressurize the hydraulics. If you have one hydraulic power unit then you can probably run multiple hydraulic actuators simultaneously; the incremental cost of getting a marginally larger hydraulic power unit is probably less than the cost of another high-performance electric motor.
The hydraulic cylinders themselves are remarkably cheap; here's one (no affiliation) that is rated for 9,500 lbf with an 8 inch stroke for \$120, here's an electric actuator (again no affiliation) that does about 1/8th of the force (1,200 lbf) at a 50% duty cycle for \$800.