Closed loop controllers for ardupilot

Hi, I want to know how you implemented that in simulator?
yes I have seen that approach but i have to stick with fast planner

thanks

I mean within ROS environment and using RVIZ.
You might give a try on the vision channel, asking if anyone interested to help.

oh okay, I am trying to implement that with gazebo, I will join the discord
one more question, does ardupilot have controllers to make sure the mav follows the path given by the path planner?

thanks

@shubham-shahh, yes, Guided mode has all sorts of controls for allowing external companion computers to control the vehicle.

Hi @rmackay9 thanks for the response. My planner gives out pos, vel, acc, yaw. when I publish those commands on /mavros/setpoint_raw/local which takes in all the params mentioned above, the UAV does not follow the trajectory given by the planner. I am curious if there is some feedback controller in ardupilot which can make sure the UAV is following the trajectory given by the Fast Planner

thanks

Are you using ArduCopter 4.1.1-rc1? Please do.

1 Like

@amilcarlucas please note the extensive support given by @Leonardthall on this link

AAAHH, that one. It has more than enough homework to do from the other thread.
@shubham-shahh please follow the instructions from @Leonardthall and let us know when you fixed it.

2 Likes

The previous set of problems may have been update rate or latency issues. But the aircraft was doing what it was told to do.

As for this approach. I did exactly this in a vicon style chamber and it followed the path very precisly. I suspect that you are not generating the path correctly or creating the correct Mavlink commands.

Again you have not provided a log so anybody can tell you what is happening in the flight controller.

The aircraft does run the guided commands through the position controller so you get exactly what you ask for. If you are running some external position controller rather than just the path generation then the two may be intereacting.

Hello @Leonardthall ,

Trying to help on discord an I just tested your branch , it is working fine with quaternions

But roll and pitch are not responding that well using body rates but yaw is OK. What values can we pass on that mode ?

I just went looking for you on discord.

Thanks for helping @Leonardthall , it works fine now I am in the correct branch :wink:

Will update once it is fixed

Okay, thanks for the insights, I’ll check the messages and I’ll upload the logs

I had exactly the same problem as you, but i’ve been able to fix it. The thing is that you don’t need to use mavros_controllers, ardupilot has a problem with the attitude topic, so you can send a setpoint position msg (/mavros/setpoint_position/local). This is what i’ve done. Fast planner publishes as (/planning/pos_cmd - PositionCommand), so you can transform it to (/mavros/setpoint_position/local - PoseStamped). I think that the drone crashes because fast planner’s tf is a mess. Looks like that the node takes a world coordinate input but the frame of reference is rotated 90 degrees in relation to map. So, to summarize, you do the transform, normalize the tfs by launching static_transform_publisher, and, if your camera is the same as mine, change the fx and fy constants. But notice that this problem is related to the fast planner node, and nothing related to the PR mentioned or ardupilot.

Hi, thanks for the insights
I know about the 90 degree rotation, we can Mimic that rotation with a transformation or in the sdf you can change add that transformation. And I know that it works in the open loop configuration.

The whole point to work with mavros_controllers is to have a closed loop control, that’s what I’m trying to achieve

Thanks

Yes, it looks simple, but i think it is not. Not only yaw is rotated 90 degrees in relation to map frame but also camera_link in relation to base_link, also 90 degrees. I had to do two transforms that doesn’t correspond to reality to make it work for me.

yes I agree with you, but after correcting the transforamtions, ideally the mavros_controllers should work. those transformations are not a result of fast-planner, it’s just how iris copter is implemented in PX4 simulation

thanks