Hi, I was doing several attemps trying the two controllers with the method "send_zdistance_setpoint".
I notice that probably they process the data in different ways. If I write 0 on the third parameter (yaw-rate) the Mellinger begins to rotate, while the pid no.
The same for the roll setpoint, a value of 10 for the PID gives different output from the same value of 10 for the Mellinger.
Do you know this effect? How do the controllers elaborate the data?
It's important for me because I'am working on a project to compare them.
Mellinger and PID controllers (send_zdistance_setpoint)
-
- Beginner
- Posts: 13
- Joined: Tue Apr 13, 2021 9:09 am
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Mellinger and PID controllers (send_zdistance_setpoint)
I don't have a good answer for you, but the best way forward is probably to check out the code. The set point structure in the Crazyflie is very generic and fairly confusing, you can find the definition here https://github.com/bitcraze/crazyflie-f ... #L175-L196
There is a mode associated with each value that tells you if the value is absolute or velocity.
As you can see in the python lib https://github.com/bitcraze/crazyflie-l ... #L105-L116 the send_zdistance_setpoint() method uses the generic commander, TYPE_ZDISTANCE.
This is handled in the Crazyflie in the crtp_commander_generic.c, https://github.com/bitcraze/crazyflie-f ... ric.c#L126
Here you can see what values and modes that are set in the setpoint struct.
The struct is then pushed into one of the controllers (depending of your configuration) and you will end up here https://github.com/bitcraze/crazyflie-f ... _pid.c#L60 or here https://github.com/bitcraze/crazyflie-f ... ger.c#L124
From here I don't really know the details, and you will have to try to figure it out from the code how the values are used in different modes. It is possible (likely) that all controllers do not support all combinations of modes and maybe this is the reason you see different behaviour?
Good luck!
There is a mode associated with each value that tells you if the value is absolute or velocity.
As you can see in the python lib https://github.com/bitcraze/crazyflie-l ... #L105-L116 the send_zdistance_setpoint() method uses the generic commander, TYPE_ZDISTANCE.
This is handled in the Crazyflie in the crtp_commander_generic.c, https://github.com/bitcraze/crazyflie-f ... ric.c#L126
Here you can see what values and modes that are set in the setpoint struct.
The struct is then pushed into one of the controllers (depending of your configuration) and you will end up here https://github.com/bitcraze/crazyflie-f ... _pid.c#L60 or here https://github.com/bitcraze/crazyflie-f ... ger.c#L124
From here I don't really know the details, and you will have to try to figure it out from the code how the values are used in different modes. It is possible (likely) that all controllers do not support all combinations of modes and maybe this is the reason you see different behaviour?
Good luck!
-
- Beginner
- Posts: 13
- Joined: Tue Apr 13, 2021 9:09 am
Re: Mellinger and PID controllers (send_zdistance_setpoint)
Hi, I read all the codes and the controllers seem to have the same set point value.
Probably, I 've thought that the difference is in the reference systems. Could be possible that the Mellinger receives setpoint in the world reference and not in the body reference?
If yes, I could multiply the values with the rotation matrix and solve this issue. Do you know which is the rotation matrix?
I have only the flow deck v2, so I cannot have absolute coordinate.
Probably, I 've thought that the difference is in the reference systems. Could be possible that the Mellinger receives setpoint in the world reference and not in the body reference?
If yes, I could multiply the values with the rotation matrix and solve this issue. Do you know which is the rotation matrix?
I have only the flow deck v2, so I cannot have absolute coordinate.
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Mellinger and PID controllers (send_zdistance_setpoint)
As mentioned in another thread, this as been files as an issue in https://github.com/bitcraze/crazyflie-f ... issues/789
-
- Beginner
- Posts: 13
- Joined: Tue Apr 13, 2021 9:09 am
Re: Mellinger and PID controllers (send_zdistance_setpoint)
Yes, I've read, thanks.
But maybe, the problem is not only the yaw. As I wrote, also the roll setpoint is decoded in different ways by pid and Mellinger.
Is this correct? Have you tested it?
But maybe, the problem is not only the yaw. As I wrote, also the roll setpoint is decoded in different ways by pid and Mellinger.
Is this correct? Have you tested it?
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Mellinger and PID controllers (send_zdistance_setpoint)
Ah, I did not see any roll problems, but on the other hand I did not look too close either. I added it as a comment to the github issue.