Taking off in Copter

HI,
I am trying to takeoff my quadcopter in Simulation through this command
the_connection.mav.command_long_send(
the_connection.target_system,
the_connection.target_component,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF,
0,
0, param 1
0, param 2
0, param 3
0, param 4
0, param 5
0, param 6
100,param 7 (altitude)
)

This however is giving me an error on the console - Got COMMAND_ACK: NAV_TAKEOFF: FAILED

I even tried to takeoff through the terminal by giving command - takeoff 50 (altitude of 50m) which also got the same error on the console

Is there something I’m missing or doing incorrectly. Please help.

to take off, you should be in guided mode and armed

yeah, I figured that out, thanks