Skip to content

Commit 39717a4

Browse files
publish kinematics data on physics engine node (#486)
* implemented publishing of real data * implemented publishing of real data * finished implementation, had to set wind and current velocities to 0.0 since they are not calculated * changed how I access numpy arrays * removed comment on physics_engine_node.py
1 parent e875b67 commit 39717a4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/boat_simulator/boat_simulator/nodes/physics_engine/physics_engine_node.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -387,20 +387,20 @@ def __publish_kinematics(self):
387387
msg.global_gps.speed.speed = 0.0
388388
msg.global_gps.heading.heading = 0.0
389389

390-
msg.global_pose.position.x = 0.0
391-
msg.global_pose.position.y = 0.0
392-
msg.global_pose.position.z = 0.0
393-
msg.global_pose.orientation.x = 0.0
394-
msg.global_pose.orientation.y = 0.0
395-
msg.global_pose.orientation.z = 0.0
390+
msg.global_pose.position.x = self.__boat_state.global_position.item(0)
391+
msg.global_pose.position.y = self.__boat_state.global_position.item(1)
392+
msg.global_pose.position.z = self.__boat_state.global_position.item(2)
393+
msg.global_pose.orientation.x = self.__boat_state.angular_position.item(0)
394+
msg.global_pose.orientation.y = self.__boat_state.angular_position.item(1)
395+
msg.global_pose.orientation.z = self.__boat_state.angular_position.item(2)
396396
msg.global_pose.orientation.w = 1.0
397397

398-
msg.wind_velocity.x = 0.0
399-
msg.wind_velocity.y = 0.0
398+
msg.wind_velocity.x = self.__wind_generator.velocity[0]
399+
msg.wind_velocity.y = self.__wind_generator.velocity[1]
400400
msg.wind_velocity.z = 0.0
401401

402-
msg.current_velocity.x = 0.0
403-
msg.current_velocity.y = 0.0
402+
msg.current_velocity.x = self.__current_generator.velocity[0]
403+
msg.current_velocity.y = self.__current_generator.velocity[1]
404404
msg.current_velocity.z = 0.0
405405

406406
sec, nanosec = divmod(self.pub_period * self.publish_counter, 1)

0 commit comments

Comments
 (0)