This paper presents a methodology for the control of robots, in position and force, using electromyographic (EMG) signals recorded from muscles of the shoulder and elbow. A switching model is used for decoding muscular activity to both joint angles and force exerted from the human upper limb to the environment. The proposed method is able to estimate those variables in cases where no force is exerted to the environment (unconstrained motion), as well as in cases where motion is accompanied with force exertion (constrained motion). The switching model is trained to each subject, a procedure that takes only a few minutes, using a torque-controlled robot arm coupled with the human arm. After training, the system can decode position and force using only EMG signals recorded from 7 muscles. The system is tested in a orthosis-like scenario, in planar movements, through various experiments covering the cases aforementioned. The experimental results prove the system efficiency, making the proposed methodology a strong candidate for an EMG-based controller for robotic exoskeletons.