Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Amazon Warehouse] Added warehouses with the Ackermann logistic robot to the database #2421

Open
wants to merge 4 commits into
base: old_manager
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified db.sqlite3
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"application": {
"type": "python",
"entry_point": "$EXERCISE_FOLDER/entry_point/ros2_humble/exercise.py",
"params": { "circuit": "World 2"}
"params": { "circuit": "World2"}
},
"launch": {
"0": {
Expand All @@ -60,7 +60,87 @@
],
"parameters": [],
"launch_file": "$EXERCISE_FOLDER/launch/ros2_humble/pallet_warehouse.launch.py",
"name": "World 2"
"name": "World2"
},
"1": {
"type": "module",
"module": "console_ros2",
"display": ":1",
"internal_port": 5901,
"external_port": 1108
},
"2": {
"type": "module",
"module": "gazebo_view_ros2",
"display": ":0",
"internal_port": 5900,
"external_port": 6080,
"height": 768,
"width": 1024
}
}
},
{
"application": {
"type": "python",
"entry_point": "$EXERCISE_FOLDER/entry_point/ros2_humble/exercise.py",
"params": { "circuit": "World3"}
},
"launch": {
"0": {
"type": "module",
"module": "ros2_api",
"resource_folders": [
"$EXERCISE_FOLDER/launch/ros2_humble"
],
"model_folders": [
"$CUSTOM_ROBOTS_FOLDER/ackermann_logistic_robot/models"
],
"plugin_folders": [
],
"parameters": [],
"launch_file": "$EXERCISE_FOLDER/launch/ros2_humble/small_warehouse_with_ackermann_logistic_robot.launch.py",
"name": "World3"
},
"1": {
"type": "module",
"module": "console_ros2",
"display": ":1",
"internal_port": 5901,
"external_port": 1108
},
"2": {
"type": "module",
"module": "gazebo_view_ros2",
"display": ":0",
"internal_port": 5900,
"external_port": 6080,
"height": 768,
"width": 1024
}
}
},
{
"application": {
"type": "python",
"entry_point": "$EXERCISE_FOLDER/entry_point/ros2_humble/exercise.py",
"params": { "circuit": "World4"}
},
"launch": {
"0": {
"type": "module",
"module": "ros2_api",
"resource_folders": [
"$EXERCISE_FOLDER/launch/ros2_humble"
],
"model_folders": [
"$CUSTOM_ROBOTS_FOLDER/ackermann_logistic_robot/models"
],
"plugin_folders": [
],
"parameters": [],
"launch_file": "$EXERCISE_FOLDER/launch/ros2_humble/pallet_warehouse_with_akcermann_logistic_robot.launch.py",
"name": "World4"
},
"1": {
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class Exercise(CompatibilityExerciseWrapperRos2):
def __init__(self, circuit: str, update_callback: Callable):
current_path = os.path.dirname(__file__)

super(Exercise, self).__init__(exercise_command=f"{current_path}/../../python_template/ros2_humble/exercise.py 0.0.0.0",
super(Exercise, self).__init__(exercise_command=f"{current_path}/../../python_template/ros2_humble/exercise.py 0.0.0.0 {circuit}",
gui_command=f"{current_path}/../../python_template/ros2_humble/gui.py 0.0.0.0 {circuit}",
update_callback=update_callback)
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ def __init__(self):
self.server = None
self.client = None
self.host = sys.argv[1]
self.circuit = sys.argv[2]

# Initialize the GUI, HAL and Console behind the scenes
self.hal = HAL()
self.gui = GUI(self.host, self.hal)
self.gui = GUI(self.host, self.hal, self.circuit)

################ --- BRAIN --- ################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class GUI:
# Initialization function
# The actual initialization
def __init__(self, host, hal):
def __init__(self, host, hal, circuit):
t = threading.Thread(target=self.run_server)

self.payload = {'map': '', 'array': ''}
Expand All @@ -30,11 +30,13 @@ def __init__(self, host, hal):
self.acknowledge = False
self.acknowledge_lock = threading.Lock()

self.circuit = circuit

self.hal = hal
t.start()

# Create the map object
self.map = Map(self.hal.pose3d)
self.map = Map(self.hal.pose3d, self.circuit)

# Explicit initialization function
# Class method, so user can call it without instantiation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import cv2

class Map:
def __init__(self, pose3d):
def __init__(self, pose3d, circuit):
self.pose3d = pose3d
self.circuit = circuit

def RTx(self, angle, tx, ty, tz):
RT = np.matrix([[1, 0, 0, tx], [0, math.cos(angle), -math.sin(angle), ty],
Expand All @@ -32,14 +33,27 @@ def getRobotCoordinates(self):
x = pose.x
y = pose.y

x = (6.8 - x) * 20.22 * 0.545
y = (10.31 - y) * 20.17 * 0.72
if self.circuit == "World2" or self.circuit == "World4": # Warehouse 2
'''
x = (h_gazebo / 2 - x) * (h_image / h_gazebo) * (h_canvas / h_image)
y = (w_gazebo / 2 - y) * (w_image / w_gazebo) * (w_canvas / w_image)
'''
x = (12.0 - x) * 29.13 * 0.22
y = (17.0 - y) * 31.62 * 0.28

else: # Warehouse 1 (small one)
x = (6.8 - x) * 20.22 * 0.545
y = (10.31 - y) * 20.17 * 0.72

return y, x

def getRobotAngle(self):
pose = self.pose3d.getPose3d()
rt = pose.yaw - 1.24

if self.circuit == "World3" or self.circuit == "World4": # Warehouses with Ackermann robot
rt = pose.yaw - 1.74
else: # Warehouses with holonomic robot
rt = pose.yaw - 1.24
ty = math.cos(-rt) - math.sin(-rt)
tx = math.sin(-rt) + math.cos(-rt)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function WorldSelectorAmazonWarehouse(props) {

const handleCircuitChange = (config) => {
context.mapSelected = config.name;
if (config.name == "World 2") {
if (config.name == "World2" || config.name == "World4") {
document.getElementById("amazon_map_canvas").style.backgroundImage = "url('/static/exercises/amazon_warehouse_newmanager/resources/images/map_2.png')";
}
else {
Expand Down
Loading