Skip to content

Commit

Permalink
Fix wheel topics functionality (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa authored Jul 5, 2024
1 parent d7151c6 commit c744f56
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Src/firmware/mainf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ struct WheelWrapper {
ros::Subscriber<std_msgs::Float32, WheelWrapper> cmd_vel_sub_;
};

static WheelWrapper wheel_FL_wrapper(controller->wheel_FL, "FL");
static WheelWrapper wheel_RL_wrapper(controller->wheel_RL, "RL");
static WheelWrapper wheel_FR_wrapper(controller->wheel_FR, "FR");
static WheelWrapper wheel_RR_wrapper(controller->wheel_RR, "RR");
static WheelWrapper *wheel_FL_wrapper;
static WheelWrapper *wheel_RL_wrapper;
static WheelWrapper *wheel_FR_wrapper;
static WheelWrapper *wheel_RR_wrapper;

static ros::Subscriber<geometry_msgs::Twist> twist_sub("cmd_vel",
&cmdVelCallback);
Expand Down Expand Up @@ -165,10 +165,10 @@ void initROS() {
nh.advertiseService(board_type_srv);
nh.advertiseService(reset_board_srv);

wheel_FL_wrapper.initROS();
wheel_RL_wrapper.initROS();
wheel_FR_wrapper.initROS();
wheel_RR_wrapper.initROS();
wheel_FL_wrapper->initROS();
wheel_RL_wrapper->initROS();
wheel_FR_wrapper->initROS();
wheel_RR_wrapper->initROS();
}

void setup() {
Expand All @@ -186,6 +186,12 @@ void setup() {
} else {
controller = new diff_drive_lib::DiffDriveController(ROBOT_CONFIG);
}

wheel_FL_wrapper = new WheelWrapper(controller->wheel_FL, "FL");
wheel_RL_wrapper = new WheelWrapper(controller->wheel_RL, "RL");
wheel_FR_wrapper = new WheelWrapper(controller->wheel_FR, "FR");
wheel_RR_wrapper = new WheelWrapper(controller->wheel_RR, "RR");

initROS();

imu_receiver.init();
Expand Down

0 comments on commit c744f56

Please sign in to comment.