Skip to content

Fix/transports internal msgs #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions etc/auv/transports.ini
Original file line number Diff line number Diff line change
@@ -131,6 +131,7 @@ Communication Range = 0
Underwater Communications = true
Always Transmitted Messages = Abort,
SimulatedState
Loopback Internal Messages = true

[Transports.Logging]
Enabled = Always
@@ -294,6 +295,7 @@ Transports = Abort,
WaterDensity,
WaterVelocity,
YoYo
Loopback Internal Messages = true

[Transports.TCP.Server/Console]
Enabled = Never
@@ -345,6 +347,7 @@ Transports = EntityParameters,
VehicleMedium,
LogBookEntry,
ManeuverDone
Loopback Internal Messages = true

[Transports.TCP.Server/BackSeat]
Enabled = Always
@@ -384,6 +387,7 @@ Transports = Announce,
VehicleMedium,
VehicleState
Filtered Entities = Temperature:CTD+OEMX+Water Quality Sensor+CTD Simulator
Loopback Internal Messages = true

[Transports.CommManager]
Enabled = Always
2 changes: 2 additions & 0 deletions etc/common/transports.ini
Original file line number Diff line number Diff line change
@@ -65,6 +65,8 @@ Transports = Chlorophyll,
Voltage,
PH,
Redox
Loopback Internal Messages = true

[Transports.Cache]
Enabled = Always
Entity Label = Cache
1 change: 1 addition & 0 deletions etc/lauv-noptilus-2-cpu-cam.ini
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ Transports = EntityState,
LogBookEntry,
LoggingControl,
Temperature
Loopback Internal Messages = true

[Transports.HTTP]
Enabled = Always
1 change: 1 addition & 0 deletions etc/lauv-noptilus-3-cpu-cam.ini
Original file line number Diff line number Diff line change
@@ -37,3 +37,4 @@ Camera IPv4 Address = 10.0.10.106

[Transports.TCP.Client]
Server - Address = 10.0.10.100
Loopback Internal Messages = true
1 change: 1 addition & 0 deletions etc/lauv-seacon-1-aux.ini
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ Transports = Heartbeat,
EntityState,
EntityActivationState,
EntityInfo
Loopback Internal Messages = true

[Transports.FTP]
Enabled = Always
1 change: 1 addition & 0 deletions etc/lauv-seacon-2-aux.ini
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ Transports = DevDataText,
PulseDetectionControl,
SonarData,
Temperature
Loopback Internal Messages = true

[Sensors.DeepVisionOSM2]
Output Data Format = IMC+DVS
1 change: 1 addition & 0 deletions etc/lauv-seacon-2-cpu-cam.ini
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ Transports = EntityState,
LogBookEntry,
LoggingControl,
Temperature
Loopback Internal Messages = true

[Transports.HTTP]
Enabled = Always
1 change: 1 addition & 0 deletions etc/lauv-seacon-3-aux.ini
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ Transports = DevDataText,
PulseDetectionControl,
SonarData,
Temperature
Loopback Internal Messages = true

[Sensors.Klein3500]
Debug Level = None
1 change: 1 addition & 0 deletions etc/lauv-seacon-3-cpu-cam.ini
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ Transports = EntityState,
LogBookEntry,
LoggingControl,
Temperature
Loopback Internal Messages = true

[Transports.HTTP]
Enabled = Always
1 change: 1 addition & 0 deletions etc/lauv-xplore-4-aux.ini
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ Entity Label = TCP to Master
Server - Address = 10.0.10.150
Server - Port = 9999
Transports = RSSI
Loopback Internal Messages = true

[Sensors.WifiRSSI]
Enabled = Hardware
1 change: 1 addition & 0 deletions etc/lauv-xtreme-2-aux.ini
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ Transports = EntityState,
PulseDetectionControl,
SonarData,
Temperature
Loopback Internal Messages = true

[Sensors.Klein3500]
Debug Level = None
1 change: 1 addition & 0 deletions etc/lauv-xtreme-2-cpu-cam.ini
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ Transports = EntityState,
LogBookEntry,
LoggingControl,
Temperature
Loopback Internal Messages = true

[Transports.HTTP]
Enabled = Always
1 change: 1 addition & 0 deletions etc/otter-aux.ini
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ Transports = EntityState,
PowerChannelState,
Temperature,
VehicleState
Loopback Internal Messages = true

[Transports.FTP]
Enabled = Always
6 changes: 3 additions & 3 deletions src/DUNE/Entities/BasicEntity.cpp
Original file line number Diff line number Diff line change
@@ -77,10 +77,10 @@ namespace DUNE
if ((flags & DF_KEEP_TIME) == 0)
msg->setTimeStamp();

if ((flags & DF_LOOP_BACK) == 0)
m_ctx.mbus.dispatch(msg, m_owner);
else
if ((flags & DF_LOOP_BACK) || m_loopback)
m_ctx.mbus.dispatch(msg);
else
m_ctx.mbus.dispatch(msg, m_owner);
}

}
11 changes: 10 additions & 1 deletion src/DUNE/Entities/BasicEntity.hpp
Original file line number Diff line number Diff line change
@@ -68,13 +68,20 @@ namespace DUNE
BasicEntity(Tasks::AbstractTask* owner, Tasks::Context& context):
m_owner(owner),
m_ctx(context),
m_id(DUNE_IMC_CONST_UNK_EID)
m_id(DUNE_IMC_CONST_UNK_EID),
m_loopback(false)
{ }

//! Destructor.
virtual ~BasicEntity()
{ }

void
setLoopback(bool loopback)
{
m_loopback = loopback;
}

//! Set the IMC bindings using the provided recipient object.
//! @param[in] recipient pointer to the recipient object to use for binding to IMC messages.
virtual void
@@ -192,6 +199,8 @@ namespace DUNE
unsigned int m_id;
//! Entity Label.
std::string m_label;
//! Set loopback flag for EntityState report
bool m_loopback;
};
}
}
9 changes: 6 additions & 3 deletions src/DUNE/Tasks/SimpleTransport.cpp
Original file line number Diff line number Diff line change
@@ -66,6 +66,9 @@ namespace DUNE
void
SimpleTransport::consume(const IMC::Message* msg)
{
if (msg->getSource() != getSystemId())
return;

if (m_rl.filter(msg))
return;

@@ -86,7 +89,7 @@ namespace DUNE
}

if (m_gargs.trace_out)
inf(DTR("outgoing: %s"), msg->getName());
DUNE_MSG(getName(), "outgoing: " + std::string(msg->getName()));

onDataTransmission(p, n);
}
@@ -118,8 +121,8 @@ namespace DUNE
dispatch(m, DF_KEEP_TIME | DF_KEEP_SRC_EID);

if (m_gargs.trace_in)
inf(DTR("incoming: %s"), m->getName());

DUNE_MSG(getName(), "incoming: " + std::string(m->getName()));
delete m;
}
}
14 changes: 11 additions & 3 deletions src/DUNE/Tasks/Task.cpp
Original file line number Diff line number Diff line change
@@ -88,6 +88,11 @@ namespace DUNE
.defaultValue("None")
.values("None, Debug, Trace, Spew");

param(DTR_RT("Loopback Internal Messages"), m_args.loopback)
.defaultValue("false")
.description("Loopback internal messages, such as EntityState"
" and EntityParameters");

m_recipient = new Recipient(this, ctx);
m_entity = new Entities::StatefulEntity(this, m_ctx);
m_entities.push_back(m_entity);
@@ -228,6 +233,7 @@ namespace DUNE
if (m_args.elabel != m_entity->getLabel())
m_params.set(DTR_RT("Entity Label"), m_entity->getLabel());
m_entity->setActTimes(m_args.act_time, m_args.deact_time);
m_entity->setLoopback(m_args.loopback);
m_entity->reportInfo();

if (m_debug_level_string == "Debug")
@@ -446,10 +452,12 @@ namespace DUNE
msg->setSourceEntity(getEntityId());
}

if ((flags & DF_LOOP_BACK) == 0)
m_ctx.mbus.dispatch(msg, this);
else
if ((flags & DF_LOOP_BACK) ||
m_args.loopback ||
msg->getSource() != getSystemId())
m_ctx.mbus.dispatch(msg);
else
m_ctx.mbus.dispatch(msg, this);
}

void
2 changes: 2 additions & 0 deletions src/DUNE/Tasks/Task.hpp
Original file line number Diff line number Diff line change
@@ -785,6 +785,8 @@ namespace DUNE
std::string active_scope;
//! Visibility of 'Active' parameter.
std::string active_visibility;
//! Loopback internal messages
bool loopback;
};

//! Message recipient (queue).
10 changes: 8 additions & 2 deletions src/Transports/UDP/Listener.hpp
Original file line number Diff line number Diff line change
@@ -57,7 +57,13 @@ namespace Transports
m_trace(trace),
m_contacts(contact_timeout),
m_lcomms(lcomms)
{ }
{ }

void
setTrace(bool trace)
{
m_trace = trace;
}

void
getContacts(std::vector<Contact>& list)
@@ -133,7 +139,7 @@ namespace Transports
m_task.dispatch(msg, DF_KEEP_TIME | DF_KEEP_SRC_EID);

if (m_trace)
msg->toText(std::cerr);
DUNE_MSG(m_task.getName(), "incoming: " + std::string(msg->getName()));

delete msg;
}
8 changes: 7 additions & 1 deletion src/Transports/UDP/Task.cpp
Original file line number Diff line number Diff line change
@@ -229,6 +229,9 @@ namespace Transports
debug("limited communications simulation is not active");
m_comm_limitations = false;
}

if (m_listener != NULL)
m_listener->setTrace(m_args.trace_in);
}

void
@@ -321,6 +324,9 @@ namespace Transports
void
consume(const IMC::Message* msg)
{
if (msg->getSource() != getSystemId())
return;

if (m_lcomms->isActive())
{
if (msg->getId() == DUNE_IMC_ESTIMATEDSTATE)
@@ -337,7 +343,7 @@ namespace Transports
return;

if (m_args.trace_out)
msg->toText(std::cerr);
DUNE_MSG(getName(), "outgoing: " + std::string(msg->getName()));

uint16_t rv;
try