Skip to content

Commit 4fb8f79

Browse files
committed
added summoning planning code
1 parent 2c488e7 commit 4fb8f79

4 files changed

Lines changed: 139 additions & 2 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
0.0,0,0
2+
1.0,0,0
3+
2.0,0,0
4+
3.0,0,0
5+
4,0,0
6+
5,0,0
7+
6,0,0
8+
7,0,0
9+
8,0,0
10+
9,0,0
11+
10,0,0
12+
11,0,0
13+
12,0,0
14+
13,0,0
15+
14,0,0
16+
15,0,0
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from typing import List
2+
from ..component import Component
3+
from ...utils import serialization
4+
from ...state import Route,ObjectFrameEnum, AllState, PlannerEnum
5+
import os
6+
import numpy as np
7+
8+
class SummonSim(Component):
9+
"""Simulates a summoning team component that receives an AllState object and outputs a route object."""
10+
def __init__(self):
11+
self.counter = 0
12+
13+
def state_inputs(self):
14+
return ["all"]
15+
16+
def state_outputs(self) -> List[str]:
17+
return ["route"]
18+
19+
def rate(self):
20+
return 10.0
21+
22+
def update(self, state: AllState):
23+
print("SummonSim update with state:", state)
24+
base_path = os.path.dirname(__file__)
25+
file_path = os.path.join(base_path, "../../knowledge/routes/forward_15m.csv")
26+
27+
waypoints = np.loadtxt(file_path, delimiter=',', dtype=float)
28+
if waypoints.shape[1] == 3:
29+
waypoints = waypoints[:,:2]
30+
print("waypoints", waypoints)
31+
route = Route(frame=ObjectFrameEnum.START,points=waypoints.tolist())
32+
print("route", route)
33+
return route
34+
35+
36+
37+

GEMstack/state/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
'VehicleIntent','VehicleIntentEnum',
1616
'AgentIntent',
1717
'EntityRelationEnum','EntityRelation','EntityRelationGraph',
18-
'MissionEnum','MissionObjective',
18+
'MissionEnum','MissionObjective', 'MissionPlan',
19+
'PlannerEnum',
1920
'Route',
2021
'PredicateValues',
2122
'AllState']
@@ -32,6 +33,7 @@
3233
from .agent_intent import AgentIntent
3334
from .relations import EntityRelation, EntityRelationEnum, EntityRelationGraph
3435
from .mission import MissionEnum,MissionObjective
35-
from .route import Route
36+
from .route import Route, PlannerEnum
37+
from .mission_plan import MissionPlan
3638
from .predicates import PredicateValues
3739
from .all import AllState
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
description: "Drive the GEM vehicle along a fixed route (currently xyhead_highbay_backlot_p.csv)"
2+
mode: hardware
3+
vehicle_interface: gem_hardware.GEMHardwareInterface
4+
mission_execution: StandardExecutor
5+
# require_engaged: False
6+
# Recovery behavior after a component failure
7+
recovery:
8+
planning:
9+
trajectory_tracking:
10+
type: recovery.StopTrajectoryTracker
11+
print: False
12+
# Driving behavior for the GEM vehicle following a fixed route
13+
drive:
14+
perception:
15+
state_estimation : GNSSStateEstimator
16+
perception_normalization : StandardPerceptionNormalizer
17+
planning:
18+
# route_planning:
19+
# type: StaticRoutePlanner
20+
# args: [!relative_path '../GEMstack/knowledge/routes/forward_15m.csv'] #forward_15m
21+
summon_component:
22+
type: SummonSim
23+
motion_planning: longitudinal_planning.YieldTrajectoryPlanner
24+
# type: RouteToTrajectoryPlanner
25+
# args: [null] #desired speed in m/s. If null, this will keep the route untimed for the trajectory tracker
26+
trajectory_tracking:
27+
type: pure_pursuit.PurePursuitTrajectoryTracker
28+
# args: [null]
29+
# args: {desired_speed: 2.5} #approximately 5mph
30+
print: False
31+
log:
32+
# Specify the top-level folder to save the log files. Default is 'logs'
33+
#folder : 'logs'
34+
# If prefix is specified, then the log folder will be named with the prefix followed by the date and time. Default no prefix
35+
#prefix : 'fixed_route_'
36+
# If suffix is specified, then logs will output to folder/prefix+suffix. Default uses date and time as the suffix
37+
#suffix : 'test3'
38+
# Specify which ros topics to record to vehicle.bag. Default records nothing. This records the "standard" ROS topics.
39+
ros_topics : ['/septentrio_gnss/insnavgeod','/pacmod/parsed_tx/vehicle_speed_rpt']
40+
# Specify options to pass to rosbag record. Default is no options.
41+
#rosbag_options : '--split --size=1024'
42+
# If True, then record all readings / commands of the vehicle interface. Default False
43+
vehicle_interface : True
44+
# Specify which components to record to behavior.json. Default records nothing
45+
components : ['state_estimation','trajectory_tracking']
46+
# Specify which components of state to record to state.json. Default records nothing
47+
#state: ['all']
48+
# Specify the rate in Hz at which to record state to state.json. Default records at the pipeline's rate
49+
#state_rate: 10
50+
replay: # Add items here to set certain topics / inputs to be replayed from logs
51+
# Specify which log folder to replay from
52+
log:
53+
# For replaying sensor data, try !include "../knowledge/defaults/standard_sensor_ros_topics.yaml"
54+
ros_topics : []
55+
components : []
56+
57+
#usually can keep this constant
58+
computation_graph: !include "../GEMstack/knowledge/defaults/computation_graph.yaml"
59+
60+
after:
61+
show_log_folder: True #set to false to avoid showing the log folder
62+
63+
#on load, variants will overload the settingsNone structure
64+
variants:
65+
#sim variant doesn't execute on the real vehicle
66+
#real variant executes on the real robot
67+
sim:
68+
run:
69+
mode: simulation
70+
vehicle_interface:
71+
type: gem_simulator.GEMDoubleIntegratorSimulationInterface
72+
args:
73+
scene: !relative_path '../scenes/xyhead_demo.yaml'
74+
75+
drive:
76+
perception:
77+
state_estimation : OmniscientStateEstimator
78+
agent_detection : OmniscientAgentDetector
79+
visualization: [!include "klampt_visualization.yaml", !include "mpl_visualization.yaml"]
80+
log_ros:
81+
log:
82+
ros_topics : !include "../GEMstack/knowledge/defaults/standard_ros_topics.yaml"

0 commit comments

Comments
 (0)