Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autonomy-payload
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SASC
autonomy-payload
Commits
e8dd9805
Commit
e8dd9805
authored
8 years ago
by
Davis, Duane T
Committed by
Davis, Duane T
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
LIB: ***DO NOT MERGE INTO MASTER*** Simulated lossy comms added to acs_socket
parent
cac94e15
No related branches found
No related tags found
No related merge requests found
Pipeline
#1048
failed
6 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ap_lib/src/ap_lib/acs_socket.py
+7
-1
7 additions, 1 deletion
ap_lib/src/ap_lib/acs_socket.py
with
7 additions
and
1 deletion
ap_lib/src/ap_lib/acs_socket.py
+
7
−
1
View file @
e8dd9805
...
...
@@ -140,7 +140,8 @@ class Socket():
# Mapping IDs to IPs: mapped_ids[id] = ip_address
def
__init__
(
self
,
my_id
,
udp_port
,
device
=
None
,
my_ip
=
None
,
bcast_ip
=
None
,
mapped_ids
=
None
,
send_only
=
False
,
promisc
=
False
,
bcast_bind
=
False
):
send_only
=
False
,
promisc
=
False
,
bcast_bind
=
False
,
sim_loss_rt
=
0.5
):
# Instance variables
self
.
_port
=
udp_port
# UDP port for send/recv
self
.
_id
=
my_id
# Local entity ID (0..255 currently)
...
...
@@ -151,6 +152,7 @@ class Socket():
self
.
_sock
=
None
# UDP socket
self
.
_sendonly
=
send_only
# Don't bind a port
self
.
_promisc
=
promisc
# Receive packets not for me
self
.
_sim_loss_rt
=
sim_loss_rt
# Simulated comms receipt loss rate
# Reliability variables
self
.
_rel_resend
=
ReliableResend
(
self
)
...
...
@@ -322,6 +324,10 @@ class Socket():
# If anything goes wrong below, return False so caller knows
# there may be more packets to receive
try
:
# Simulate dropping packets due to lossy comms
if
random
.
random
()
<=
self
.
_sim_loss_rt
:
return
False
# Parse message
msg
=
messages
.
Message
.
parse
(
data
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment