Servers by jDrones

Preliminaries for controlling set-point topics using ROS


(Benykoz) #1

Hey guys.
I’m trying to implement my custom control law (Geometric control) on a Navio2 w/Raspi3 using the mavros package.
I have been able to subscribe to different topics such as imu/data and rc/out but I have only been able to publish to rc/override. any other topics, specifically set-point topics such as setpoint_attitude and setpoint_raw are just not reacting.

I suspect that it has something to do with mode changes or specific pre-flight preliminaries.
maybe a cmd/takeoff command must be sent first ? is there a way of disabling this ?
I am testing on a propeller-less quad so maybe the issue is there ?

What have I tried:
changing flight modes to STABILIZE, GUIDED and GUIDED_NOGPS.
Setting SYSID_MYGCS to 1.
Disabling failsafes.

Thanks!


(Jamy Chahal) #2

Hi Benykoz,

I already managed to fly by publishing desired angle and throttle through setpoint_raw.
I suppose you are using mavros with a companion computer ? If so, are you using python or cpp ?
When you publish at the topic, is the topic is feed well ? (you can see it with rostopic echo /mavros/setpoint_raw/attitude)

You can have an example of code here : Cannot get ArduCopter 3.5.7 to takeoff with mavros topic /mavros/setpoint_attitude/thrust


(Benykoz) #3

Thank you KiloNovemberDelta! I have made some progress.

RaspberryPi3 is my companion computer.
At the moment I am publishing directly via linux terminal because I am only experimenting with which topics are best for me.
My end goal is to close a control loop via ROS simulink blockset.
The topic feed is well, however upon publication of the setpoint_raw/attitude message I get an error:

Recieved thrust, but ignore_thrust is true: the most likely cause of this is a failure to specify the thrust_scaling parameters on px4/apm_config.yaml. Actuation will be ignored.

Any assistance will be much appreciated.


(Jamy Chahal) #4

Happy that you are making progress.

I have corrected this error in the last mavros version.
Go to /opt/ros/kinetic/share/mavros/launch and modify (with sudo) the apm_config.yaml
Inside, follow this PR :


(I made a typo mistake, there is an extra space to remove in the “setpoint_raw” line)

To make it simple, apm.launch is using the parameters of apm_config.yaml for the publication. And we need to set the parameter “thrust_scaling” to say that our thrust is between 0 and 1 (normalized) with the latest version of ArduCopter.
It should fix the problem :wink:

FYI, ROS has a library for the PID (http://wiki.ros.org/pid), which is really nice, with graphs etc. It can be a start for your project :slight_smile:


(Khancyr) #5

Hello,

Yes normally you should takeoff before using setpoint ! And don’t disable failsafes !!!


(Benykoz) #6

Thanks for the assistance guys.
I’m afraid I still cant get the setpoint topics to publish.

I have attached a screencap of the SSH to the drone Raspberry pi with the relevant panes (Bottom left the publish command, bottom right the open apm_config.yaml file after the correction was made).

A little more background:
I am trying to fly a tethered quadcopter indoors so I wont be using GPS. At the moment I am trying to achieve full autonomous flight from takeoff to landing without the tether but I can’t control the quad using any setpoint topics.

I have reviewed this PR: https://github.com/dronekit/dronekit-python/pull/712/commits/61e4dbda8693128133d488048f52a5187129f208 and I tried utilizing thrust topics in GUIDED_NOGPS mode for takeoff but no success there as well.

Any assistance would be much appreciated.
Thank you!


(Jamy Chahal) #7

From what I see, the modification of the apm_config.yaml is not take into account, because the error of thrust is still here.
Where do you run mavros ? I see that you are using navio. I don’t know how navio works, but check that navio is using the apm_config.yaml which is in the bottom right terminal.