Skip to content

UnboundLocalError: local variable 'radius' referenced before assignment #766

@Gui-FernandesBR

Description

@Gui-FernandesBR

Describe the bug

Reported today on discord: thread ID: 1337930498739277898

MRT014 [LURA]
OP
— Today at 8:38 PM
We're using a creating a rocket and we're having an issue with the radius. The stability is also way off as well. I've attached the output as a txt file since there's a character limit. Any help would be much appreciated

config.py
sustainer_po_cd, sustainer_poff_cd, sustainer_cp = parse_rasaero_file(join(this_dir, "data", "sustainer.CSV"))
SUSTAINER_PARAMS = {
"radius": 0.057/2,
"mass": 1.687, # airframe mass
"inertia": (645548/(110**9), # x
229864458/(1
109),# y
229883464/(1*10
9) # z
), # Just airframe
"coordinate_system_orientation": "nose_to_tail",
"center_of_mass_without_motor": 0.829,
"power_on_drag": sustainer_po_cd,
"power_off_drag": sustainer_poff_cd,
"center_of_pressure_source": sustainer_cp
}

sustainer.py
from lura_rockets.G2_DART.CDR import config
from lura_rockets.supersonic_rocket import SupersonicRocket

===== ROCKET =====

dart = SupersonicRocket(**config.SUSTAINER_PARAMS)

===== PARACHUTE =====

main_parachute = dart.add_parachute(**config.SUSTAINER_MAIN_PARACHUTE, sampling_rate=100)
drogue_parachute = dart.add_parachute(**config.SUSTAINER_DROGUE_PARACHUTE)

dart.all_info()

Running
sustainer.py
output

Expected behavior

MRT014 [LURA]
OP
— Today at 8:54 PM
Fixed this. Rockets are required to have atleast one aero surface otherwise the loop in
rocketpy/plots/rocket_plots.py
in the function
_draw_tubes
exits prematurely and therefore the return value
radius
has not been defined
Gui [RocketPy Team] — Today at 9:24 PM
We should allow the draw method to work properly even if no aerosurface is provided. Thanks for opening this question!

Additional context

Should be quite easy to solve the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingGood first issueGood for newcomers

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions