Skip to content

Commit

Permalink
fixed app5 labo 12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
IanLalonde committed Nov 6, 2024
1 parent 01d254b commit 766cc95
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions racecar_behaviors/racecar_behaviors/path_following.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def __init__(self):
self.angle_div = self.declare_parameter('angle_div', 8).value
self.distance = self.declare_parameter('distance', 0.7).value
self.distance_short = self.declare_parameter('distance_short', 0.45).value
self.max_speed = self.declare_parameter('max_speed', 1).value
self.max_steering = self.declare_parameter('max_steering', 0.37).value

self.cmd_vel_pub = self.create_publisher(Twist, 'cmd_vel', 1)
self.scan_sub = self.create_subscription(LaserScan, 'scan', self.scan_callback, 1)
Expand All @@ -26,8 +28,8 @@ def scan_callback(self, msg):
#ranges = msg.ranges[l2:len(msg.ranges)] + msg.ranges[0:l2]

twist = Twist()
twist.linear.x = self.max_speed
twist.angular.z = 0
twist.linear.x = float(self.max_speed)
twist.angular.z = 0.0

self.cmd_vel_pub.publish(twist)

Expand Down
6 changes: 6 additions & 0 deletions racecar_gazebo/launch/racecar_circuit.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.actions import AppendEnvironmentVariable

def generate_launch_description():
# Package Directories
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')
racecar_gazebo = get_package_share_directory('racecar_gazebo')

world_name = os.path.join(get_package_share_directory('racecar_gazebo'), 'worlds', 'racecar_circuit.world')
models_path = os.path.join(get_package_share_directory('racecar_gazebo'))

addEnvVariable = AppendEnvironmentVariable("IGN_GAZEBO_RESOURCE_PATH",models_path)


# Inside generate_launch_description() function
gazebo = IncludeLaunchDescription(
Expand All @@ -25,6 +30,7 @@ def generate_launch_description():
)

return LaunchDescription([
addEnvVariable,
gazebo,
spawn,
])
4 changes: 2 additions & 2 deletions racecar_gazebo/models/walker_racecourse/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<collision name="collision">
<geometry>
<mesh>
<uri>model://racecar_gazebo/meshes/walker_racecourse.dae</uri>
<uri>model://meshes/walker_racecourse.dae</uri>
</mesh>
</geometry>
</collision>
<visual name="visual">
<geometry>
<mesh>
<uri>model://racecar_gazebo/meshes/walker_racecourse.dae</uri>
<uri>model://meshes/walker_racecourse.dae</uri>
</mesh>
</geometry>
</visual>
Expand Down
2 changes: 1 addition & 1 deletion racecar_gazebo/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def package_files(data_files, directory_list):
name=package_name,
version='0.0.0',
packages=find_packages(exclude=['test']),
data_files=package_files(data_files,['models/', 'launch/', 'worlds/','config/']),
data_files=package_files(data_files,['models/', 'launch/', 'worlds/','config/', 'meshes/']),
install_requires=['setuptools'],
zip_safe=True,
maintainer='clocal',
Expand Down
2 changes: 1 addition & 1 deletion racecar_gazebo/worlds/racecar_circuit.world
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</light>

<include>
<uri>model://racecar_gazebo/models/walker_racecourse</uri>
<uri>model://models/walker_racecourse</uri>
<pose>-4 2 -.3583 0 0 -1.57</pose>
<name>walker_racecourse</name>
</include>
Expand Down

0 comments on commit 766cc95

Please sign in to comment.