Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gazebo fix #66

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rae_description/urdf/rae.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<robot name="rae"
xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="inertial_moment_calc.xacro"/>
<!-- <xacro:include filename="rae_gazebo.xacro"/> -->
<xacro:include filename="rae_gazebo_control.urdf.xacro"/>
<xacro:include filename="rae_ros2_control.urdf.xacro"/>
<xacro:property name="deg_to_rad" value="0.01745329251994329577" />

Expand Down
2 changes: 1 addition & 1 deletion rae_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()
find_package(ament_cmake REQUIRED)

install(
DIRECTORY launch
DIRECTORY launch worlds
DESTINATION share/${PROJECT_NAME}/
)

Expand Down
5 changes: 2 additions & 3 deletions rae_gazebo/launch/gazebo.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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()
),
Expand Down
14 changes: 7 additions & 7 deletions rae_hw/src/peripherals/led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
Loading