How to ardupilot drone move forward, backward, left, and right using mavros?

I can take off and land the drone through mavros by
rosrun mavros mavcmd takeoffcur 0 0 5,
rosrun mavros mavcmd landcur 0 0 and
“op”: “call_service”,
“service”: “/mavros/cmd/takeoff”,
“min_pitch”: 0,
“yaw”: 0,
“latitude”: 8.5456068,
“longitude”: 47.3977505,
“altitude”: 0
but I don’t know how to make it fly around. Could anyone help? Thank you!

Set the mode to guided and use guided commands.

Thanks! Do you use rosrun to control the drone through mavros?

No, I do not. I use C++ code to call mavros functions to control UAV`s. We will not have RC connected to our UAVs, it is 100% controlled by software running on the companion computer. Works great.

We only use command line rosservice call or rostopic pub for debugging purposes. And it also works fine.

It looks like you are trying to use bash to automate a copter. But that is not that flexible and is not the way mavros is meant to be used. You should use python instead, or even better C++.