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
e08d3742
Commit
e08d3742
authored
Mar 09, 2021
by
김하경
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#1]Success/go back when collide
parents
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
test.py
test.py
+40
-0
No files found.
test.py
0 → 100644
View file @
e08d3742
#!/usr/bin/env python
# license removed for brevity
import
rospy
from
std_msgs.msg
import
String
from
carla_msgs.msg
import
CarlaEgoVehicleControl
from
carla_msgs.msg
import
CarlaCollisionEvent
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
()
while
not
rospy
.
is_shutdown
():
pub_msg
.
throttle
=
1.0
pub_msg
.
steer
=
0.0
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
pub_msg
=
CarlaEgoVehicleControl
()
while
not
rospy
.
is_shutdown
():
pub_msg
.
reverse
=
1
pub_msg
.
throttle
=
2.0
pub_msg
.
steer
=
0.6
pub
.
publish
(
pub_msg
)
rate
.
sleep
()
sub
=
rospy
.
Subscriber
(
'/carla/ego_vehicle/collision'
,
CarlaCollisionEvent
,
back
)
if
__name__
==
'__main__'
:
try
:
talker
()
except
rospy
.
ROSInterruptException
:
pass
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