I want to control the drone via /mavros/setpoint_raw/local or attitude

I am working on using fast planner in ardupilot environment.

but i have a problem

I am working with reference to using fast planner in px4 environment. px4 uses /mavros/setpoint_raw/attitude. But ardupilot does not use that topic. What should I do?

i try to

rostopic pub -r 1 /mavros/setpoint_raw/local mavros_msgs/PositionTarget “header:
seq: 0
stamp: {secs: 0, nsecs: 0}
frame_id: ‘map’
coordinate_frame: 3
type_mask: 128
position: {x: 10.0, y: 0.0, z: 0.0}
velocity: {x: 0.5, y: 0.5, z: 0.5}
acceleration_or_force: {x: 0.0, y: 0.0, z: 0.0}
yaw: 0.0
yaw_rate: 0.0”

but drone is not move.

and when i try to /mavros/setpoint_raw/global , drone is moved…
but i really want to use topic about /mavros/setpoint_raw/global.

If I remember well, this issue has been resolved by @shubham-shahh here

1 Like

Hi, yes @ppoirier, now I’m able to use mavros_controllers with Ardupilot. Firstly @romaster93 PositionTarget shouldn’t have any issues working with Ardupilot, you must be using incorrect typemask, can you please share logs? Or can you tell if you’re using guided mode etc
The mavros attitude message will only work with Ardupilot 4.2.0 i guess

As far as I remember, type mask 128 means you’re ignoring only acceleration in Y axis

I can see you are sending position and velocity, you can use

Typemask=4032

@shubham-shahh

thanks for your reply!!

Im using GUIDED mode and now I publish /mavros/setpoint_raw/local topic using typemask = 4032, but drone is not move… just flow.

I attach my video.

I check your post : Closed loop controllers for ardupilot - #2 by ppoirier

I also using mavros_controller for FAST-planner!!

I really need your help… :clap:

I using px4_fast_planner(GitHub - mzahana/px4_fast_planner: Integration of Fast-Planner with PX4 autopilot for multi-rotor fast navigation with obstacle avoidance)
I read all code, and. now I know that it just publish only /mavros/setpoint_raw/attitude using remap.

p.s @ppoirier how to download ardupilot log in ubuntu,? mission planner is now supported in ubuntu.

Hi, first of all, I don’t know why you are sending a velocity of 220 m/s in X-axis. are you sure about the coordinate frame you are using? there is no frame=6, you can check the docs for the message definition here you can understand frame conventions in mavlink and ardupilot docs.

I have worked with the fast planner repo you mentioned. I have made it work for ardupilot. soon I’ll make the work open source so you can have a look at it

thanks

The reason I set the speed high was that there was no change, so I purposely made it very high. The coordinate was set to 6 referring to other examples. Let’s take a look at the doc. I look forward to your source.

Then, is there anything else that needs to be modified other than coordinates and velocity? In general ardupilot, should setpoint_raw/local be reflected?

ps.
If I change the coordinates to 8, it works right away. I’ll edit the package and try to make it work. thank you @shubham-shahh

@shubham-shahh hi !!!

now im testing topic publish about /mavros/setpoint_raw/attitude, but i does not react…

i saw this link (Copter: Body rate control in GUIDED mode. · Issue #14610 · ArduPilot/ardupilot · GitHub) but i dont know how to solve this.

can you advise to me…?

You should be using the later version of ardupilot or atleast ardupilot 4.2.0 if I’m not wrong

@shubham-shahh

hi

After i apply this link(Add body rate control to GUIDED mode · larics/ardupilot@f5fb3bd · GitHub), /mavros/setpoin_raw/attitude topic is delivered, but the drone cannot maintain its posture. Is it a version issue? Or is the value calculated by mavros_controller wrong?

Attach the video. 2022 04 21 11 17 03 - YouTube

Edit: Please use 4.2Dev.

That PR was not pulled into master because a more complete PR was added to master instead.

@hendjosh

hi !!

Are you referring to this link?

link : GitHub - ArduPilot/ardupilot at Copter-4.2

Yes, clone the ardupilot repo and checkout the 4.2Beta branch that will have set_attitude plus the return message

@hendjosh

hello. Thanks to your feedback, the drone is flying normally!

But there is one problem. path update is very slow.

Do you also use this command when running simulations?

command : (cd /ardupilot/ArduCopter)…/Tools/autotest/sim_vehicle.py -f gazebo-iris --console --map --mavproxy-arg="–streamrate=30"

Truthfully, I’ve not used gazeebo and ROS before. They are amongst my never ending list of things To Do :slight_smile:

can you please share the link to the PR?

thanks

But you really should not directly use that. There are two other PRs after it to fix and add improved logging. Instead if you have a custom branch. Rebase it to 4.2 or 4.3 and then add your commits on top.

1 Like

@shubham-shahh

Have you updated the repository?

Hi, I am still working on it

I’m also almost done with the work. But there is one problem. The pcl data generated by the fast planner is not generated smoothly, so generating the real-time target_pose is slow and does not convey the attitude quickly.

as I mentioned on discord pm you should talk to @khancyr since I think it has something to do with how gazebo sends data to and fro through UDP. also do check the tracking error as I mentioned over discord

thanks