HI @Shuijing725 !.
I have a single question about observation.
I saw your code in crowd_sim_dict.py.
In this script, generate_ob func was exist.
` def generate_ob(self, reset):
ob = {}
# nodes
visible_humans, num_visibles, human_visibility = self.get_num_human_in_fov()
ob['robot_node'] = self.robot.get_full_state_list_noV()
self.update_last_human_states(human_visibility, reset=reset)
# edges
# temporal edge: robot's velocity
ob['temporal_edges'] = np.array([self.robot.vx, self.robot.vy])
# spatial edges: the vector pointing from the robot position to each human's position
ob['spatial_edges'] = np.zeros((self.human_num, 2))
for i in range(self.human_num):
relative_pos = np.array([self.last_human_states[i, 0] - self.robot.px, self.last_human_states[i, 1] - self.robot.py])
ob['spatial_edges'][i] = relative_pos
return ob`
So, i made observation above code.
` ob={}
ob['robot_node'] = np.array([self.cur_pos_x,self.cur_pos_y,
self.robot_radius,
self.goal_x,self.goal_y,
self.robot_max_vel,
self.robot_yaw])
ob['temporal_edges'] = np.array([self.vel_x,self.vel_y]) ## robot vel x,y
ob['spatial_edges'] = np.zeros((self.human_num, 2))
for i in range(self.human_num):
relative_pos = [self.human_state.mean_points[i].x, self.human_state.mean_points[i].y] ## already relative
ob['spatial_edges'][i] = relative_pos
`
And i referred that test.py and evaluate.py
` self.observation_space= ob
high = 1.2 * np.ones([2, ])
self.action_space = gym.spaces.Box(-high, high, dtype=np.float32)
net = self.Model(self.observation_space, self.action_space)
net.load_state_dict(torch.load(self.weight_path,map_location=torch.device('cpu')))
`
after launched my code error occurred, like under script.
logger.warn( Exception in thread Thread-10: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/opt/ros/noetic/lib/python3/dist-packages/rospy/timer.py", line 237, in run self._callback(TimerEvent(last_expected, last_real, current_expected, current_real, last_duration)) File "drl_agent_node.py", line 147, in cbComputeActionArena _, action, _, eval_recurrent_hidden_states = net.act( File "/home/cai/sim_ws/src/navigation_sim/drl_nav_tool/drl_nav/train/Architectures/ppo_model.py", line 64, in act value, actor_features, rnn_hxs = self.base(inputs, rnn_hxs, masks, infer=True) File "/home/cai/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/cai/sim_ws/src/navigation_sim/drl_nav_tool/drl_nav/train/Architectures/a2c_ppo_acktr/srnn_model.py", line 389, in forward robot_node = reshapeT(inputs['robot_node'], seq_length, nenv) File "/home/cai/sim_ws/src/navigation_sim/drl_nav_tool/drl_nav/train/Architectures/a2c_ppo_acktr/srnn_model.py", line 457, in reshapeT shape = T.size()[1:] AttributeError: 'list' object has no attribute 'size
I don't know how to solve this issue,,
What is problem in this part? . i think nothing was wrong to me...
Could you give me a small hint ?
HI @Shuijing725 !. I have a single question about observation. I saw your code in crowd_sim_dict.py. In this script, generate_ob func was exist. ` def generate_ob(self, reset): ob = {}
So, i made observation above code. ` ob={} ob['robot_node'] = np.array([self.cur_pos_x,self.cur_pos_y, self.robot_radius, self.goal_x,self.goal_y, self.robot_max_vel, self.robot_yaw])
And i referred that test.py and evaluate.py ` self.observation_space= ob high = 1.2 * np.ones([2, ]) self.action_space = gym.spaces.Box(-high, high, dtype=np.float32) net = self.Model(self.observation_space, self.action_space) net.load_state_dict(torch.load(self.weight_path,map_location=torch.device('cpu')))
` after launched my code error occurred, like under script.
logger.warn( Exception in thread Thread-10: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/opt/ros/noetic/lib/python3/dist-packages/rospy/timer.py", line 237, in run self._callback(TimerEvent(last_expected, last_real, current_expected, current_real, last_duration)) File "drl_agent_node.py", line 147, in cbComputeActionArena _, action, _, eval_recurrent_hidden_states = net.act( File "/home/cai/sim_ws/src/navigation_sim/drl_nav_tool/drl_nav/train/Architectures/ppo_model.py", line 64, in act value, actor_features, rnn_hxs = self.base(inputs, rnn_hxs, masks, infer=True) File "/home/cai/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/cai/sim_ws/src/navigation_sim/drl_nav_tool/drl_nav/train/Architectures/a2c_ppo_acktr/srnn_model.py", line 389, in forward robot_node = reshapeT(inputs['robot_node'], seq_length, nenv) File "/home/cai/sim_ws/src/navigation_sim/drl_nav_tool/drl_nav/train/Architectures/a2c_ppo_acktr/srnn_model.py", line 457, in reshapeT shape = T.size()[1:] AttributeError: 'list' object has no attribute 'size
I don't know how to solve this issue,, What is problem in this part? . i think nothing was wrong to me... Could you give me a small hint ?