Making drone move using uORB


I’m trying to get my drone to move to an object a few meters in front of it using uORB publishers. I am currently using the vehicle_command message to achieve this, but the drone ends up going off indefinitely instead of stopping. Any ideas as to what’s going on?

This is a piece of my code

vehicle.command = 192;
vehicle.param5 = (double)raw3.ref_lat;
vehicle.param6 = (double)raw3.ref_lon + current_distance;
vehicle.param7 = (double)raw3.ref_alt;

orb_publish(ORB_ID(vehicle_command), vehicle_pub, &vehicle);

vehicle is a vehicle_command_s struct
raw3 is a vehicle_local_position_s struct
current_distance is the current_distance field from a distance_sensor_s struct.