Need to change Value in a new object but told "read only"

2 views (last 30 days)
I need to change the Value MinTurningRadius in a new object instantiated from uavDubinsConnection. Documentation here ( https://www.mathworks.com/help/bioinfo/ref/bioread.set.html#bse31j9-1_seealso) says to use the 'set' method. Result is an error using set, cannot find 'set' method for uavDubinsConnection class.
connectionObj =
uavDubinsConnection with properties:
MinTurningRadius: 18.678
AirSpeed: 10
MaxRollAngle: 0.5
FlightPathAngleLimit: [-0.5 0.5]
DisabledPathTypes: {}
AllPathTypes: {1×28 cell}
>> allProperties = set(connectionObj)
Error using set
Cannot find 'set' method for uavDubinsConnection class.
Do I need to create a method for 'set'? If so, please help.

Accepted Answer

Steven Lord
Steven Lord on 7 Oct 2022
The documentation page to which you linked is for an object in Bioinformatics Toolbox and so isn't really applicable for the uavDubinsConnection object in UAV Toolbox. The entry for the MinTurningRadius property on the object's documentation page (to which I linked earlier) states "This property is read-only." and so you cannot change it directly. It seems that the minimum turning radius is computed by the connection object based on the values of the other parameters. For example, compare the object created with the default property values and the one with a different (higher) AirSpeed.
>> U = uavDubinsConnection
U =
uavDubinsConnection with properties:
MinTurningRadius: 18.6784
AirSpeed: 10
MaxRollAngle: 0.5000
FlightPathAngleLimit: [-0.5000 0.5000]
DisabledPathTypes: {}
AllPathTypes: {1×28 cell}
>> U.AirSpeed = 20
U =
uavDubinsConnection with properties:
MinTurningRadius: 74.7138
AirSpeed: 20
MaxRollAngle: 0.5000
FlightPathAngleLimit: [-0.5000 0.5000]
DisabledPathTypes: {}
AllPathTypes: {1×28 cell}
  2 Comments
Steven Lord
Steven Lord on 7 Oct 2022
If you wanted to determine what air speed results in a specific MinTurningRadius, you could do that with just fzero.
desiredMTR = 30;
f = @(AS) uavDubinsConnection(AirSpeed=AS).MinTurningRadius - desiredMTR;
sol = fzero(f, 10)
I can't run this in MATLAB Answers since UAV Toolbox is not available but I ran it it MATLAB Answers and got an answer of about 12.6733.
>> uavDubinsConnection(AirSpeed=sol)
ans =
uavDubinsConnection with properties:
MinTurningRadius: 30
AirSpeed: 12.6733
MaxRollAngle: 0.5000
FlightPathAngleLimit: [-0.5000 0.5000]
DisabledPathTypes: {}
AllPathTypes: {1×28 cell}
If you want to change multiple parameters you might need to use fsolve in Optimization Toolbox or (maybe) fminsearch.

Sign in to comment.

More Answers (0)

Categories

Find more on Fractals in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!