Summary - A C++ library was made to accompany the Mahi Open Exo robot. The library uses the MAHI labs internal libraries, and makes controlling the robot simple and intuitive. The library also enables seamless communication with the Mahi Open Exo simulation, which enables all software intended to run on the physical robot to be tested in a safe environment.
The MAHI Open Exo runs based on a c++ library that I have developed based on the MEII software library that was used before. This library is set up to interface with a number of DAQs that we have in our lab. The library also abstracts out all necessary conversions so that the user can provide inputs and read outputs directly in useful units. This includes converting encoder position and velocity readings to radians for all joints, accounting for gear ratios, as well as allowing the user to provide command torques to the robot, accounting for conversions from voltage output, to current output, to motor torque output which is then amplified through a gear ratio. An example of some of the high-level commands are shown below.
// enables communication with the daq and turns on the motor drivers moe.enable(); // updates the internal model of the robot's state moe.update(); // get all joint positions, or just get the position from a single joint moe.get_joint_positions(); moe.get_joint_position(0); // set all raw joint torques moe.set_raw_joint_torques(command_torques); // set torques based on tuned PD gains for position control moe.set_pos_ctrl_torques(reference); // checks the status of all important states to make sure // that the robot is in a safe configuration moe.any_limit_exceeded();
One of the most important features of this library is that it is tightly integrated with the MOE simulation that has been created to work alongside the robot. Through a simple command line flag which can be added to any program, the program will communcate with the MOE simulation instead of attempting to connect to the appropriate DAQ. This is extremely valuable because it lets the user test any program before running it on the actual robot. Not only does this help verify that the program is doing what it was intended to do, but because it includes accurate dynamics of the robot, control algorithms can be tuned using the simulation so that we know they will run effectively the first time on the real robot.