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

Add support for mecanum wheels, add boot state #2

Merged
merged 11 commits into from
Nov 15, 2023
4 changes: 2 additions & 2 deletions colcon.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"rmw_microxrcedds": {
"cmake-args": [
"-DRMW_UXRCE_MAX_NODES=1",
"-DRMW_UXRCE_MAX_PUBLISHERS=6",
"-DRMW_UXRCE_MAX_PUBLISHERS=7",
"-DRMW_UXRCE_MAX_SUBSCRIPTIONS=9",
"-DRMW_UXRCE_MAX_SERVICES=9",
"-DRMW_UXRCE_MAX_SERVICES=10",
"-DRMW_UXRCE_MAX_CLIENTS=0",
"-DRMW_UXRCE_MAX_HISTORY=4",
"-DRMW_UXRCE_TRANSPORT=custom",
Expand Down
4 changes: 2 additions & 2 deletions extra_packages/extra_packages.repos
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repositories:
leo_msgs:
type: git
url: https://github.com/fictionlab-gbp/leo_common-ros2-release.git
version: release/humble/leo_msgs/1.0.3-1
url: https://github.com/ros2-gbp/leo_common-release.git
version: release/humble/leo_msgs/1.2.0-1
14 changes: 11 additions & 3 deletions include/configuration.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "diff_drive_lib/diff_drive_controller.hpp"
#include "diff_drive_lib/robot_controller.hpp"

#include "motor_controller.hpp"

// Size of the heap memory used for micro-ROS entities
constexpr uint32_t UROS_HEAP_SIZE = 30000;
constexpr uint32_t UROS_HEAP_SIZE = 40000;

// Domain ID used for ROS communication
constexpr size_t ROS_DOMAIN_ID = 0;
Expand Down Expand Up @@ -38,6 +38,10 @@ constexpr uint8_t BATTERY_PUB_PERIOD = 10;
constexpr uint8_t JOINTS_PUB_PERIOD = 5;
constexpr uint8_t ODOM_PUB_PERIOD = 5;
// constexpr uint8_t IMU_PUB_PERIOD = 1;
constexpr uint8_t PARAM_TRIGGER_PUB_PERIOD = 100;

// The time after which the firmware will boot with default parameter values
constexpr uint32_t BOOT_TIMEOUT = 20000;

// Motor driver configurations
constexpr MotorConfiguration MOT_A_CONFIG = {
Expand Down Expand Up @@ -69,25 +73,29 @@ extern MotorController MotB;
extern MotorController MotC;
extern MotorController MotD;

constexpr diff_drive_lib::DiffDriveConfiguration DD_CONFIG = {
constexpr diff_drive_lib::RobotConfiguration ROBOT_CONFIG = {
.wheel_FL_conf =
{
.motor = MotC,
.op_mode = diff_drive_lib::WheelOperationMode::VELOCITY,
.velocity_rolling_window_size = ENCODER_BUFFER_SIZE,
},
.wheel_RL_conf =
{
.motor = MotD,
.op_mode = diff_drive_lib::WheelOperationMode::VELOCITY,
.velocity_rolling_window_size = ENCODER_BUFFER_SIZE,
},
.wheel_FR_conf =
{
.motor = MotA,
.op_mode = diff_drive_lib::WheelOperationMode::VELOCITY,
.velocity_rolling_window_size = ENCODER_BUFFER_SIZE,
},
.wheel_RR_conf =
{
.motor = MotB,
.op_mode = diff_drive_lib::WheelOperationMode::VELOCITY,
.velocity_rolling_window_size = ENCODER_BUFFER_SIZE,
},
};
16 changes: 9 additions & 7 deletions include/parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <rclc_parameter/rclc_parameter.h>

#include "diff_drive_lib/diff_drive_controller.hpp"
#include "diff_drive_lib/robot_controller.hpp"

struct Parameters : diff_drive_lib::DiffDriveParams {
struct Parameters : diff_drive_lib::RobotParams {
// Override inherited parameters
Parameters() {
// Wheel
Expand All @@ -15,15 +15,17 @@ struct Parameters : diff_drive_lib::DiffDriveParams {
wheel_pid_d = 0.0F;
wheel_pwm_duty_limit = 100.0F;

// Differential drive
dd_wheel_radius = 0.0625F;
dd_wheel_separation = 0.33F;
dd_angular_velocity_multiplier = 1.91F;
dd_input_timeout = 500;
robot_wheel_radius = 0.0625F;
robot_wheel_separation = 0.33F;
robot_wheel_base = 0.3052;
robot_angular_velocity_multiplier = 1.91F;
robot_input_timeout = 500;
}

float battery_min_voltage = 10.0;

bool mecanum_wheels = false;

bool init(rclc_parameter_server_t* param_server);
void update(rclc_parameter_server_t* param_server);
};
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ board_microros_distro = humble-fictionlab
board_microros_transport = custom
board_microros_user_meta = colcon.meta
lib_deps =
https://github.com/fictionlab/diff_drive_lib.git#1.4
https://github.com/fictionlab/diff_drive_lib.git#1.5
https://github.com/fictionlab/micro_ros_platformio#fictionlab-v2
https://github.com/byq77/encoder-mbed.git#dfac32c
https://github.com/byq77/drv88xx-driver-mbed.git#61854e8
Expand Down
Loading