Skip to content

Commit

Permalink
Merge branch 'main' into 490-feature-remodel-acc-concept
Browse files Browse the repository at this point in the history
  • Loading branch information
vinzenzm authored Dec 1, 2024
2 parents 9328459 + 0a8c40e commit 383c0e7
Show file tree
Hide file tree
Showing 52 changed files with 1,086 additions and 283 deletions.
28 changes: 15 additions & 13 deletions .github/ISSUE_TEMPLATE/BUG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ body:
- The car detects traffic lights on Map1 correctly.
- The issue no longer occurs in similar scenarios.
- type: input
id: effort_estimate
attributes:
label: Effort Estimate
description: Approximate effort required (e.g., hours).
placeholder: Enter effort estimate.

- type: textarea
id: testability
attributes:
Expand All @@ -59,16 +52,25 @@ body:
- type: markdown
attributes:
value: |
**Add Priority Label**:
- p1: Immediate attention
- p2: High priority
- p3: Standard priority
- p4: Low priority
**Add Group Label**:
- perception: Related to sensor processing and scene understanding
- planning: Related to path planning and decision making
- acting: Related to vehicle control and actuation
- system: Related to the general behavior of the system
- research: Related to research and experimentation
- infrastructure: Related to system infrastructure and setup
**Add Labels on the Project Board**:
**Priority:**
- `Urgent`: Critical bug causing system crash, needs immediate fix.
- `High`: Major feature request or significant bug affecting many users.
- `Medium`: Minor feature request or bug with a workaround.
- `Low`: Cosmetic changes or minor improvements.
**Size:**
- `Tiny`: Small typo fix or minor code refactor. Estimated time: 30 minutes.
- `Small`: Simple bug fix or small feature addition. Estimated time: 1-2 hours.
- `Medium`: Moderate feature addition or multiple bug fixes. Estimated time: 1-2 days.
- `Large`: Major feature implementation or significant refactor. Estimated time: 1-2 weeks.
- `X-Large`: Large-scale feature or complete module overhaul. Estimated time: 2-4 weeks. Especially `EPIC` issues should
be tagged with this size.
27 changes: 15 additions & 12 deletions .github/ISSUE_TEMPLATE/FEATURE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ body:
- Detects 90% of traffic lights.
- Correctly identifies 90% of traffic light states.
- type: input
id: effort_estimate
attributes:
label: Effort Estimate
description: Approximate effort required (e.g., hours).
placeholder: Enter effort estimate.

- type: textarea
id: testability
attributes:
Expand All @@ -43,11 +36,6 @@ body:
- type: markdown
attributes:
value: |
**Add Priority Label**:
- p1: Immediate attention
- p2: High priority
- p3: Standard priority
- p4: Low priority
**Add Group Label**:
- perception: Related to sensor processing and scene understanding
Expand All @@ -56,3 +44,18 @@ body:
- system: Related to the general behavior of the system
- research: Related to research and experimentation
- infrastructure: Related to system infrastructure and setup
**Add Labels on the Project Board**:
**Priority:**
- `Urgent`: Critical bug causing system crash, needs immediate fix.
- `High`: Major feature request or significant bug affecting many users.
- `Medium`: Minor feature request or bug with a workaround.
- `Low`: Cosmetic changes or minor improvements.
**Size:**
- `Tiny`: Small typo fix or minor code refactor. Estimated time: 30 minutes.
- `Small`: Simple bug fix or small feature addition. Estimated time: 1-2 hours.
- `Medium`: Moderate feature addition or multiple bug fixes. Estimated time: 1-2 days.
- `Large`: Major feature implementation or significant refactor. Estimated time: 1-2 weeks.
- `X-Large`: Large-scale feature or complete module overhaul. Estimated time: 2-4 weeks. Especially `EPIC` issues should
be tagged with this size.
28 changes: 15 additions & 13 deletions .github/ISSUE_TEMPLATE/ISSUE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ body:
- Code review passed
- All tests passing
- type: input
id: effort_estimate
attributes:
label: Effort Estimate
description: Approximate effort required (e.g., hours).
placeholder: Enter effort estimate.

- type: textarea
id: testability
attributes:
Expand All @@ -58,16 +51,25 @@ body:
- question: Further information is requested
- wontfix: This will not be worked on
**Add Priority Label**:
- p1: Immediate attention
- p2: High priority
- p3: Standard priority
- p4: Low priority
**Add Group Label**:
- perception: Related to sensor processing and scene understanding
- planning: Related to path planning and decision making
- acting: Related to vehicle control and actuation
- system: Related to the general behavior of the system
- research: Related to research and experimentation
- infrastructure: Related to system infrastructure and setup
**Add Labels on the Project Board**:
**Priority:**
- `Urgent`: Critical bug causing system crash, needs immediate fix.
- `High`: Major feature request or significant bug affecting many users.
- `Medium`: Minor feature request or bug with a workaround.
- `Low`: Cosmetic changes or minor improvements.
**Size:**
- `Tiny`: Small typo fix or minor code refactor. Estimated time: 30 minutes.
- `Small`: Simple bug fix or small feature addition. Estimated time: 1-2 hours.
- `Medium`: Moderate feature addition or multiple bug fixes. Estimated time: 1-2 days.
- `Large`: Major feature implementation or significant refactor. Estimated time: 1-2 weeks.
- `X-Large`: Large-scale feature or complete module overhaul. Estimated time: 2-4 weeks. Especially `EPIC` issues should
be tagged with this size.
38 changes: 9 additions & 29 deletions code/acting/launch/acting.launch
Original file line number Diff line number Diff line change
@@ -1,41 +1,21 @@
<!---->
<launch>
<arg name="role_name" default="hero" />
<arg name="control_loop_rate" default="0.05" />
<arg name="control_loop_rate" default="0.05" />

<node pkg="acting" type="velocity_controller.py" name="velocity_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="acting" type="stanley_controller.py" name="stanley_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<!--Passthrough
all messages the control package needs-->
<node pkg="acting" type="passthrough.py" name="passthrough" output="screen">
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="acting" type="pure_pursuit_controller.py" name="pure_pursuit_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="acting" type="vehicle_controller.py" name="vehicle_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" /> <!-- leaderboard expects commands every 0.05 seconds OTHERWISE IT LAGS REALLY BADLY-->
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="acting" type="MainFramePublisher.py" name="MainFramePublisher" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>

<!-- UNCOMMENT THIS TO USE THE DEBUG_NODE FOR ACTING-TESTING -->
<!-- <node pkg="acting" type="Acting_Debug_Node.py" name="Acting_Debug_Node" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>
-->

<!-- If you want a live rqt_plots to show up automatically, include them like following example-plot for Velocity-Controller-Testing -->
<!--node pkg="rqt_plot" type="rqt_plot" output="screen" name="velocity_test" args="/carla/hero/Speed /paf/hero/target_velocity /paf/hero/throttle /paf/hero/brake"/-->

</launch>
<include file="$(find control)/launch/control.launch">
<arg name="control_loop_rate" value="$(arg control_loop_rate)" />
</include>
</launch>
41 changes: 21 additions & 20 deletions code/acting/src/acting/MainFramePublisher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python

from math import pi, cos, sin
import ros_compatibility as roscomp
import rospy
from geometry_msgs.msg import PoseStamped
Expand All @@ -9,6 +7,8 @@
from scipy.spatial.transform import Rotation as R
from std_msgs.msg import Float32

import numpy as np


class MainFramePublisher(CompatibleNode):

Expand Down Expand Up @@ -49,27 +49,28 @@ def loop(timer_event=None):
if self.current_pos is None:
# conversion only works if pos is known
return
rot = -self.current_heading
pos = [0, 0, 0]
pos[0] = (
cos(rot) * self.current_pos.pose.position.x
- sin(rot) * self.current_pos.pose.position.y
)
pos[1] = (
sin(rot) * self.current_pos.pose.position.x
+ cos(rot) * self.current_pos.pose.position.y

# The following converts the current_pos as well as the current_heading
# messages we receive into tf transforms.

position = np.array(
[
self.current_pos.pose.position.x,
self.current_pos.pose.position.y,
self.current_pos.pose.position.z,
]
)
pos[2] = -self.current_pos.pose.position.z
rot_quat = R.from_euler(
"xyz", [0, 0, -self.current_heading + pi], degrees=False
).as_quat()

rotation = R.from_euler("z", self.current_heading, degrees=False).as_quat()

# The position and rotation are "the hero frame in global coordinates"
# Therefore we publish the child hero with respect to the parent global
br.sendTransform(
pos,
rot_quat,
rospy.Time.now(),
"global",
"hero",
translation=position,
rotation=rotation,
time=rospy.Time.now(),
child="hero",
parent="global",
)

self.new_timer(self.control_loop_rate, loop)
Expand Down
87 changes: 87 additions & 0 deletions code/acting/src/acting/passthrough.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env python

import ros_compatibility as roscomp
from ros_compatibility.node import CompatibleNode
from rospy import Publisher, Subscriber
from std_msgs.msg import Float32
from geometry_msgs.msg import PoseStamped
from nav_msgs.msg import Path


from dataclasses import dataclass
from typing import Type, Dict


@dataclass
class TopicMapping:
pub_name: str
sub_name: str
topic_type: Type


class Passthrough(CompatibleNode):
"""This nodes sole purpose is to pass through all messages that control needs.
The purpose of this is that Control-Package should not have any global dependencies,
but is only dependent on the acting package.
"""

role_name = "hero" # Legacy will change soon

# Topics for velocity controller.
target_velocity = TopicMapping(
pub_name="/paf/acting/target_velocity",
sub_name=f"/paf/{role_name}/target_velocity",
topic_type=Float32,
)
# Topics for steering controllers
trajectory = TopicMapping(
pub_name="/paf/acting/trajectory",
sub_name=f"/paf/{role_name}/trajectory",
topic_type=Path,
)
position = TopicMapping(
pub_name="/paf/acting/current_pos",
sub_name=f"/paf/{role_name}/current_pos",
topic_type=PoseStamped,
)
heading = TopicMapping(
pub_name="/paf/acting/current_heading",
sub_name=f"/paf/{role_name}/current_heading",
topic_type=Float32,
)

mapped_topics = [target_velocity, trajectory, position, heading]

def __init__(self):
self.publishers: Dict[str, Publisher] = {}
self.subscribers: Dict[str, Subscriber] = {}
for topic in self.mapped_topics:
self.publishers[topic.pub_name] = self.new_publisher(
topic.topic_type, topic.pub_name, qos_profile=1
)

self.subscribers[topic.pub_name] = self.new_subscription(
topic.topic_type,
topic.sub_name,
callback=self.publishers[topic.pub_name].publish,
qos_profile=1,
)


def main(args=None):
"""Start the node.
This is the entry point, if called by a launch file.
"""
roscomp.init("passthrough", args=args)

try:
node = Passthrough()
node.spin()
except KeyboardInterrupt:
pass
finally:
roscomp.shutdown()


if __name__ == "__main__":
main()
18 changes: 18 additions & 0 deletions code/control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.0.2)
project(control)


find_package(catkin REQUIRED)

catkin_python_setup()

find_package(catkin REQUIRED COMPONENTS
rospy
std_msgs
)
catkin_package()


include_directories(
)

28 changes: 28 additions & 0 deletions code/control/launch/control.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<launch>
<arg name="role_name" default="hero" />
<arg name="control_loop_rate" default="0.05" />


<node pkg="control" type="velocity_controller.py" name="velocity_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="control" type="stanley_controller.py" name="stanley_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="control" type="pure_pursuit_controller.py" name="pure_pursuit_controller"
output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" />
<param name="role_name" value="$(arg role_name)" />
</node>

<node pkg="control" type="vehicle_controller.py" name="vehicle_controller" output="screen">
<param name="control_loop_rate" value="$(arg control_loop_rate)" /> <!-- leaderboard expects
commands every 0.05 seconds OTHERWISE IT LAGS REALLY BADLY-->
<param name="role_name" value="$(arg role_name)" />
</node>

</launch>
Loading

0 comments on commit 383c0e7

Please sign in to comment.