Servers by jDrones

ROS setpoint command available?

(Doolly) #1

Hi I used to work on PX4 stack with ROS but I thought the performance was kind of unreliable so I’m trying on APM stack

it seems to be compatible with ROS, since mavros sends mavlink message in the end

but my copter gets ‘setpoint_position’ messages but it does not go to setpoint

it just gets armed and disarmed over and over

I’ve tried GUIDED, GUIDED_NOGPS, POSHOLD mode to use

‘setpoint_position’(SET_POSITION_TARGET_LOCAL_NED) but they don’t seem to be working

am I missing something? or ‘setpoint_position’ is not supported in APM?

(rmackay9) #2

Hi Dooly,

Thanks for giving ROS + ArduPilot a try. I’m quite keen to improve our ROS support.

It should work and we make extensive use of the message for other things (3DR’s Solo uses this for all it’s “smart shots”). It’s very possible there’s something small wrong though which hopefully we can find and fix.

My first guess is just that the vehicle is on the ground and landed. It needs to first be in the air first before it will act on the messages. Could you first try to make the vehicle takeoff? That can be done by sending a command-long with a takeoff command in it. Alternatively you could takeoff in manually Loiter or PosHold and then switch to GUIDED mode.

By the way, only Guided mode will accept this command so that’s the mode to focus on.

(Doolly) #3

actually we are trying fully autonomus flight so we want to take off automatically with out RC

I tried two ways first using set_point like z = 2m to take off
this is my code
but there is ‘wp timeout’ msg and gets armed and disarmed over and over

for a second try I tried takeoff command with this code
but it shows ‘SetMode Failed’ msg and doesn’t even get armed

I’m using opticalflow & lidar to run poshold or loiter

am I missing on preflight check list?:cry:

(rmackay9) #4


Loiter and PosHold modes are manual modes so those require a transmitter to be useful. If there’s no transmitter then it’s Guided and Auto that you’ll want to use.

No GPS… that makes things harder. You’ll need to follow the instructions on this wiki page to ensure the optical flow is working: In particular check out the pre-arm checks section.

Can you make sure that you’ve got AC3.4.5 on the flight controller?

I think it would be good to first test the vehicle with a transmitter in Loiter to be sure the optical flow is working. Also it would be good to use a ground station that displays the pre-arm check failures and the EKF health. Mission Planner definitely does that. I’m less sure if QGroundControl does or not (it probably at least displays the pre-arm check failures).

(Savio Pereira) #5

Was this issue ever figured out? I am trying the same to do the same thing as Doolly. I am trying to use a ROS node to send “setpoint_position/local” messages through ‘mavros’ to my Copter in GUIDED mode. I tried taking off in STABILIZE/ LOITER mode and then in mid-air switched to GUIDED mode. I am using an APM 2.6 with ArduCopter v3.2.1. (I am wondering whether setpoint_messages are supported in this older version). When I echo the ROS topic /setpoint_position/local" I see the desired setpoint but my Copter won’t go to it. I appreciate any help on this. Thanks.

(Khancyr) #6

it isn’t supported on your version …

(Savio Pereira) #7

Thanks a lot @khancyr . Is there any change that can be made in ACv3.2.1 to make it accept setpoint_position messages? Because I have APM 2.6 and that last firmware version supported on it is AC v 3.2.1. If its not possible I understand. Thanks.

(Khancyr) #8

I don’t know enough the codebase for APM and copter 3.2.1 … and I don’t think that much developper want to step back on APM, so I would say you have very few hope to see something like this backport … Pixhawk clone are getting more and more accessible ! I hope you can have one, there are some pretty new improvements and capabilities on it!

(Jonatan Murcia) #9

Hi, i have an APM2.8 and i try use with RPI 3B and mavros, so, is it possible?