Drone not holding the height in guided_nogps mode using mavros

Hi.,
I am working on a indoor drone in a gps denied region and planning to put slam on top of that but before all that i am planning to learn how can i control my drone with mavros provided topic ,i am using the ardupilot stack with range sensor attached.

I tried sending some thrust values using the topic /mavros/setpoint_attitude/thrust the drones takeesoff but i am not being to hold the drone at a fixed height ,i have attached an external lrf(long range finder) to find the height and i am getting the desired height but could find the right thrust to be provided to the drone to hold at a fix height.

Here the simple code snippet.

if(self.current_state.mode != “GUIDED_NOGPS” and (rospy.Time.now() - last_req) > rospy.Duration(5.0) and flag_mode == 0):
if(self.set_mode_client.call(self.offb_set_mode).mode_sent == True):
rospy.loginfo(“GUIDED_NOGPS enabled”)
flag_mode = 1
last_req = rospy.Time.now()

        else:
            if(not self.current_state.armed and (rospy.Time.now() - last_req) > rospy.Duration(5.0)):
                if(self.arming_client.call(self.arm_cmd).success == True):
                    rospy.loginfo("Vehicle armed")
                    # self.thrust_data.thrust =1200   
                    # self.thrust_data.orientation.z = -1
                    self.thrust_pub.publish(self.thrust_data)
                last_req = rospy.Time.now()

        if self.height_msg> self.takeoff_height and self.height_msg<self.takeoff_tolerance:
            self.raw_thrust_data.thrust = self.thrust_hold
            

        elif self.height_msg> self.takeoff_tolerance:
            self.raw_thrust_data.thrust = self.thrust_down
            
        else:
            self.raw_thrust_data.thrust = self.thrust_takeoff
           


        # self.pose_pub.publish(self.pose_data)
        # self.rc_data.channels[2] = 1600
        # self.rc_pub.publish(self.rc_data)
        self.raw_thrust.publish(self.raw_thrust_data)
        rate.sleep()

if somebody could help me to find out where i am going wrong would be great help for me.
is the appoach i have taken to hold the drone is right?
please let me know if there is any other approach as well usng mavros and ardupilot to hold the drone at a fixed height