Velocity driven control from dronekit

Hi,

Is it possible to remotely fly (with a companion computer) by passing velocities in the NED frame? My current setup has ONLY the IMU and a Sonar as the inputs and I wanted to fly it in the local frame with velocity control i.e. command it to go North at 2 m/s for 1 second etc. I’m on px4fm-v2_lpe with a raspberry pi as the companion computer.

I tried the following code on dronekit (from the drone kit API documentation), and there is no change in the flight of the copter.

def send_ned_velocity(velocity_x, velocity_y, velocity_z, duration):
msg = vehicle.message_factory.set_position_target_local_ned_encode(
0, # time_boot_ms (not used)
0, 0, # target system, target component
mavutil.mavlink.MAV_FRAME_LOCAL_NED, # frame
0b0000111111000111, # type_mask (only speeds enabled)
0, 0, 0, # x, y, z positions (not used)
velocity_x, velocity_y, velocity_z, # x, y, z velocity in m/s
0, 0, 0, # x, y, z acceleration (not supported yet, ignored in GCS_Mavlink)
0, 0) # yaw, yaw_rate (not supported yet, ignored in GCS_Mavlink)

Is this possible? If so, what am I doing wrong? Should I switch to EKF?

Regards,
Karthi