Skip to content

Commit

Permalink
Update trajectory_visualizer node
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoobInventor committed Apr 15, 2024
1 parent ed13f74 commit 3c3f383
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 264 deletions.
56 changes: 0 additions & 56 deletions lidarbot_description/meshes/left_wheel.dae

This file was deleted.

18 changes: 14 additions & 4 deletions lidarbot_description/urdf/lidarbot_core.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@
</xacro:box_inertia>
</link>

<!-- Left Wheel -->
<!-- Left wheel -->
<link name="left_wheel">
<visual>
<geometry>
<mesh filename="package://lidarbot_description/meshes/right_wheel.dae" />
</geometry>
</visual>
<collision>
<origin xyz="0 0 0.0155" rpy="0 0 0"/>
<origin xyz="0 0 -0.0065" rpy="0 0 0"/>
<geometry>
<sphere radius="${wheel_radius}"/>
</geometry>
Expand All @@ -179,10 +179,10 @@
<parent link="base_link"/>
<child link="left_wheel"/>
<origin xyz="0.133 0.065 -${wheel_zoff}" rpy="-${pi/2} 0 ${pi}"/>
<axis xyz="0 0 1"/>
<axis xyz="0 0 -1"/>
</joint>

<!-- Right Wheel -->
<!-- Right wheel -->
<link name="right_wheel">
<visual>
<geometry>
Expand Down Expand Up @@ -238,4 +238,14 @@
<mu2 value="0.001"/>
</gazebo>

<gazebo reference="left_wheel">
<mu1 value="1.16"/>
<mu2 value="1.16"/>
</gazebo>

<gazebo reference="right_wheel">
<mu1 value="1.16"/>
<mu2 value="1.16"/>
</gazebo>

</robot>
193 changes: 0 additions & 193 deletions lidarbot_navigation/scripts/trajectory_visualizer (copy).py

This file was deleted.

15 changes: 4 additions & 11 deletions lidarbot_navigation/scripts/trajectory_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def __init__(self, name):

# Declare parameters
self.max_poses_param = self.declare_parameter("max_poses", 1000).value
# self.threshold_param = self.declare_parameter("threshold", 0.001).value
self.threshold_param = self.declare_parameter("threshold", 0.005).value
self.threshold_param = self.declare_parameter("threshold", 0.001).value

self.frame_id_param = self.declare_parameter("frame_id", "map").value
# self.frame_id_param = self.declare_parameter("frame_id", "map").value
self.frame_id_param = self.declare_parameter("frame_id", "odom").value

self.trajectory_path_msg = Path()
self.previous_pose_position = Point()
Expand All @@ -41,24 +41,17 @@ def __init__(self, name):

# Callback function for odometry type messages
def odom_callback(self, odom_msg):
# self.get_logger().info(
# "Received odom message with x: %f and y: %f"
# % (
# odom_msg.pose.pose.position.x,
# odom_msg.pose.pose.position.y,
# )
# )

# Process message position and add it to path
self.publish_trajectory_path(odom_msg.pose.pose.position)

# Add pose and publish trajectory path message
def publish_trajectory_path(self, position):

# If the pose has moved more than a set threshold, add it ot the path message and publish
if (abs(self.previous_pose_position.x - position.x) > self.threshold_param) or (
abs(self.previous_pose_position.y - position.y) > self.threshold_param
):
# self.get_logger().info("Exceding threshold, adding pose to path")

# Add current pose to path
self.trajectory_path_msg.header.stamp = self.get_clock().now().to_msg()
Expand Down

0 comments on commit 3c3f383

Please sign in to comment.