mohakbhardwaj / franka_motion_control

MIT License
16 stars 4 forks source link

why just "return tau_z_" in gravity_command_loop() function can realize gravity compensation? #3

Open mao8-explorer opened 1 year ago

mao8-explorer commented 1 year ago
void FrankaController::gravity_command_loop(){

    while(ros::ok()){
        robot_.control([&](const franka::RobotState& robot_state, franka::Duration period) 
                                            -> franka::Torques {            
            publishRobotState(robot_state);
            return tau_z_;
        }
        );
    }

}

\ Respect teacher, why only one line return tau_z_ can solve all problem? \ (put arm in gravity compensation mode) \ I didn't find any code related to tau_z_ .\ Can you teach me how?

mao8-explorer commented 1 year ago

This is a simple controller commanding zero torque for each joint. Gravity is compensated by the robot.