chvmp / champ

MIT Cheetah I Implementation
BSD 3-Clause "New" or "Revised" License
1.52k stars 354 forks source link

Hardware Interface read() write() #134

Open elpimous opened 11 months ago

elpimous commented 11 months ago

Hello @grassjelly .

in your Hardware Integration page, you mention : Publish all the actuators' current angle using sensor_msgs/JointState to 'joint_states' topic.

However, it is not used into your code.

1/ Do you have anywhere, a hardware interface with both read and write functions ?
2/ Could i read imu values, to stabilize robot walk (any idea where i could start ? My imu is working and correctly publishing.) Take care of you, Juan. Vincent

grassjelly commented 11 months ago

hey Vincent, the joint_states is mainly for autonomy (odometry calculation).

You can use an IMU's reading to control the body pose here. Here's a pseudo code.

auto feedback = readIMU();
auto target_pose = req_pose_;
auto new_pose = pid(target_pose, feedback);
body_controller_.poseCommand(target_foot_positions, new_pose);
leg_controller_.velocityCommand(target_foot_positions, req_vel_, rosTimeToChampTime(ros::Time::now()));
kinematics_.inverse(target_joint_positions, target_foot_positions);
elpimous commented 11 months ago

Hey, Juan. Thanks for feedback I'll test it, for sure 👍