From 84d31f81151f3c5bb41e232dfe0ba608f8f35734 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 26 Jan 2024 15:14:40 +0000 Subject: [PATCH 1/2] gazebo fix --- rae_description/urdf/rae.urdf.xacro | 2 +- rae_gazebo/CMakeLists.txt | 2 +- rae_gazebo/launch/gazebo.launch.py | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rae_description/urdf/rae.urdf.xacro b/rae_description/urdf/rae.urdf.xacro index b4fd7b9..f299473 100644 --- a/rae_description/urdf/rae.urdf.xacro +++ b/rae_description/urdf/rae.urdf.xacro @@ -2,7 +2,7 @@ - + diff --git a/rae_gazebo/CMakeLists.txt b/rae_gazebo/CMakeLists.txt index 2a2803a..d956388 100644 --- a/rae_gazebo/CMakeLists.txt +++ b/rae_gazebo/CMakeLists.txt @@ -8,7 +8,7 @@ endif() find_package(ament_cmake REQUIRED) install( - DIRECTORY launch + DIRECTORY launch worlds DESTINATION share/${PROJECT_NAME}/ ) diff --git a/rae_gazebo/launch/gazebo.launch.py b/rae_gazebo/launch/gazebo.launch.py index ba5a6ad..9f2cdcd 100644 --- a/rae_gazebo/launch/gazebo.launch.py +++ b/rae_gazebo/launch/gazebo.launch.py @@ -12,9 +12,8 @@ def launch_setup(context, *args, **kwargs): rae_description_pkg = get_package_share_directory('rae_description') ros_gz_sim_pkg = get_package_share_directory('ros_gz_sim') - world_file = LaunchConfiguration('sdf_file').perform(context) - + print(f'world_file: {world_file}') return [ SetEnvironmentVariable( name='IGN_GAZEBO_RESOURCE_PATH', @@ -29,7 +28,7 @@ def launch_setup(context, *args, **kwargs): os.path.join(ros_gz_sim_pkg, 'launch', 'gz_sim.launch.py') ]), launch_arguments={ - 'gz_args': '-r /home/mateo/Dev/Projects/rae/rae-sandbox/src/rae_gazebo/worlds/world_demo.sdf', + 'gz_args': world_file, 'use_sim_time': 'True' }.items() ), From 4800405049ba3ac832d7e9179a7f42cdd3984a83 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 2 Feb 2024 13:40:11 +0000 Subject: [PATCH 2/2] format --- rae_hw/src/peripherals/led.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rae_hw/src/peripherals/led.cpp b/rae_hw/src/peripherals/led.cpp index c6074e6..578b0c0 100644 --- a/rae_hw/src/peripherals/led.cpp +++ b/rae_hw/src/peripherals/led.cpp @@ -92,12 +92,12 @@ uint8_t LEDNode::convertColor(float num) { } float LEDNode::convertOpacity(float num) { - if (num < 0) { - num = 0;} - else if(num > 1) { + if(num < 0) { + num = 0; + } else if(num > 1) { num = 1; } - + return num; } @@ -126,9 +126,9 @@ void LEDNode::fillBuffer(uint8_t color, float intensity) { } void LEDNode::setSinglePixel(uint16_t pixel, uint8_t r, uint8_t g, uint8_t b, float a, float frequency) { auto mapping_pair = logicalToPhysicalMapping.find(pixel); - const float phaseOffset = (M_PI/ 4); // Initial phase offset, if needed - const float amplitudeOffset = 1.0f; // Add 1 to sine wave to avoid negative values - const float scaler = 2.0f; // Scale the sine wave to 0-1 + const float phaseOffset = (M_PI / 4); // Initial phase offset, if needed + const float amplitudeOffset = 1.0f; // Add 1 to sine wave to avoid negative values + const float scaler = 2.0f; // Scale the sine wave to 0-1 const float intensity = ((std::sin(frame / (2 * M_PI) * frequency + phaseOffset) + amplitudeOffset) / scaler) * a; if(mapping_pair != logicalToPhysicalMapping.end()) { uint16_t physicalID = mapping_pair->second;