Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
T
torcs_dl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
autonomousdriving
torcs_dl
Commits
8695b4d0
Commit
8695b4d0
authored
Dec 06, 2018
by
Svetlana Pavlitskaya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TORCS client without delay
parent
c4ae23eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
20 deletions
+27
-20
EMADL2TORCS/resources/TORCSComponent/src/TORCSComponent/src/torcsclient.cpp
...ces/TORCSComponent/src/TORCSComponent/src/torcsclient.cpp
+27
-20
No files found.
EMADL2TORCS/resources/TORCSComponent/src/TORCSComponent/src/torcsclient.cpp
View file @
8695b4d0
...
...
@@ -171,35 +171,42 @@ void TorcsClient::iterate()
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
bool
firstRun
=
true
;
shared
->
written
=
0
;
shared
->
pause
=
1
;
shared
->
control
=
1
;
bool
firstShot
=
true
;
bool
readyForNewShot
=
true
;
while
(
true
)
{
while
(
shared
->
written
==
0
)
{
if
(
firstRun
)
{
firstRun
=
false
;
shared
->
written
=
0
;
shared
->
pause
=
1
;
using
namespace
std
::
chrono_literals
;
std
::
this_thread
::
sleep_for
(
1ms
);
shared
->
control
=
1
;
}
auto
screenshot
=
std
::
make_shared
<
DataContainer
>
();
memcpy
(
screenshot
->
data
(),
shared
->
data
,
screenshot
->
size
());
shared
->
written
=
0
;
Affordance
affordance
;
affordance
.
populate
(
*
shared
);
// ground truth affordance
publishCallback
(
screenshot
,
affordance
);
if
(
shared
->
control
==
1
)
{
shared
->
pause
=
1
;
while
(
!
gotCommand
)
{
using
namespace
std
::
chrono_literals
;
std
::
this_thread
::
sleep_for
(
5ms
);
if
(
shared
->
written
==
1
)
{
// the new image data is ready to be read
if
(
!
readyForNewShot
)
{
shared
->
written
=
0
;
}
else
{
readyForNewShot
=
false
;
auto
screenshot
=
std
::
make_shared
<
DataContainer
>
();
memcpy
(
screenshot
->
data
(),
shared
->
data
,
screenshot
->
size
());
shared
->
written
=
0
;
Affordance
affordance
;
affordance
.
populate
(
*
shared
);
// ground truth affordance
publishCallback
(
screenshot
,
affordance
);
firstShot
=
false
;
}
}
if
(
gotCommand
)
{
gotCommand
=
false
;
readyForNewShot
=
true
;
//shared->pause = 0;
//shared->control = 1;
shared
->
accelCmd
=
command
.
accelCmd
;
shared
->
steerCmd
=
command
.
steerCmd
;
shared
->
brakeCmd
=
command
.
brakeCmd
;
}
shared
->
pause
=
0
;
}
#pragma clang diagnostic pop
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment