Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lrs_pyutil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
lrs
lrs_pyutil
Commits
de88cc46
Commit
de88cc46
authored
4 years ago
by
Tommy Persson
Browse files
Options
Downloads
Patches
Plain Diff
Python 3 fixes.
parent
8b3acd76
Branches
olamo208-main-patch-25776
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/quad/qsim.py
+34
-35
34 additions, 35 deletions
src/quad/qsim.py
with
34 additions
and
35 deletions
src/quad/qsim.py
+
34
−
35
View file @
de88cc46
...
@@ -24,35 +24,34 @@ class QSim:
...
@@ -24,35 +24,34 @@ class QSim:
def
set_ref_data
(
self
,
x
,
y
,
z
,
xyspeed
,
zspeed
):
def
set_ref_data
(
self
,
x
,
y
,
z
,
xyspeed
,
zspeed
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
set_ref_data: {0} {1} {2} {3} {4} {5}
"
.
format
(
ns
,
x
,
y
,
z
,
print
(
"
set_ref_data: {0} {1} {2} {3} {4} {5}
"
.
format
(
ns
,
x
,
y
,
z
,
xyspeed
,
zspeed
))
xyspeed
,
zspeed
)
try
:
try
:
set_rd
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_ref_data
"
,
LQSetRefData
)
set_rd
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_ref_data
"
,
LQSetRefData
)
rd
=
RefData
(
x
,
y
,
z
,
xyspeed
,
zspeed
,
0
,
1
)
rd
=
RefData
(
x
,
y
,
z
,
xyspeed
,
zspeed
,
0
,
1
)
resp
=
set_rd
(
rd
)
resp
=
set_rd
(
rd
)
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
get_ref_data
(
self
):
def
get_ref_data
(
self
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
get_ref_data: {0}
"
.
format
(
ns
)
print
(
"
get_ref_data: {0}
"
.
format
(
ns
)
)
try
:
try
:
get_rd
=
rospy
.
ServiceProxy
(
ns
+
"
sim/get_ref_data
"
,
LQGetRefData
)
get_rd
=
rospy
.
ServiceProxy
(
ns
+
"
sim/get_ref_data
"
,
LQGetRefData
)
resp
=
get_rd
()
resp
=
get_rd
()
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
new_simulator
(
unit
):
def
new_simulator
(
unit
):
print
"
get_ext_data: {0}
"
.
format
(
unit
)
print
(
"
get_ext_data: {0}
"
.
format
(
unit
)
)
try
:
try
:
ns
=
rospy
.
ServiceProxy
(
"
uav/{0}/sim/new_simulator
"
.
format
(
unit
),
LQNewSimulator
)
ns
=
rospy
.
ServiceProxy
(
"
uav/{0}/sim/new_simulator
"
.
format
(
unit
),
LQNewSimulator
)
resp
=
ns
()
resp
=
ns
()
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
...
@@ -60,97 +59,97 @@ class QSim:
...
@@ -60,97 +59,97 @@ class QSim:
def
set_sticks
(
self
,
throttle
,
aileron
,
elevator
,
rudder
,
flight_mode
,
pan
,
tilt
):
def
set_sticks
(
self
,
throttle
,
aileron
,
elevator
,
rudder
,
flight_mode
,
pan
,
tilt
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
set_sticks: {0} {1} {2} {3} {4} {5} {6}
"
.
format
(
ns
,
throttle
,
aileron
,
print
(
"
set_sticks: {0} {1} {2} {3} {4} {5} {6}
"
.
format
(
ns
,
throttle
,
aileron
,
elevator
,
rudder
,
elevator
,
rudder
,
flight_mode
,
pan
,
tilt
)
flight_mode
,
pan
,
tilt
)
)
resp
=
LQSetSticksResponse
()
resp
=
LQSetSticksResponse
()
try
:
try
:
set_st
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_sticks
"
,
LQSetSticks
)
set_st
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_sticks
"
,
LQSetSticks
)
resp
=
set_st
(
throttle
,
aileron
,
elevator
,
rudder
,
flight_mode
,
pan
,
tilt
)
resp
=
set_st
(
throttle
,
aileron
,
elevator
,
rudder
,
flight_mode
,
pan
,
tilt
)
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
resp
.
res
=
128
resp
.
res
=
128
return
resp
return
resp
def
set_use_sticks
(
self
,
flag
):
def
set_use_sticks
(
self
,
flag
):
print
"
set_use_sticks: {0}
"
.
format
(
flag
)
print
(
"
set_use_sticks: {0}
"
.
format
(
flag
)
)
ns
=
self
.
ns
ns
=
self
.
ns
resp
=
LQSetUseSticksResponse
()
resp
=
LQSetUseSticksResponse
()
try
:
try
:
set_use_sticks
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_use_sticks
"
,
LQSetUseSticks
)
set_use_sticks
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_use_sticks
"
,
LQSetUseSticks
)
resp
=
set_use_sticks
(
flag
)
resp
=
set_use_sticks
(
flag
)
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
resp
.
res
=
128
resp
.
res
=
128
return
resp
return
resp
def
set_motor
(
self
,
flag
):
def
set_motor
(
self
,
flag
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
set_motor: {0}
"
.
format
(
flag
)
print
(
"
set_motor: {0}
"
.
format
(
flag
)
)
try
:
try
:
set_motor
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_motor
"
,
LQSetMotor
)
set_motor
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_motor
"
,
LQSetMotor
)
resp
=
set_motor
(
flag
)
resp
=
set_motor
(
flag
)
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
set_loop_rate
(
self
,
rate
):
def
set_loop_rate
(
self
,
rate
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
set_loop_rate: {0}
"
.
format
(
rate
)
print
(
"
set_loop_rate: {0}
"
.
format
(
rate
)
)
try
:
try
:
client
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_loop_rate
"
,
LQSetLoopRate
)
client
=
rospy
.
ServiceProxy
(
ns
+
"
sim/set_loop_rate
"
,
LQSetLoopRate
)
resp
=
client
(
rate
)
resp
=
client
(
rate
)
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
get_queue_statistics
(
self
):
def
get_queue_statistics
(
self
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
get_queue_statistics
"
print
(
"
get_queue_statistics
"
)
try
:
try
:
client
=
rospy
.
ServiceProxy
(
ns
+
"
sim/get_queue_statistics
"
,
LQGetQueueStatistics
)
client
=
rospy
.
ServiceProxy
(
ns
+
"
sim/get_queue_statistics
"
,
LQGetQueueStatistics
)
resp
=
client
()
resp
=
client
()
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
get_queue_commands
(
self
):
def
get_queue_commands
(
self
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
get_queue_commands
"
print
(
"
get_queue_commands
"
)
try
:
try
:
client
=
rospy
.
ServiceProxy
(
ns
+
"
sim/get_queue_commands
"
,
LQGetQueueCommands
)
client
=
rospy
.
ServiceProxy
(
ns
+
"
sim/get_queue_commands
"
,
LQGetQueueCommands
)
resp
=
client
()
resp
=
client
()
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
start_logging
(
self
,
csvfilename
):
def
start_logging
(
self
,
csvfilename
):
print
"
start_logging
"
print
(
"
start_logging
"
)
ns
=
self
.
ns
ns
=
self
.
ns
try
:
try
:
start_logging
=
rospy
.
ServiceProxy
(
ns
+
"
sim/start_logging
"
,
LQStartLogging
)
start_logging
=
rospy
.
ServiceProxy
(
ns
+
"
sim/start_logging
"
,
LQStartLogging
)
resp
=
start_logging
(
csvfilename
)
resp
=
start_logging
(
csvfilename
)
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
def
stop_logging
(
self
):
def
stop_logging
(
self
):
ns
=
self
.
ns
ns
=
self
.
ns
print
"
stop_logging
"
print
(
"
stop_logging
"
)
try
:
try
:
stop_logging
=
rospy
.
ServiceProxy
(
ns
+
"
sim/stop_logging
"
,
LQStopLogging
)
stop_logging
=
rospy
.
ServiceProxy
(
ns
+
"
sim/stop_logging
"
,
LQStopLogging
)
resp
=
stop_logging
()
resp
=
stop_logging
()
except
rospy
.
ServiceException
,
e
:
except
rospy
.
ServiceException
as
e
:
print
"
Service call failed: %s
"
%
e
print
(
"
Service call failed: %s
"
%
e
)
exit
(
1
)
exit
(
1
)
return
resp
return
resp
...
...
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