Skip to content

Arcanain/odrive_motor_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

odrive_motor_control

scripts

odrive_config.py : Odrive for BLDC motor Automatic configuration.
odrive_twist_driver.py : Odrive subscrive /cmd_vel, then calculate /odom and /odom_path
keyboard_teleop.py : keyborad input, then publish /cmd_vel.

Environment

OS : Ubuntu Mate
ROS : noetic

FlowChart

flowchart TD
    A[Start] --> B[Initialize ROS Node: odrive_motor_control]
    B --> C[Create OdriveMotorControl Object]
    C --> D[Connect to Odrive]
    D --> E[Setup Parameters and Variables]
    E --> F[Setup ROS Subscribers and Publishers]
    F --> G[Setup Transform Broadcasters]
    G --> H[Enter Main Control Loop]
    H --> I[Check if ROS is Shutdown]
    I -->|No| J[Calculate Relative Velocity]
    J --> K[Get Current Position and Calculate Odometry]
    K --> L[Publish Odometry and Transform]
    L --> M[Publish Odometry Path]
    M --> N[Set Motor Velocity]
    N --> O[Sleep for Fixed Duration]
    O --> H
    I -->|Yes| P[End]

    subgraph OdriveMotorControl
        Q[Constructor: Initialize and Connect to Odrive]
        R[odrive_setup: Configure Odrive]
        S[calc_relative_vel: Calculate Relative Velocities for Wheels]
        T[callback_vel: Update Target Velocities from ROS Message]
        U[calcodom: Calculate and Update Odometry]
        V[odrive_control: Main Control Loop for Motor Velocity]
    end

    Q --> R
    R --> V
    V --> S
    S --> U
    U --> L
    T --> S

motor configuration

cd ~/catkin_ws/src/odrive_motor_control/script
sudo python3 odrive_config.py

motor operation check(Keyboard)

STEP1

lsusb
Bus 001 Device 009: ID 1209:0d32 Generic ODrive Robotics ODrive v3
ls -al /dev/bus//usb//001/009
crw-rw-r-- 1 root root 189, 8 5月 29 14:49 /dev/bus//usb//001/009
sudo chmod 666 /dev/bus/usb/001/009

STEP2

cd ~/catkin_ws
source ~/catkin_ws/devel/setup.bash
roslaunch odrive_motor_control odrive_keyboard_control.launch

If all goes well, the following message will appear on the terminal

Connect to Odrive...
Connect to Odrive Success!!!

rviz

Screenshot at 2022-09-25 04-22-02

motor operation check(joystick)

STEP1

lsusb
Bus 001 Device 009: ID 1209:0d32 Generic ODrive Robotics ODrive v3
ls -al /dev/bus//usb//001/009
crw-rw-r-- 1 root root 189, 8 5月 29 14:49 /dev/bus//usb//001/009
sudo chmod 666 /dev/bus/usb/001/009

STEP2

cd ~/catkin_ws
source ~/catkin_ws/devel/setup.bash
roslaunch odrive_motor_control odrive_joystick_control.launch

Releases

No releases published

Packages

No packages published