Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F5277178
bs_file.h
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Size
3 KB
Referenced Files
None
Subscribers
None
bs_file.h
View Options
class
Reliability_LowLevel
:
public
Functionality
{
float
Agent
::
getInputReliability
(
SensorSlotOfAgent
*
mountedAgent
,
float
actualSensorValue
)
{
float
inputReliability
;
float
previousSensorValue
;
// calculate input reliability
#ifdef PRINT
printf
(
"%s - "
,
name
.
c_str
());
#endif
// PRINT
if
(
mountedAgent
->
getPreviousSensorValue
(
&
previousSensorValue
))
{
inputReliability
=
reliabilityModule
->
getRelibility
(
actualSensorValue
,
previousSensorValue
,
mountedAgent
->
getValueSetCounter
());
}
else
{
inputReliability
=
reliabilityModule
->
getAbsoluteReliability
(
actualSensorValue
);
}
#ifdef PRINT
printf
(
"rel = %f
\n
"
,
inputReliability
);
#endif
// PRINT
return
inputReliability
;
}
void
Agent
::
combineConfidenceAndReliabilityOfActualPossibleScores
(
vector
<
PossibleScore
*>
*
actualPossibleScores
,
float
inputReliability
)
{
for
(
auto
&
pS
:
*
actualPossibleScores
)
{
// combine input reliability with score confidence
// NOTE: multiplication, AND, or average would be alternatives (best to
// worst: AND = Multiplication >> Avg) pS->confOrRel = pS->confOrRel *
// inputReliability; pS->confOrRel = (pS->confOrRel + inputReliability) /
// 2;
pS
->
confOrRel
=
std
::
min
(
pS
->
confOrRel
,
inputReliability
);
combineConfidenceAndReliabilityOfActualPossibleScores
(
actualPossibleScores
,
inputReliability
);
for
(
auto
&
sS
:
*
suggestedScores
)
{
for
(
auto
&
aPs
:
*
actualPossibleScores
)
{
if
(
aPs
->
score
==
sS
->
score
)
{
// combine suggested score with actual score
// NOTE: multiplication, AND, or average would be alternatives (best
// to worst: AND > multiplication >> average) aPs->confOrRel =
// std::min(aPs->confOrRel, sS->confOrRel);
aPs
->
confOrRel
=
(
aPs
->
confOrRel
+
sS
->
confOrRel
);
// aPs->confOrRel = aPs->confOrRel * sS->confOrRel;
}
}
}
// save actual possible scores in history
saveActualPossibleScoresInHistory
(
actualPossibleScores
);
// evaluate all possible scores (based on the history)
vector
<
PossibleScore
*>
possibleScores
;
// printf("SIZE BEFORE: %u\n", possibleScores.size());
getAllPossibleScoresBasedOnHistory
(
&
possibleScores
);
// printf("SIZE AFTER: %u\n", possibleScores.size());
// sort all possible scores so that outputRel_i >= outputRel_i+1
std
::
sort
(
possibleScores
.
begin
(),
possibleScores
.
end
(),
compareByConfRel
);
// send possible scores to high level agent
// sendPossibleScoresToMaster(&possibleScores);
for
(
auto
&
pS
:
possibleScores
)
{
#ifdef PRINT
printf
(
" > possible Score %i / %f
\n
"
,
pS
->
score
,
pS
->
confOrRel
);
#endif
// PRINT
}
// send most likely score to high level agent
sendMostLikelyScoreToMaster
(
&
possibleScores
);
}
}
void
run
()
{
mountedAgent
->
get_sensorValue
(
&
actualSensorValue
);
vector
<
PossibleScore
*>
*
actualPossibleScores
=
scoreConfidenceModule
->
getScoresWithConfidences
(
actualSensorValue
);
inputReliability
=
getInputReliability
(
mountedAgent
,
actualSensorValue
);
masterAgentHandlerOfAgent
->
clearSuggestedScores
();
masterAgentHandlerOfAgent
->
read_masterAgentValues
();
vector
<
PossibleScore
*>
*
suggestedScores
=
masterAgentHandlerOfAgent
->
getSuggestedScores
();
}
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 4:39 AM (12 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
307721
Default Alt Text
bs_file.h (3 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment