Skip to content

Commit

Permalink
Merge pull request #20 from husarion/domain-update
Browse files Browse the repository at this point in the history
added ROS_DOMAIN_ID support | fixed user
  • Loading branch information
delihus committed Jun 30, 2023
2 parents 0eae8dd + daeae30 commit 6ae5642
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ignore_packages.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os

user_name = os.getenv('USER')
try:
os.makedirs('/home/runner/.platformio/packages/framework-mbed/features/')
os.makedirs(f'/home/{user_name}/.platformio/packages/framework-mbed/features/')
except FileExistsError:
print('Folder already exists')

with open('/home/runner/.platformio/packages/framework-mbed/features/.mbedignore', 'w') as f:
with open(f'/home/{user_name}/.platformio/packages/framework-mbed/features/.mbedignore', 'w') as f:
f.write('cellular/*\n')
f.write('netsocket/cellular/*\n')
f.write('nanostack/*\n')
3 changes: 2 additions & 1 deletion include/microros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <microros_transport/mbed_serial_transport.hpp>
#include <rclc_parameter/rclc_parameter.h>

constexpr const uint8_t UXR_CLIENT_DOMAIN_ID_TO_OVERRIDE_WITH_ENV = 255;

constexpr const char *NODE_NAME = "rosbot_ros2_firmware";
constexpr const char *IMU_TOPIC_NAME = "_imu/data_raw";
constexpr const char *WHEELS_STATE_TOPIC_NAME = "_motors_response";
Expand All @@ -28,7 +30,6 @@ constexpr const char *FRONT_LEFT_MOTOR_NAME = "fl_wheel_joint";
constexpr const char *FRONT_RIGHT_MOTOR_NAME = "fr_wheel_joint";
constexpr const char *REAR_LEFT_MOTOR_NAME = "rl_wheel_joint";
constexpr const char *REAR_RIGHT_MOTOR_NAME = "rr_wheel_joint";

enum Buttons{
button_left,
button_right,
Expand Down
7 changes: 6 additions & 1 deletion src/microros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ bool microros_init() {
fill_servos_command_msg(&servos_command_msg);

rcl_allocator = rcl_get_default_allocator();
RCCHECK(rclc_support_init(&support, 0, NULL, &rcl_allocator));

rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
RCCHECK(rcl_init_options_init(&init_options, rcl_allocator));
RCCHECK(rcl_init_options_set_domain_id(&init_options, UXR_CLIENT_DOMAIN_ID_TO_OVERRIDE_WITH_ENV));
RCCHECK(rclc_support_init_with_options(&support, 0, NULL, &init_options, &rcl_allocator));

RCCHECK(rclc_node_init_default(&node, NODE_NAME, "", &support));

if (not init_wheels_command_subscriber() or
Expand Down

0 comments on commit 6ae5642

Please sign in to comment.