Hi @atsumu-arch ,
Thank you for your question.
Because visual_tracking_manager is belong to mission default, first of all, you have to import the manager by using this code:
from fsup.missions.default.features.visual_tracking_manager import (
VisualTrackingManager
)
Then in your code, you can call the function get_manager of class AbstractMission
self.visual_tracking_mng = mission.get_manager(VisualTrackingManager)
So the class_type argument is VisualTrackingManager (you can get the class name here in the document)
Based on this document section, it is better to import and get the manager in a state. This is an example code of a state named YourState using VisualTrackingManager. Remember to name your code file as your_mission_name/fsup/flying/your_state.py if you want to use this state in flying stage
from fsup.missions.default.features.visual_tracking_manager import (
VisualTrackingManager
)
from fsup.genstate import State
class YourState(State):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.visual_tracking_mng = self.mission.get_manager(VisualTrackingManager)
# Then you can use your manager in YourState
# Create your state's description to be used in stage/transition machine
YOUR_STATE = {
"name": "your_state",
"class": YourState,
}
After that, to apply YourState in stage flying which contains also DEF_FLYING_STAGE, you need to create a flying stage of your own mission (your_mission_name/fsup/flying/stage.py) using the code like below:
from fsup.missions.default.flying.stage import FLYING_STAGE as DEF_FLYING_STAGE
from fsup.genstate import State
# import your state description
from .your_state import YOUR_STATE
class Flying(State):
def can_enter(self, msg):
# You can add your own condition
return True
def enter(self, msg):
# Your code here
pass
def step(self, msg):
# Your code here
pass
def exit(self, msg):
# Your code here
pass
FLYING_STAGE = {
"name": "flying",
# if you don't need to re-create your own Flying class
# and use the default mission one, you can do:
# "class": DEF_FLYING_STAGE['class']
"class": Flying,
# put the name of state that you want to make it as initial
# the name is found in attribute "name" of your state's description
# or you can use the default mission initial state DEF_FLYING_STAGE['initial']
"initial": "name_of_initial_state",
"children": [
# get all children states of default mission
child
for child in DEF_FLYING_STAGE["children"]
]
+ [
# also concatenate it with your own state
YOUR_STATE,
],
}
I hope that this answer is clear for you.
Best regards,
Trang