eborghi10 / quadruped_ctrl

MIT Mini Cheetah quadruped robot simulated in pybullet environment using ROS.
MIT License
16 stars 1 forks source link

Trying your python on a real robot #3

Open elpimous opened 2 years ago

elpimous commented 2 years ago

Hello Emiliano, This package works like a charm. Now, I'd like to test it on my real robot, running with BLDC motors. I'd like to use your python file, to command my motors. (before doing same in c++) Could you tell me what function sends to motor boards, and what receive motor values? Thanks

eborghi10 commented 2 years ago

Hey @elpimous, in my opinion, the easiest way to test this in a real robot would be to use the MIT Controller library (written in C++) which uses the LCM library to interface with the hardware drivers.

The Python components of this code are the simulations which, if you want to try in the real robot, are not needed.

Maybe another approach if you prefer Python, is to replace the walking_simulation.py script but some code that makes use of the libquadruped_ctrl.so shared library like in here but sadly it's not in my plan to do it because this repo is only focused on simulating the MIT Cheetah.

elpimous commented 2 years ago

Hey, @eborghi10 , I agree with you, but, to anderstand c++ code, i need to test python file, to see where c++ fonctions acts, and why (i'm a nearly newbie, and an autodidact coder) Could you just confirm me that in your python file : L239 : imu_data, leg_data, base_pos, contact_points = self.__get_data_from_sim() this fonction receives imu, and motors specs.. And for my real robot, I could send here, in each variable, the real params (10 imu_data params, and joint_positions, joint_velocities, and joint_names of all 12 real motors).

and L249 : tau = self.cpp_gait_ctrller.torque_calculator(self.__convert_type( imu_data), self.__convert_type(leg_data["state"])) the tau variable contents the 12 joints torque params to send to real motors controllers.

Don't see in the py file, where to pick position and velocity to send to real motors, too ?!!

Thanks a lot, Emiliano.

Vincent

elpimous commented 2 years ago

@eborghi10 small UP?!

eborghi10 commented 2 years ago

L239 : imu_data, leg_data, base_pos, contact_points = self.__get_data_from_sim() this function receives imu, and motors specs.. And for my real robot, I could send here, in each variable, the real params (10 imu_data params, and joint_positions, joint_velocities, and joint_names of all 12 real motors).

Yes, that's correct. This part "reads" from sensors drivers.

and L249 : tau = self.cpp_gait_ctrller.torque_calculator(self.__convert_type( imu_data), self.__convert_type(leg_data["state"])) the tau variable contents the 12 joints torque params to send to real motors controllers.

Don't see in the py file, where to pick position and velocity to send to real motors, too ?!!

In this case, the motors are controlled by torque and not velocity or position. This is because the system that is controlled takes its dynamics into account.