Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Caral_forfar
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
김하경
Caral_forfar
Commits
2fd472a5
Commit
2fd472a5
authored
Mar 10, 2021
by
김하경
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#1]Success/후진 후 직진(방향 좌우 자연스럽게는 안됨)
parent
e08d3742
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
24 deletions
+34
-24
test.py
test.py
+34
-24
No files found.
test.py
View file @
2fd472a5
...
...
@@ -6,33 +6,43 @@ from std_msgs.msg import String
from
carla_msgs.msg
import
CarlaEgoVehicleControl
from
carla_msgs.msg
import
CarlaCollisionEvent
pub
=
rospy
.
Publisher
(
'/carla/ego_vehicle/vehicle_control_cmd'
,
CarlaEgoVehicleControl
,
queue_size
=
10
)
rospy
.
init_node
(
'xytron'
,
anonymous
=
True
)
pub_msg
=
CarlaEgoVehicleControl
()
def
talker
():
pub
=
rospy
.
Publisher
(
'/carla/ego_vehicle/vehicle_control_cmd'
,
CarlaEgoVehicleControl
,
queue_size
=
1
)
rospy
.
init_node
(
'xytron'
,
anonymous
=
True
)
rate
=
rospy
.
Rate
(
10
)
# 10hz
pub_msg
=
CarlaEgoVehicleControl
()
rate
=
rospy
.
Rate
(
1
)
sub
=
rospy
.
Subscriber
(
'/carla/ego_vehicle/collision'
,
CarlaCollisionEvent
,
verify
,
queue_size
=
10
)
while
not
rospy
.
is_shutdown
():
ride
()
rate
.
sleep
()
def
ride
():
print
(
"riding"
)
pub_msg
.
throttle
=
1.0
pub_msg
.
steer
=
0.0
pub_msg
.
gear
=
1
pub
.
publish
(
pub_msg
)
rate
.
sleep
()
def
back
(
msg
):
pub
=
rospy
.
Publisher
(
'/carla/ego_vehicle/vehicle_control_cmd'
,
CarlaEgoVehicleControl
,
queue_size
=
1
)
rospy
.
init_node
(
'xytron'
,
anonymous
=
True
)
rate
=
rospy
.
Rate
(
10
)
# 10hz
def
verify
(
msg
):
print
(
"collide"
)
back
()
def
back
():
rate
=
rospy
.
Rate
(
10
)
pub_msg
=
CarlaEgoVehicleControl
()
while
not
rospy
.
is_shutdown
():
pub_msg
.
reverse
=
1
pub_msg
.
throttle
=
2.0
pub_msg
.
steer
=
0.6
print
(
"execute go back"
)
#pub_msg.brake = 1.0
pub_msg
.
reverse
=
True
pub_msg
.
throttle
=
1.0
pub_msg
.
steer
=-
0.6
pub_msg
.
gear
=
-
1
pub
.
publish
(
pub_msg
)
rate
.
sleep
()
sub
=
rospy
.
Subscriber
(
'/carla/ego_vehicle/collision'
,
CarlaCollisionEvent
,
back
)
if
__name__
==
'__main__'
:
try
:
talker
()
...
...
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