Commit eed3751f authored by Helge's avatar Helge

Added some functionality in case of a collision or lane invasion to the BumpBot Component

parent 4df25754
Pipeline #147944 failed with stage
in 35 seconds
......@@ -3,5 +3,7 @@ conforms to de.monticore.lang.monticar.generator.roscpp.RosToEmamTagSchema;
tags Bumb{
tag bumpBot.test with RosConnection = {topic = (/carla/ego_vehicle/vehicle_control_cmd, carla_msgs/CarlaEgoVehicleControl)};
tag bumpBot.lane_invasion with RosConnection = {topic = (/carla/ego_vehicle/lane_invasion, carla_msgs/CarlaLaneInvasionEvent), msgField = msg.crossed_lane_markings(1)};
tag bumpBot.collision_actor_id with RosConnection = {topic = (/carla/ego_vehicle/collision, carla_msgs/CarlaCollisionEvent), msgField = msg.other_actor_id};
}
......@@ -3,15 +3,32 @@ import test.structures.*;
component BumpBot{
port out Ego_Vehicle test;
port out Ego_Vehicle test,
in Z lane_invasion,
in Z collision_actor_id;
implementation Math{
test.throttle = 1.0;
test.steer = 0.0;
test.brake = 0.0;
test.hand_brake = false;
test.reverse = false;
test.gear = 1;
test.manual_gear_shift = false;
if lane_invasion > 0 //if a lane was crossed change the steering direction
if test.steer == 0.0
test.steer = 0.3;
else
test.steer = (-1) * test.steer;
end
end
if collision_actor_id > 0 //if a collision occurred drive into the other direction
if test.reverse == false
test.reverse = true;
else
test.reverse = false;
end
end
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment