Create my own auto take-off mode for AltHold

Hi all,
I’m coming here with some questions about auto take off mode. So first let me explain what I’d like to create, I’d like to create an auto take off (at 1.5m) procedure for AltHold.
What I did, I’ve read and found some functions in source code auto_takeoff_run (use in auto and guided mode) in takeoff.cpp so I cloned this function to my8takeoff and removed all wp_nav use.
But now I have two questions, first about this line

motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);

For me this is to rough, I’d like to create more smooth take off, so is it possible to put my 6 copter motors at for example 80% during take off ?

And second question I don’t understand where I can add my desired altitude is it this part of code ?

if (inertial_nav.get_altitude() >= auto_takeoff_no_nav_alt_cm) {
    auto_takeoff_no_nav_active = false;            
} 

So for example can I replace this if with another if using lidar value ?

Sorry if my question are simple, I’m sure I haven’t search in code place in source code but I’m begining with ArduPilot dev :blush: :blush: