├── README-ZH.md ├── README.md ├── scout_mini_omni_base ├── CMakeLists.txt ├── include │ └── scout_mini_omni_base │ │ ├── scout_messenger.hpp │ │ └── scout_params.hpp ├── launch │ └── scout_base.launch ├── package.xml ├── rviz │ └── model_display.rviz └── src │ ├── scout_base_node.cpp │ ├── scout_messenger.cpp │ └── speed.cpp ├── scout_mini_omni_bringup ├── CMakeLists.txt ├── launch │ ├── scout_robot_base.launch │ └── scout_teleop_keyboard.launch ├── package.xml └── scripts │ ├── bringup_can2usb.bash │ └── setup_can2usb.bash └── scout_mini_omni_msgs ├── CHANGELOG.md ├── CMakeLists.txt ├── msg ├── ScoutBmsStatus.msg ├── ScoutDriverState.msg ├── ScoutLightCmd.msg ├── ScoutLightState.msg ├── ScoutMotorState.msg └── ScoutStatus.msg └── package.xml /README-ZH.md: -------------------------------------------------------------------------------- 1 | # 松灵机器人产品SCOUT 的ROS package 2 | 3 | ## ROS Packages 说明 4 | 5 | * scout_bringup: launch and configuration files to start ROS nodes 6 | * scout_base: a ROS wrapper around Scout SDK to monitor and control the robot 7 | * scout_msgs: scout related message definitions 8 | * (scout_ros: meta package for the Scout robot ROS packages) 9 | 10 | 11 | 下图是是整个ros package的一个基本框架说明,或许它可以帮助你理解你理解整个ros package内部是如何工作的,他们之间的是相互联系的。 12 | 其中最底层的是移动机器人底盘,它通过can或者usart实现运行在计算平台的sdk进行基本信息的获取,具体可以根据wrp_sdk了解更多信息。 仿真部分是基于Webots,构建起的仿真环境。 13 | 14 | 15 | 16 | 其中上图中紫色部分是包含在这个ros-package中的部分。 17 | 18 | ## 通讯接口设置 19 | 20 | ### 设置串口 21 | 22 | 通常来说,usb转串口设备在Linux或者Ubuntu系统中会被自动识别为“/dev/ttyUSB0” 或者看起来类似的设备,这个可以通过指令查询 23 | ``` 24 | $ ls -l /dev/ttyUSB* 25 | ``` 26 | 如果在打开设备的操作过程中出现了"... permission denied ..."的错误,有可能因为权限的原因造成的,您需要向您的用户帐户授予端口访问权限,可以通过如下指令: 27 | 28 | ``` 29 | $ sudo usermod -a -G dialout $USER 30 | ``` 31 | 32 | 需要重新登录账户才能使刚刚的操作生效。 33 | ### 配置 CAN-TO-USB适配器 34 | 35 | 1. 设置CAN转USB适配器,启用gs_usb内核模块(本指令需要搭配相应的硬件设备才可以使用,需要Linux内部版本>4.5) 36 | 37 | ``` 38 | $ sudo modprobe gs_usb 39 | ``` 40 | 41 | 2. 设置can设备参数 42 | 43 | ``` 44 | $ sudo ip link set can0 up type can bitrate 500000 45 | ``` 46 | 47 | 3. 如果在前面的步骤中没有发生错误,您可以使用以下指令查看can设备 48 | 49 | ``` 50 | $ ifconfig -a 51 | ``` 52 | 53 | 4. 安装和使用can-utils来测试硬件 54 | 55 | ``` 56 | $ sudo apt install can-utils 57 | ``` 58 | 59 | 5. 测试指令 60 | 61 | ``` 62 | # receiving data from can0 63 | $ candump can0 64 | # send data to can0 65 | $ cansend can0 001#1122334455667788 66 | ``` 67 | 68 | 文件中提供了 "./scripts"文件夹里的两个脚本以便于设置。您可以在首次安装时运行“ ./setup_can2usb.bash”,并在每次拔出和重新插入适配器时运行“ ./bringup_can2usb.bash”以启动设备。 69 | 70 | ## ROS package 的基础使用 71 | 72 | 1. 安装 ROS packages 依赖 73 | 74 | ``` 75 | $ sudo apt install ros-melodic-teleop-twist-keyboard 76 | ``` 77 | 78 | 如果你使用是 Kinetic版本,把上述指令中的“melodic” 改成 “kinetic” 即可 79 | 80 | 2. 将scout ros package 下载至的您的catkin 工作空间,并编译 81 | 82 | (下面的操作是假定你的catkin编译工作空间在: ~/catkin_ws/src 目录下) 83 | 84 | ``` 85 | $ cd ~/catkin_ws/src 86 | $ git clone --recursive https://github.com/agilexrobotics/ugv_sdk.git 87 | $ git clone https://github.com/agilexrobotics/scout_ros.git 88 | $ cd .. 89 | $ catkin_make 90 | ``` 91 | 如果你买的小车版本是1.0通信协议版本,执行以下指令切换ugv_sdk的版本至1.0版本 92 | ``` 93 | $ cd ugv_sdk && git checkout master 94 | ``` 95 | 然后重新编译 96 | 97 | 3. 启动 ROS nodes 98 | 99 | * 启动scout车节点 100 | 101 | ``` 102 | $ roslaunch scout_bringup scout_minimal.launch 103 | ``` 104 | 105 | * 启动scout-mini车节点 106 | 107 | ``` 108 | $ roslaunch scout_bringup scout_mini_minimal.launch 109 | ``` 110 | 111 | * Start the keyboard tele-op node 112 | 113 | ``` 114 | $ roslaunch scout_bringup scout_teleop_keyboard.launch 115 | ``` 116 | 117 | **SAFETY PRECAUSION**: 118 | 119 | The default command values of the keyboard teleop node are high, make sure you decrease the speed commands before starting to control the robot with your keyboard! Have your remote controller ready to take over the control whenever necessary. 120 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ROS Packages for Scout_Mini_Omni Mobile Robot 2 | 3 | ## Packages 4 | 5 | This repository contains minimal packages to control the scout robot using ROS. 6 | 7 | * scout_bringup: launch and configuration files to start ROS nodes 8 | * scout_base: a ROS wrapper around [ugv_sdk](https://github.com/agilexrobotics/ugv_sdk) to monitor and control the scout robot 9 | * scout_description: URDF model for the mobile base, a sample urdf (scout_description/sample/scout_v2_nav.xacro) is provided for customized robot with addtional sensors 10 | * scout_msgs: scout related message definitions 11 | 12 | ### Update the packages for your customized robot 13 | 14 | **Additional sensors** 15 | 16 | It's likely that you may want to add additional sensors to the scout mobile platform, such as a Lidar for navigation. In such cases, a new ".xacro" file needs to be created to describe the relative pose of the new sensor with respect to the robot base, so that the sensor frame can be reflected in the robot tf tree. 17 | 18 | A [sample](scout_description/sample/scout_v2_nav.xacro) ".xacro" file is present in this repository, in which the base ".xacro" file of an empty scout platform is first included, and then additional links are defined. 19 | 20 | The nodes in this ROS package are made to handle only the control of the scout base and publishing of the status. Additional nodes may need to be created by the user to handle the sensors. 21 | 22 | **Alternative odometry calculation** 23 | 24 | By default the scout_base package will publish odometry message to topic "/odom". In case you want to use a different approach to calculate the odometry, for example estimating the position together with an IMU, you could rename the default odometry topic to be something else. 25 | 26 | ``` 27 | $ scout_bringup scout_minimal.launch odom_topic_name:="" 28 | ``` 29 | 30 | ## Communication interface setup 31 | 32 | Please refer to the [README](https://github.com/westonrobot/ugv_sdk_sdk#hardware-interface) of "ugv_sdk" package for setup of communication interfaces. 33 | 34 | #### Note on CAN interface on Nvidia Jetson Platforms 35 | 36 | Nvidia Jeston TX2/Xavier/XavierNX have CAN controller(s) integrated in the main SOC. If you're using a dev kit, you need to add a CAN transceiver for proper CAN communication. 37 | 38 | ## Basic usage of the ROS packages 39 | 40 | 1. Install dependent libraries 41 | 42 | ``` 43 | $ sudo apt install -y libasio-dev 44 | $ sudo apt install -y ros-$ROS_DISTRO-teleop-twist-keyboard 45 | ``` 46 | 47 | 2. Clone the packages into your catkin workspace and compile 48 | 49 | (the following instructions assume your catkin workspace is at: ~/catkin_ws/src) 50 | 51 | ``` 52 | $ cd ~/catkin_ws/src 53 | $ git clone https://github.com/agilexrobotics/ugv_sdk.git 54 | $ git clone https://github.com/agilexrobotics/scout_ros.git 55 | $ cd .. 56 | $ catkin_make 57 | ``` 58 | 59 | 3. Setup CAN-To-USB adapter 60 | 61 | * Enable gs_usb kernel module(If you have already added this module, you do not need to add it) 62 | ``` 63 | $ sudo modprobe gs_usb 64 | ``` 65 | 66 | * first time use hunter-ros package 67 | ``` 68 | $ rosrun scout_mini_omni_bringup setup_can2usb.bash 69 | ``` 70 | 71 | * if not the first time use hunter-ros package(Run this command every time you turn off the power) 72 | ``` 73 | $ rosrun scout_mini_omni_bringup bringup_can2usb.bash 74 | ``` 75 | 76 | * Testing command 77 | ``` 78 | # receiving data from can0 79 | $ candump can0 80 | ``` 81 | 82 | 4. Launch ROS nodes 83 | 84 | * Start the base node for scout 85 | 86 | ``` 87 | $ roslaunch scout_mini_omni_bringup scout_robot_base.launch 88 | ``` 89 | 90 | The [scout_mini_omni_bringup/scout_minimal.launch](scout_mini_omni_bringup/launch/scout_robot_base.launch) has 3 parameters: 91 | 92 | - port_name: specifies the port used to communicate with the robot, default = "can0" 93 | - simulated_robot: indicates if launching with a simulation, default = "false" 94 | - odom_topic_name: sets the name of the topic which calculated odometry is published to, defaults = "odom" 95 | 96 | 97 | 98 | * Start the keyboard tele-op node 99 | 100 | ``` 101 | $ roslaunch scout_mini_omni_bringup scout_teleop_keyboard.launch 102 | ``` 103 | 104 | **SAFETY PRECAUSION**: 105 | 106 | The default command values of the keyboard teleop node are high, make sure you decrease the speed commands before starting to control the robot with your keyboard! Have your remote controller ready to take over the control whenever necessary. 107 | -------------------------------------------------------------------------------- /scout_mini_omni_base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(scout_mini_omni_base) 3 | 4 | ## Compile as C++11, supported in ROS Kinetic and newer 5 | add_compile_options(-std=c++11) 6 | 7 | find_package(catkin REQUIRED COMPONENTS 8 | roslaunch 9 | roscpp 10 | sensor_msgs 11 | std_msgs 12 | geometry_msgs 13 | tf2 14 | tf2_ros 15 | ugv_sdk 16 | scout_mini_omni_msgs 17 | ) 18 | 19 | # find_package(Boost REQUIRED COMPONENTS chrono) 20 | 21 | ################################### 22 | ## catkin specific configuration ## 23 | ################################### 24 | 25 | catkin_package( 26 | INCLUDE_DIRS include 27 | LIBRARIES scout_messenger 28 | CATKIN_DEPENDS ugv_sdk scout_msgs 29 | # DEPENDS Boost 30 | ) 31 | 32 | ########### 33 | ## Build ## 34 | ########### 35 | 36 | ## Specify additional locations of header files 37 | ## Your package locations should be listed before other locations 38 | include_directories( 39 | include 40 | ${catkin_INCLUDE_DIRS} 41 | ) 42 | 43 | add_library(scout_messenger STATIC src/scout_messenger.cpp) 44 | target_link_libraries(scout_messenger ${catkin_LIBRARIES}) 45 | add_dependencies(scout_messenger ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 46 | 47 | add_executable(scout_base_node src/scout_base_node.cpp) 48 | target_link_libraries(scout_base_node scout_messenger ${catkin_LIBRARIES}) 49 | 50 | add_executable(speed src/speed.cpp) 51 | target_link_libraries(speed ${catkin_LIBRARIES}) 52 | 53 | ############# 54 | ## Install ## 55 | ############# 56 | 57 | install(TARGETS scout_messenger scout_base_node 58 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 59 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 60 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) 61 | 62 | install(DIRECTORY include/${PROJECT_NAME}/ 63 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) 64 | 65 | install(DIRECTORY launch 66 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) 67 | -------------------------------------------------------------------------------- /scout_mini_omni_base/include/scout_mini_omni_base/scout_messenger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * scout_messenger.hpp 3 | * 4 | * Created on: Jun 14, 2019 10:24 5 | * Description: 6 | * 7 | * Copyright (c) 2019 Ruixiang Du (rdu) 8 | */ 9 | 10 | #ifndef SCOUT_MESSENGER_HPP 11 | #define SCOUT_MESSENGER_HPP 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | // #include 18 | #include 19 | 20 | #include "scout_mini_omni_msgs/ScoutLightCmd.h" 21 | #include "ugv_sdk/mobile_robot/scout_robot.hpp" 22 | #include 23 | 24 | namespace westonrobot 25 | { 26 | class ScoutROSMessenger 27 | { 28 | public: 29 | explicit ScoutROSMessenger(ros::NodeHandle *nh); 30 | ScoutROSMessenger(ScoutMiniOmniRobot *scout, ros::NodeHandle *nh); 31 | 32 | std::string odom_frame_; 33 | std::string base_frame_; 34 | std::string odom_topic_name_; 35 | 36 | bool simulated_robot_ = false; 37 | int sim_control_rate_ = 50; 38 | 39 | void SetupSubscription(); 40 | 41 | void PublishStateToROS(); 42 | void PublishSimStateToROS(double linear, double angular,double lateral); 43 | void GetCurrentMotionCmdForSim(double &linear, double &angular, double &lateral); 44 | 45 | private: 46 | ScoutMiniOmniRobot *scout_; 47 | ros::NodeHandle *nh_; 48 | 49 | std::mutex twist_mutex_; 50 | geometry_msgs::Twist current_twist_; 51 | 52 | ros::Publisher odom_publisher_; 53 | ros::Publisher status_publisher_; 54 | ros::Publisher BMS_status_publisher_; 55 | ros::Subscriber motion_cmd_subscriber_; 56 | ros::Subscriber light_cmd_subscriber_; 57 | tf2_ros::TransformBroadcaster tf_broadcaster_; 58 | 59 | // speed variables 60 | double linear_speed_ = 0.0; 61 | double angular_speed_ = 0.0; 62 | double position_x_ = 0.0; 63 | double position_y_ = 0.0; 64 | double theta_ = 0.0; 65 | 66 | ros::Time last_time_; 67 | ros::Time current_time_; 68 | 69 | void TwistCmdCallback(const geometry_msgs::Twist::ConstPtr &msg); 70 | void LightCmdCallback(const scout_mini_omni_msgs::ScoutLightCmd::ConstPtr &msg); 71 | void PublishOdometryToROS(double linear, double angular, double lateral, double dt); 72 | }; 73 | } // namespace westonrobot 74 | 75 | #endif /* SCOUT_MESSENGER_HPP */ 76 | -------------------------------------------------------------------------------- /scout_mini_omni_base/include/scout_mini_omni_base/scout_params.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * scout_params.hpp 3 | * 4 | * Created on: Sep 27, 2019 15:08 5 | * Description: 6 | * 7 | * Copyright (c) 2020 Ruixiang Du (rdu) 8 | */ 9 | 10 | #ifndef SCOUT_PARAMS_HPP 11 | #define SCOUT_PARAMS_HPP 12 | 13 | namespace westonrobot 14 | { 15 | struct ScoutParams 16 | { 17 | /* Scout Parameters */ 18 | static constexpr double max_steer_angle = 30.0; // in degree 19 | 20 | static constexpr double track = 0.58306; // in meter (left & right wheel distance) 21 | static constexpr double wheelbase = 0.498; // in meter (front & rear wheel distance) 22 | static constexpr double wheel_radius = 0.165; // in meter 23 | 24 | // from user manual v1.2.8 P18 25 | // max linear velocity: 1.5 m/s 26 | // max angular velocity: 0.7853 rad/s 27 | static constexpr double max_linear_speed = 1.5; // in m/s 28 | static constexpr double max_angular_speed = 0.7853; // in rad/s 29 | static constexpr double max_speed_cmd = 10.0; // in rad/s 30 | }; 31 | } // namespace westonrobot 32 | 33 | #endif /* SCOUT_PARAMS_HPP */ 34 | -------------------------------------------------------------------------------- /scout_mini_omni_base/launch/scout_base.launch: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /scout_mini_omni_base/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | scout_mini_omni_base 4 | 0.3.3 5 | AgileX Scout robot driver 6 | 7 | Ruixiang Du 8 | WestonRobot 9 | 10 | BSD 11 | 12 | TODO 13 | TODO 14 | TODO 15 | 16 | catkin 17 | scout_msgs 18 | roscpp 19 | roslaunch 20 | sensor_msgs 21 | ugv_sdk 22 | controller_manager 23 | geometry_msgs 24 | scout_msgs 25 | roscpp 26 | sensor_msgs 27 | topic_tools 28 | ugv_sdk 29 | 30 | 31 | -------------------------------------------------------------------------------- /scout_mini_omni_base/rviz/model_display.rviz: -------------------------------------------------------------------------------- 1 | Panels: 2 | - Class: rviz/Displays 3 | Help Height: 78 4 | Name: Displays 5 | Property Tree Widget: 6 | Expanded: 7 | - /Global Options1 8 | - /Status1 9 | - /RobotModel1 10 | Splitter Ratio: 0.5 11 | Tree Height: 732 12 | - Class: rviz/Selection 13 | Name: Selection 14 | - Class: rviz/Tool Properties 15 | Expanded: 16 | - /2D Pose Estimate1 17 | - /2D Nav Goal1 18 | - /Publish Point1 19 | Name: Tool Properties 20 | Splitter Ratio: 0.5886790156364441 21 | - Class: rviz/Views 22 | Expanded: 23 | - /Current View1 24 | Name: Views 25 | Splitter Ratio: 0.5 26 | - Class: rviz/Time 27 | Experimental: false 28 | Name: Time 29 | SyncMode: 0 30 | SyncSource: "" 31 | Preferences: 32 | PromptSaveOnExit: true 33 | Toolbars: 34 | toolButtonStyle: 2 35 | Visualization Manager: 36 | Class: "" 37 | Displays: 38 | - Alpha: 0.5 39 | Cell Size: 1 40 | Class: rviz/Grid 41 | Color: 160; 160; 164 42 | Enabled: true 43 | Line Style: 44 | Line Width: 0.029999999329447746 45 | Value: Lines 46 | Name: Grid 47 | Normal Cell Count: 0 48 | Offset: 49 | X: 0 50 | Y: 0 51 | Z: 0 52 | Plane: XY 53 | Plane Cell Count: 10 54 | Reference Frame: 55 | Value: true 56 | - Alpha: 1 57 | Class: rviz/RobotModel 58 | Collision Enabled: false 59 | Enabled: true 60 | Links: 61 | All Links Enabled: true 62 | Expand Joint Details: false 63 | Expand Link Details: false 64 | Expand Tree: false 65 | Link Tree Style: Links in Alphabetic Order 66 | base_link: 67 | Alpha: 1 68 | Show Axes: false 69 | Show Trail: false 70 | chassis_link: 71 | Alpha: 1 72 | Show Axes: false 73 | Show Trail: false 74 | Value: true 75 | front_left_wheel_link: 76 | Alpha: 1 77 | Show Axes: false 78 | Show Trail: false 79 | Value: true 80 | front_right_wheel_link: 81 | Alpha: 1 82 | Show Axes: false 83 | Show Trail: false 84 | Value: true 85 | inertial_link: 86 | Alpha: 1 87 | Show Axes: false 88 | Show Trail: false 89 | rear_left_wheel_link: 90 | Alpha: 1 91 | Show Axes: false 92 | Show Trail: false 93 | Value: true 94 | rear_right_wheel_link: 95 | Alpha: 1 96 | Show Axes: false 97 | Show Trail: false 98 | Value: true 99 | Name: RobotModel 100 | Robot Description: robot_description 101 | TF Prefix: "" 102 | Update Interval: 0 103 | Value: true 104 | Visual Enabled: true 105 | - Class: rviz/TF 106 | Enabled: true 107 | Frame Timeout: 15 108 | Frames: 109 | All Enabled: true 110 | base_link: 111 | Value: true 112 | chassis_link: 113 | Value: true 114 | front_left_wheel_link: 115 | Value: true 116 | front_right_wheel_link: 117 | Value: true 118 | inertial_link: 119 | Value: true 120 | rear_left_wheel_link: 121 | Value: true 122 | rear_right_wheel_link: 123 | Value: true 124 | Marker Scale: 1 125 | Name: TF 126 | Show Arrows: true 127 | Show Axes: true 128 | Show Names: true 129 | Tree: 130 | base_link: 131 | chassis_link: 132 | front_left_wheel_link: 133 | {} 134 | front_right_wheel_link: 135 | {} 136 | rear_left_wheel_link: 137 | {} 138 | rear_right_wheel_link: 139 | {} 140 | inertial_link: 141 | {} 142 | Update Interval: 0 143 | Value: true 144 | Enabled: true 145 | Global Options: 146 | Background Color: 48; 48; 48 147 | Default Light: true 148 | Fixed Frame: base_link 149 | Frame Rate: 30 150 | Name: root 151 | Tools: 152 | - Class: rviz/Interact 153 | Hide Inactive Objects: true 154 | - Class: rviz/MoveCamera 155 | - Class: rviz/Select 156 | - Class: rviz/FocusCamera 157 | - Class: rviz/Measure 158 | - Class: rviz/SetInitialPose 159 | Theta std deviation: 0.2617993950843811 160 | Topic: /initialpose 161 | X std deviation: 0.5 162 | Y std deviation: 0.5 163 | - Class: rviz/SetGoal 164 | Topic: /move_base_simple/goal 165 | - Class: rviz/PublishPoint 166 | Single click: true 167 | Topic: /clicked_point 168 | Value: true 169 | Views: 170 | Current: 171 | Class: rviz/Orbit 172 | Distance: 2.9432930946350098 173 | Enable Stereo Rendering: 174 | Stereo Eye Separation: 0.05999999865889549 175 | Stereo Focal Distance: 1 176 | Swap Stereo Eyes: false 177 | Value: false 178 | Focal Point: 179 | X: 0.027046792209148407 180 | Y: -0.03490818291902542 181 | Z: -0.09952529519796371 182 | Focal Shape Fixed Size: true 183 | Focal Shape Size: 0.05000000074505806 184 | Invert Z Axis: false 185 | Name: Current View 186 | Near Clip Distance: 0.009999999776482582 187 | Pitch: 0.5447957515716553 188 | Target Frame: 189 | Value: Orbit (rviz) 190 | Yaw: 4.27542781829834 191 | Saved: ~ 192 | Window Geometry: 193 | Displays: 194 | collapsed: false 195 | Height: 1029 196 | Hide Left Dock: false 197 | Hide Right Dock: true 198 | QMainWindow State: 000000ff00000000fd00000004000000000000015600000367fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d00000367000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002b0fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d000002b0000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000074d0000003efc0100000002fb0000000800540069006d006501000000000000074d000002eb00fffffffb0000000800540069006d00650100000000000004500000000000000000000005f10000036700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 199 | Selection: 200 | collapsed: false 201 | Time: 202 | collapsed: false 203 | Tool Properties: 204 | collapsed: false 205 | Views: 206 | collapsed: true 207 | Width: 1869 208 | X: 632 209 | Y: 291 210 | -------------------------------------------------------------------------------- /scout_mini_omni_base/src/scout_base_node.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "ugv_sdk/mobile_robot/scout_robot.hpp" 9 | #include "ugv_sdk/utilities/protocol_detector.hpp" 10 | #include "scout_mini_omni_base/scout_messenger.hpp" 11 | 12 | using namespace westonrobot; 13 | 14 | std::unique_ptr robot; 15 | 16 | 17 | int main(int argc, char **argv) { 18 | // setup ROS node 19 | ros::init(argc, argv, "scout_odom"); 20 | ros::NodeHandle node(""), private_node("~"); 21 | 22 | // check protocol version 23 | ProtocolDectctor detector; 24 | try 25 | { 26 | detector.Connect("can0"); 27 | auto proto = detector.DetectProtocolVersion(5); 28 | if (proto == ProtocolVersion::AGX_V1) { 29 | std::cout << "Detected protocol: AGX_V1" << std::endl; 30 | robot = std::unique_ptr( 31 | new ScoutMiniOmniRobot(ProtocolVersion::AGX_V1)); 32 | } else if (proto == ProtocolVersion::AGX_V2) { 33 | std::cout << "Detected protocol: AGX_V2" << std::endl; 34 | robot = std::unique_ptr( 35 | new ScoutMiniOmniRobot(ProtocolVersion::AGX_V2)); 36 | } else { 37 | std::cout << "Detected protocol: UNKONWN" << std::endl; 38 | ros::shutdown(); 39 | } 40 | if (robot == nullptr) 41 | std::cout << "Failed to create robot object" << std::endl; 42 | } 43 | catch (std::exception error) 44 | { 45 | ROS_ERROR("please bringup up can or make sure can port exist"); 46 | ros::shutdown(); 47 | } 48 | 49 | 50 | ScoutROSMessenger messenger(robot.get(),&node); 51 | 52 | // fetch parameters before connecting to rt 53 | std::string port_name; 54 | private_node.param("port_name", port_name, std::string("can0")); 55 | private_node.param("odom_frame", messenger.odom_frame_, 56 | std::string("odom")); 57 | private_node.param("base_frame", messenger.base_frame_, 58 | std::string("base_link")); 59 | private_node.param("simulated_robot", messenger.simulated_robot_, 60 | false); 61 | private_node.param("control_rate", messenger.sim_control_rate_, 50); 62 | private_node.param("odom_topic_name", messenger.odom_topic_name_, 63 | std::string("odom")); 64 | 65 | if (!messenger.simulated_robot_) { 66 | // connect to robot and setup ROS subscription 67 | if (port_name.find("can") != std::string::npos) { 68 | robot->Connect(port_name); 69 | robot->EnableCommandedMode(); 70 | ROS_INFO("Using CAN bus to talk with the robot"); 71 | } else { 72 | ROS_INFO("Using UART to talk with the robot"); 73 | } 74 | } 75 | 76 | messenger.SetupSubscription(); 77 | 78 | // publish robot state at 50Hz while listening to twist commands 79 | ros::Rate rate(50); 80 | while (ros::ok()) { 81 | if (!messenger.simulated_robot_) { 82 | 83 | messenger.PublishStateToROS(); 84 | 85 | } else { 86 | double linear, angular, lateral; 87 | 88 | messenger.GetCurrentMotionCmdForSim(linear, angular, lateral); 89 | 90 | messenger.PublishSimStateToROS(linear, angular,lateral); 91 | 92 | } 93 | ros::spinOnce(); 94 | rate.sleep(); 95 | } 96 | 97 | return 0; 98 | } 99 | -------------------------------------------------------------------------------- /scout_mini_omni_base/src/scout_messenger.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * scout_messenger.cpp 3 | * 4 | * Created on: Apr 26, 2019 22:14 5 | * Description: 6 | * 7 | * Copyright (c) 2019 Ruixiang Du (rdu) 8 | */ 9 | 10 | #include "scout_mini_omni_base/scout_messenger.hpp" 11 | 12 | #include 13 | 14 | #include "scout_mini_omni_msgs/ScoutStatus.h" 15 | #include "scout_mini_omni_msgs/ScoutBmsStatus.h" 16 | #include "scout_mini_omni_msgs/ScoutLightCmd.h" 17 | 18 | namespace westonrobot 19 | { 20 | ScoutROSMessenger::ScoutROSMessenger(ros::NodeHandle *nh) 21 | : scout_(nullptr), nh_(nh) {} 22 | 23 | ScoutROSMessenger::ScoutROSMessenger(ScoutMiniOmniRobot *scout, ros::NodeHandle *nh) 24 | : scout_(scout), nh_(nh) {} 25 | 26 | void ScoutROSMessenger::SetupSubscription() 27 | { 28 | // odometry publisher 29 | odom_publisher_ = nh_->advertise(odom_topic_name_, 50); 30 | status_publisher_ = nh_->advertise("/scout_status", 10); 31 | BMS_status_publisher_ = nh_->advertise("/BMS_status", 10); 32 | 33 | // cmd subscriber 34 | motion_cmd_subscriber_ = nh_->subscribe( 35 | "/cmd_vel", 5, &ScoutROSMessenger::TwistCmdCallback, this); 36 | light_cmd_subscriber_ = nh_->subscribe( 37 | "/scout_light_control", 5, &ScoutROSMessenger::LightCmdCallback, this); 38 | } 39 | 40 | void ScoutROSMessenger::TwistCmdCallback( 41 | const geometry_msgs::Twist::ConstPtr &msg) 42 | { 43 | if (!simulated_robot_) 44 | { 45 | scout_->SetMotionCommand(msg->linear.x, msg->angular.z, msg->linear.y); 46 | } 47 | else 48 | { 49 | std::lock_guard guard(twist_mutex_); 50 | current_twist_ = *msg.get(); 51 | } 52 | // ROS_INFO("cmd received:%f, %f", msg->linear.x, msg->angular.z); 53 | } 54 | 55 | void ScoutROSMessenger::GetCurrentMotionCmdForSim(double &linear, 56 | double &angular, 57 | double &lateral) 58 | { 59 | std::lock_guard guard(twist_mutex_); 60 | linear = current_twist_.linear.x; 61 | angular = current_twist_.angular.z; 62 | lateral = current_twist_.linear.y; 63 | } 64 | 65 | void ScoutROSMessenger::LightCmdCallback( 66 | const scout_mini_omni_msgs::ScoutLightCmd::ConstPtr &msg) 67 | { 68 | if (!simulated_robot_) 69 | { 70 | if (msg->enable_cmd_light_control) 71 | { 72 | LightCommandMessage cmd; 73 | 74 | switch (msg->front_mode) 75 | { 76 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_CONST_OFF: 77 | { 78 | cmd.front_light.mode = CONST_OFF; 79 | break; 80 | } 81 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_CONST_ON: 82 | { 83 | cmd.front_light.mode = CONST_ON; 84 | break; 85 | } 86 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_BREATH: 87 | { 88 | cmd.front_light.mode = BREATH; 89 | break; 90 | } 91 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_CUSTOM: 92 | { 93 | cmd.front_light.mode = LightMode::CUSTOM; 94 | cmd.front_light.custom_value = msg->front_custom_value; 95 | break; 96 | } 97 | } 98 | 99 | switch (msg->rear_mode) 100 | { 101 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_CONST_OFF: 102 | { 103 | cmd.rear_light.mode = CONST_OFF; 104 | break; 105 | } 106 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_CONST_ON: 107 | { 108 | cmd.rear_light.mode = CONST_ON; 109 | break; 110 | } 111 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_BREATH: 112 | { 113 | cmd.rear_light.mode = BREATH; 114 | break; 115 | } 116 | case scout_mini_omni_msgs::ScoutLightCmd::LIGHT_CUSTOM: 117 | { 118 | cmd.rear_light.mode = CUSTOM; 119 | cmd.rear_light.custom_value = msg->rear_custom_value; 120 | break; 121 | } 122 | } 123 | 124 | scout_->SetLightCommand(cmd.front_light.mode,cmd.front_light.custom_value,cmd.rear_light.mode,cmd.rear_light.custom_value); 125 | } 126 | else 127 | { 128 | scout_->DisableLightControl(); 129 | } 130 | } 131 | else 132 | { 133 | std::cout << "simulated robot received light control cmd" << std::endl; 134 | } 135 | } 136 | 137 | void ScoutROSMessenger::PublishStateToROS() 138 | { 139 | current_time_ = ros::Time::now(); 140 | double dt = (current_time_ - last_time_).toSec(); 141 | 142 | static bool init_run = true; 143 | if (init_run) 144 | { 145 | last_time_ = current_time_; 146 | init_run = false; 147 | return; 148 | } 149 | 150 | auto robot_state = scout_->GetRobotState(); 151 | auto actuator_state = scout_->GetActuatorState(); 152 | 153 | // publish scout state message 154 | scout_mini_omni_msgs::ScoutStatus status_msg; 155 | scout_mini_omni_msgs::ScoutBmsStatus bms_status; 156 | 157 | status_msg.header.stamp = current_time_; 158 | status_msg.linear_velocity = robot_state.motion_state.linear_velocity; 159 | status_msg.angular_velocity = robot_state.motion_state.angular_velocity; 160 | status_msg.lateral_velocity = robot_state.motion_state.lateral_velocity; 161 | status_msg.base_state = robot_state.system_state.vehicle_state; 162 | status_msg.control_mode = robot_state.system_state.control_mode; 163 | status_msg.fault_code = robot_state.system_state.error_code; 164 | status_msg.battery_voltage = robot_state.system_state.battery_voltage; 165 | status_msg.light_control_enabled = robot_state.light_state.enable_cmd_ctrl; 166 | status_msg.front_light_state.mode = robot_state.light_state.front_light.mode; 167 | status_msg.front_light_state.custom_value = robot_state.light_state.front_light.custom_value; 168 | status_msg.rear_light_state.mode = robot_state.light_state.rear_light.mode; 169 | status_msg.rear_light_state.custom_value = robot_state.light_state.rear_light.custom_value; 170 | if(scout_->GetParserProtocolVersion() == ProtocolVersion::AGX_V1) 171 | { 172 | for (int i = 0; i < 4; ++i) 173 | { 174 | status_msg.motor_states[i].current = actuator_state.actuator_state[i].current; 175 | status_msg.motor_states[i].rpm = actuator_state.actuator_state[i].rpm; 176 | status_msg.motor_states[i].temperature = actuator_state.actuator_state[i].motor_temp; 177 | status_msg.driver_states[i].driver_temperature = actuator_state.actuator_state[i].driver_temp; 178 | } 179 | } 180 | else 181 | { 182 | for (int i = 0; i < 4; ++i) 183 | { 184 | status_msg.motor_states[i].current = actuator_state.actuator_hs_state[i].current; 185 | status_msg.motor_states[i].rpm = actuator_state.actuator_hs_state[i].rpm; 186 | status_msg.motor_states[i].temperature = actuator_state.actuator_ls_state[i].motor_temp; 187 | status_msg.motor_states[i].motor_pose = actuator_state.actuator_hs_state[i].pulse_count; 188 | status_msg.driver_states[i].driver_state = actuator_state.actuator_ls_state[i].driver_state; 189 | status_msg.driver_states[i].driver_voltage = actuator_state.actuator_ls_state[i].driver_voltage; 190 | status_msg.driver_states[i].driver_temperature = actuator_state.actuator_ls_state[i].driver_temp; 191 | } 192 | 193 | 194 | } 195 | 196 | // bms_status.SOC = state.SOC; 197 | // bms_status.SOH = state.SOH; 198 | // bms_status.battery_voltage = state.bms_battery_voltage; 199 | // bms_status.battery_current = state.battery_current; 200 | // bms_status.battery_temperature = state.battery_temperature; 201 | // bms_status.Alarm_Status_1 = state.Alarm_Status_1; 202 | // bms_status.Alarm_Status_2 = state.Alarm_Status_2; 203 | // bms_status.Warning_Status_1 = state.Warning_Status_1; 204 | // bms_status.Warning_Status_2 = state.Warning_Status_2; 205 | BMS_status_publisher_.publish(bms_status); 206 | 207 | 208 | status_publisher_.publish(status_msg); 209 | 210 | 211 | // publish odometry and tf 212 | PublishOdometryToROS(robot_state.motion_state.linear_velocity, robot_state.motion_state.angular_velocity,robot_state.motion_state.lateral_velocity, dt); 213 | 214 | // record time for next integration 215 | last_time_ = current_time_; 216 | } 217 | 218 | void ScoutROSMessenger::PublishSimStateToROS(double linear, double angular, double lateral) 219 | { 220 | current_time_ = ros::Time::now(); 221 | 222 | double dt = (current_time_ - last_time_).toSec(); 223 | 224 | static bool init_run = true; 225 | if (init_run) 226 | { 227 | last_time_ = current_time_; 228 | init_run = false; 229 | return; 230 | } 231 | 232 | // publish scout state message 233 | scout_mini_omni_msgs::ScoutStatus status_msg; 234 | 235 | status_msg.header.stamp = current_time_; 236 | 237 | status_msg.linear_velocity = linear; 238 | status_msg.angular_velocity = angular; 239 | status_msg.lateral_velocity = lateral; 240 | status_msg.base_state = 0x00; 241 | status_msg.control_mode = 0x01; 242 | status_msg.fault_code = 0x00; 243 | status_msg.battery_voltage = 29.5; 244 | status_msg.light_control_enabled = false; 245 | status_publisher_.publish(status_msg); 246 | 247 | // publish odometry and tf 248 | PublishOdometryToROS(linear, angular, lateral, dt); 249 | 250 | // record time for next integration 251 | last_time_ = current_time_; 252 | } 253 | 254 | void ScoutROSMessenger::PublishOdometryToROS(double linear, double angular, 255 | double lateral,double dt) 256 | { 257 | // perform numerical integration to get an estimation of pose 258 | linear_speed_ = linear; 259 | angular_speed_ = angular; 260 | 261 | double d_x = linear_speed_ * std::cos(theta_) * dt; 262 | double d_y = (linear_speed_ * std::sin(theta_) + lateral) * dt; 263 | double d_theta = angular_speed_ * dt; 264 | 265 | position_x_ += d_x; 266 | position_y_ += d_y; 267 | theta_ += d_theta; 268 | 269 | geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(theta_); 270 | 271 | // publish tf transformation 272 | geometry_msgs::TransformStamped tf_msg; 273 | tf_msg.header.stamp = current_time_; 274 | tf_msg.header.frame_id = odom_frame_; 275 | tf_msg.child_frame_id = base_frame_; 276 | 277 | tf_msg.transform.translation.x = position_x_; 278 | tf_msg.transform.translation.y = position_y_; 279 | tf_msg.transform.translation.z = 0.0; 280 | tf_msg.transform.rotation = odom_quat; 281 | 282 | tf_broadcaster_.sendTransform(tf_msg); 283 | 284 | // publish odometry and tf messages 285 | nav_msgs::Odometry odom_msg; 286 | odom_msg.header.stamp = current_time_; 287 | odom_msg.header.frame_id = odom_frame_; 288 | odom_msg.child_frame_id = base_frame_; 289 | 290 | odom_msg.pose.pose.position.x = position_x_; 291 | odom_msg.pose.pose.position.y = position_y_; 292 | odom_msg.pose.pose.position.z = 0.0; 293 | odom_msg.pose.pose.orientation = odom_quat; 294 | 295 | odom_msg.twist.twist.linear.x = linear_speed_; 296 | odom_msg.twist.twist.linear.y = lateral; 297 | odom_msg.twist.twist.angular.z = angular_speed_; 298 | 299 | odom_publisher_.publish(odom_msg); 300 | } 301 | } // namespace westonrobot 302 | -------------------------------------------------------------------------------- /scout_mini_omni_base/src/speed.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | geometry_msgs::Twist speed; 5 | void callback(geometry_msgs::TwistStamped msg) 6 | { 7 | if(msg.twist.linear.x >= 0.3) 8 | msg.twist.linear.x = 0.3; 9 | if(msg.twist.angular.z >= 0.5) 10 | msg.twist.angular.z = 0.5; 11 | speed = msg.twist; 12 | } 13 | int main(int argc, char **argv) 14 | { 15 | 16 | ros::init(argc, argv, "speed"); 17 | ros::NodeHandle n; 18 | ros::Subscriber sub =n.subscribe("/cmd_vel_raw",50,callback); 19 | ros::Publisher pub =n.advertise("/cmd_vel",5); 20 | ros::Rate r(50); 21 | while(ros::ok()) 22 | { 23 | pub.publish(speed); 24 | ros::spinOnce(); 25 | r.sleep(); 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /scout_mini_omni_bringup/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(scout_mini_omni_bringup) 3 | 4 | ## Compile as C++11, supported in ROS Kinetic and newer 5 | # add_compile_options(-std=c++11) 6 | 7 | ## Find catkin macros and libraries 8 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 9 | ## is used, also find other catkin packages 10 | find_package(catkin REQUIRED COMPONENTS 11 | roscpp 12 | rospy 13 | std_msgs 14 | ) 15 | 16 | ## System dependencies are found with CMake's conventions 17 | # find_package(Boost REQUIRED COMPONENTS system) 18 | 19 | 20 | ## Uncomment this if the package has a setup.py. This macro ensures 21 | ## modules and global scripts declared therein get installed 22 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html 23 | # catkin_python_setup() 24 | 25 | ################################################ 26 | ## Declare ROS messages, services and actions ## 27 | ################################################ 28 | 29 | ## To declare and build messages, services or actions from within this 30 | ## package, follow these steps: 31 | ## * Let MSG_DEP_SET be the set of packages whose message types you use in 32 | ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). 33 | ## * In the file package.xml: 34 | ## * add a build_depend tag for "message_generation" 35 | ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET 36 | ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in 37 | ## but can be declared for certainty nonetheless: 38 | ## * add a exec_depend tag for "message_runtime" 39 | ## * In this file (CMakeLists.txt): 40 | ## * add "message_generation" and every package in MSG_DEP_SET to 41 | ## find_package(catkin REQUIRED COMPONENTS ...) 42 | ## * add "message_runtime" and every package in MSG_DEP_SET to 43 | ## catkin_package(CATKIN_DEPENDS ...) 44 | ## * uncomment the add_*_files sections below as needed 45 | ## and list every .msg/.srv/.action file to be processed 46 | ## * uncomment the generate_messages entry below 47 | ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) 48 | 49 | ## Generate messages in the 'msg' folder 50 | # add_message_files( 51 | # FILES 52 | # Message1.msg 53 | # Message2.msg 54 | # ) 55 | 56 | ## Generate services in the 'srv' folder 57 | # add_service_files( 58 | # FILES 59 | # Service1.srv 60 | # Service2.srv 61 | # ) 62 | 63 | ## Generate actions in the 'action' folder 64 | # add_action_files( 65 | # FILES 66 | # Action1.action 67 | # Action2.action 68 | # ) 69 | 70 | ## Generate added messages and services with any dependencies listed here 71 | # generate_messages( 72 | # DEPENDENCIES 73 | # std_msgs 74 | # ) 75 | 76 | ################################################ 77 | ## Declare ROS dynamic reconfigure parameters ## 78 | ################################################ 79 | 80 | ## To declare and build dynamic reconfigure parameters within this 81 | ## package, follow these steps: 82 | ## * In the file package.xml: 83 | ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" 84 | ## * In this file (CMakeLists.txt): 85 | ## * add "dynamic_reconfigure" to 86 | ## find_package(catkin REQUIRED COMPONENTS ...) 87 | ## * uncomment the "generate_dynamic_reconfigure_options" section below 88 | ## and list every .cfg file to be processed 89 | 90 | ## Generate dynamic reconfigure parameters in the 'cfg' folder 91 | # generate_dynamic_reconfigure_options( 92 | # cfg/DynReconf1.cfg 93 | # cfg/DynReconf2.cfg 94 | # ) 95 | 96 | ################################### 97 | ## catkin specific configuration ## 98 | ################################### 99 | ## The catkin_package macro generates cmake config files for your package 100 | ## Declare things to be passed to dependent projects 101 | ## INCLUDE_DIRS: uncomment this if your package contains header files 102 | ## LIBRARIES: libraries you create in this project that dependent projects also need 103 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 104 | ## DEPENDS: system dependencies of this project that dependent projects also need 105 | catkin_package( 106 | # INCLUDE_DIRS include 107 | # LIBRARIES scout_bringup 108 | # CATKIN_DEPENDS roscpp rospy std_msgs 109 | # DEPENDS system_lib 110 | ) 111 | 112 | ########### 113 | ## Build ## 114 | ########### 115 | 116 | ## Specify additional locations of header files 117 | ## Your package locations should be listed before other locations 118 | include_directories( 119 | # include 120 | ${catkin_INCLUDE_DIRS} 121 | ) 122 | 123 | ## Declare a C++ library 124 | # add_library(${PROJECT_NAME} 125 | # src/${PROJECT_NAME}/scout_bringup.cpp 126 | # ) 127 | 128 | ## Add cmake target dependencies of the library 129 | ## as an example, code may need to be generated before libraries 130 | ## either from message generation or dynamic reconfigure 131 | # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 132 | 133 | ## Declare a C++ executable 134 | ## With catkin_make all packages are built within a single CMake context 135 | ## The recommended prefix ensures that target names across packages don't collide 136 | # add_executable(${PROJECT_NAME}_node src/scout_bringup_node.cpp) 137 | 138 | ## Rename C++ executable without prefix 139 | ## The above recommended prefix causes long target names, the following renames the 140 | ## target back to the shorter version for ease of user use 141 | ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" 142 | # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") 143 | 144 | ## Add cmake target dependencies of the executable 145 | ## same as for the library above 146 | # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 147 | 148 | ## Specify libraries to link a library or executable target against 149 | # target_link_libraries(${PROJECT_NAME}_node 150 | # ${catkin_LIBRARIES} 151 | # ) 152 | 153 | ############# 154 | ## Install ## 155 | ############# 156 | 157 | install(DIRECTORY launch scripts 158 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) 159 | 160 | 161 | # all install targets should use catkin DESTINATION variables 162 | # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html 163 | 164 | ## Mark executable scripts (Python etc.) for installation 165 | ## in contrast to setup.py, you can choose the destination 166 | # install(PROGRAMS 167 | # scripts/my_python_script 168 | # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 169 | # ) 170 | 171 | ## Mark executables and/or libraries for installation 172 | # install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node 173 | # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 174 | # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 175 | # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 176 | # ) 177 | 178 | ## Mark cpp header files for installation 179 | # install(DIRECTORY include/${PROJECT_NAME}/ 180 | # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 181 | # FILES_MATCHING PATTERN "*.h" 182 | # PATTERN ".svn" EXCLUDE 183 | # ) 184 | 185 | ## Mark other files for installation (e.g. launch and bag files, etc.) 186 | # install(FILES 187 | # # myfile1 188 | # # myfile2 189 | # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 190 | # ) 191 | 192 | ############# 193 | ## Testing ## 194 | ############# 195 | 196 | ## Add gtest based cpp test target and link libraries 197 | # catkin_add_gtest(${PROJECT_NAME}-test test/test_scout_bringup.cpp) 198 | # if(TARGET ${PROJECT_NAME}-test) 199 | # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) 200 | # endif() 201 | 202 | ## Add folders to be run by python nosetests 203 | # catkin_add_nosetests(test) 204 | -------------------------------------------------------------------------------- /scout_mini_omni_bringup/launch/scout_robot_base.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /scout_mini_omni_bringup/launch/scout_teleop_keyboard.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /scout_mini_omni_bringup/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | scout_mini_omni_bringup 4 | 0.0.0 5 | The scout_bringup package 6 | 7 | 8 | 9 | 10 | rdu 11 | 12 | 13 | 14 | 15 | 16 | TODO 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | catkin 52 | roscpp 53 | rospy 54 | std_msgs 55 | roscpp 56 | rospy 57 | std_msgs 58 | roscpp 59 | rospy 60 | std_msgs 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /scout_mini_omni_bringup/scripts/bringup_can2usb.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # bring up can interface 4 | sudo ip link set can0 up type can bitrate 500000 -------------------------------------------------------------------------------- /scout_mini_omni_bringup/scripts/setup_can2usb.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # enable kernel module: gs_usb 4 | sudo modprobe gs_usb 5 | 6 | # bring up can interface 7 | sudo ip link set can0 up type can bitrate 500000 8 | 9 | # install can utils 10 | sudo apt install -y can-utils -------------------------------------------------------------------------------- /scout_mini_omni_msgs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for package scout_msgs 2 | 3 | ## 0.0.1 (2019-06-14) 4 | ------------------ 5 | * Initial development of scout_msgs for Scout 6 | * Contributors: Ruixiang Du 7 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | cmake_minimum_required(VERSION 2.8.3) 4 | project(scout_mini_omni_msgs) 5 | 6 | ## Compile as C++11, supported in ROS Kinetic and newer 7 | # add_compile_options(-std=c++11) 8 | 9 | ## Find catkin macros and libraries 10 | find_package(catkin REQUIRED COMPONENTS 11 | std_msgs 12 | message_generation 13 | ) 14 | 15 | ## System dependencies are found with CMake's conventions 16 | # find_package(Boost REQUIRED COMPONENTS system) 17 | 18 | ## Uncomment this if the package has a setup.py. This macro ensures 19 | ## modules and global scripts declared therein get installed 20 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html 21 | # catkin_python_setup() 22 | 23 | ################################################ 24 | ## Declare ROS messages, services and actions ## 25 | ################################################ 26 | 27 | ## To declare and build messages, services or actions from within this 28 | ## package, follow these steps: 29 | ## * Let MSG_DEP_SET be the set of packages whose message types you use in 30 | ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). 31 | ## * In the file package.xml: 32 | ## * add a build_depend tag for "message_generation" 33 | ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET 34 | ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in 35 | ## but can be declared for certainty nonetheless: 36 | ## * add a exec_depend tag for "message_runtime" 37 | ## * In this file (CMakeLists.txt): 38 | ## * add "message_generation" and every package in MSG_DEP_SET to 39 | ## find_package(catkin REQUIRED COMPONENTS ...) 40 | ## * add "message_runtime" and every package in MSG_DEP_SET to 41 | ## catkin_package(CATKIN_DEPENDS ...) 42 | ## * uncomment the add_*_files sections below as needed 43 | ## and list every .msg/.srv/.action file to be processed 44 | ## * uncomment the generate_messages entry below 45 | ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) 46 | 47 | ## Generate messages in the 'msg' folder 48 | add_message_files( 49 | FILES 50 | ScoutStatus.msg 51 | ScoutMotorState.msg 52 | ScoutLightState.msg 53 | ScoutLightCmd.msg 54 | ScoutBmsStatus.msg 55 | ScoutDriverState.msg 56 | ) 57 | 58 | 59 | ## Generate services in the 'srv' folder 60 | # add_service_files( 61 | # FILES 62 | # Service1.srv 63 | # Service2.srv 64 | # ) 65 | 66 | ## Generate actions in the 'action' folder 67 | # add_action_files( 68 | # FILES 69 | # Action1.action 70 | # Action2.action 71 | # ) 72 | 73 | ## Generate added messages and services with any dependencies listed here 74 | generate_messages( 75 | DEPENDENCIES 76 | std_msgs 77 | ) 78 | 79 | catkin_package(CATKIN_DEPENDS std_msgs message_runtime) 80 | 81 | ################################################ 82 | ## Declare ROS dynamic reconfigure parameters ## 83 | ################################################ 84 | 85 | ## To declare and build dynamic reconfigure parameters within this 86 | ## package, follow these steps: 87 | ## * In the file package.xml: 88 | ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" 89 | ## * In this file (CMakeLists.txt): 90 | ## * add "dynamic_reconfigure" to 91 | ## find_package(catkin REQUIRED COMPONENTS ...) 92 | ## * uncomment the "generate_dynamic_reconfigure_options" section below 93 | ## and list every .cfg file to be processed 94 | 95 | ## Generate dynamic reconfigure parameters in the 'cfg' folder 96 | # generate_dynamic_reconfigure_options( 97 | # cfg/DynReconf1.cfg 98 | # cfg/DynReconf2.cfg 99 | # ) 100 | 101 | ################################### 102 | ## catkin specific configuration ## 103 | ################################### 104 | ## The catkin_package macro generates cmake config files for your package 105 | ## Declare things to be passed to dependent projects 106 | ## INCLUDE_DIRS: uncomment this if your package contains header files 107 | ## LIBRARIES: libraries you create in this project that dependent projects also need 108 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 109 | ## DEPENDS: system dependencies of this project that dependent projects also need 110 | catkin_package( 111 | # INCLUDE_DIRS include 112 | # LIBRARIES scout_python 113 | # CATKIN_DEPENDS rospy scout_msgs std_msgs 114 | # DEPENDS system_lib 115 | ) 116 | 117 | ########### 118 | ## Build ## 119 | ########### 120 | 121 | ## Specify additional locations of header files 122 | ## Your package locations should be listed before other locations 123 | include_directories( 124 | # include 125 | ${catkin_INCLUDE_DIRS} 126 | ) 127 | 128 | ## Declare a C++ library 129 | # add_library(${PROJECT_NAME} 130 | # src/${PROJECT_NAME}/scout_python.cpp 131 | # ) 132 | 133 | ## Add cmake target dependencies of the library 134 | ## as an example, code may need to be generated before libraries 135 | ## either from message generation or dynamic reconfigure 136 | # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 137 | 138 | ## Declare a C++ executable 139 | ## With catkin_make all packages are built within a single CMake context 140 | ## The recommended prefix ensures that target names across packages don't collide 141 | # add_executable(${PROJECT_NAME}_node src/scout_python_node.cpp) 142 | 143 | ## Rename C++ executable without prefix 144 | ## The above recommended prefix causes long target names, the following renames the 145 | ## target back to the shorter version for ease of user use 146 | ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" 147 | # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") 148 | 149 | ## Add cmake target dependencies of the executable 150 | ## same as for the library above 151 | # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 152 | 153 | ## Specify libraries to link a library or executable target against 154 | # target_link_libraries(${PROJECT_NAME}_node 155 | # ${catkin_LIBRARIES} 156 | # ) 157 | 158 | ############# 159 | ## Install ## 160 | ############# 161 | 162 | # all install targets should use catkin DESTINATION variables 163 | # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html 164 | 165 | ## Mark executable scripts (Python etc.) for installation 166 | ## in contrast to setup.py, you can choose the destination 167 | # install(PROGRAMS 168 | # scripts/my_python_script 169 | # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 170 | # ) 171 | 172 | ## Mark executables and/or libraries for installation 173 | # install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node 174 | # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 175 | # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 176 | # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 177 | # ) 178 | 179 | ## Mark cpp header files for installation 180 | # install(DIRECTORY include/${PROJECT_NAME}/ 181 | # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 182 | # FILES_MATCHING PATTERN "*.h" 183 | # PATTERN ".svn" EXCLUDE 184 | # ) 185 | 186 | ## Mark other files for installation (e.g. launch and bag files, etc.) 187 | # install(FILES 188 | # # myfile1 189 | # # myfile2 190 | # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 191 | # ) 192 | 193 | ############# 194 | ## Testing ## 195 | ############# 196 | 197 | ## Add gtest based cpp test target and link libraries 198 | # catkin_add_gtest(${PROJECT_NAME}-test test/test_scout_python.cpp) 199 | # if(TARGET ${PROJECT_NAME}-test) 200 | # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) 201 | # endif() 202 | 203 | ## Add folders to be run by python nosetests 204 | # catkin_add_nosetests(test) 205 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/msg/ScoutBmsStatus.msg: -------------------------------------------------------------------------------- 1 | #BMS date 2 | float64 SOC 3 | float64 SOH 4 | float64 battery_voltage 5 | float64 battery_current 6 | float64 battery_temperature 7 | 8 | #BMS status 9 | uint8 Alarm_Status_1 10 | uint8 Alarm_Status_2 11 | uint8 Warning_Status_1 12 | uint8 Warning_Status_2 13 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/msg/ScoutDriverState.msg: -------------------------------------------------------------------------------- 1 | float64 driver_voltage 2 | float64 driver_temperature 3 | uint8 driver_state 4 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/msg/ScoutLightCmd.msg: -------------------------------------------------------------------------------- 1 | uint8 LIGHT_CONST_OFF = 0 2 | uint8 LIGHT_CONST_ON = 1 3 | uint8 LIGHT_BREATH = 2 4 | uint8 LIGHT_CUSTOM = 3 5 | 6 | bool enable_cmd_light_control 7 | uint8 front_mode 8 | uint8 front_custom_value 9 | uint8 rear_mode 10 | uint8 rear_custom_value 11 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/msg/ScoutLightState.msg: -------------------------------------------------------------------------------- 1 | uint8 mode 2 | uint8 custom_value -------------------------------------------------------------------------------- /scout_mini_omni_msgs/msg/ScoutMotorState.msg: -------------------------------------------------------------------------------- 1 | float64 current 2 | float64 rpm 3 | float64 temperature 4 | float64 motor_pose 5 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/msg/ScoutStatus.msg: -------------------------------------------------------------------------------- 1 | Header header 2 | 3 | int8 MOTOR_ID_FRONT_RIGHT = 0 4 | int8 MOTOR_ID_FRONT_LEFT = 1 5 | int8 MOTOR_ID_REAR_RIGHT = 2 6 | int8 MOTOR_ID_REAR_LEFT = 3 7 | 8 | int8 LIGHT_ID_FRONT = 0 9 | int8 LIGHT_ID_REAR = 1 10 | 11 | # motion state 12 | float64 linear_velocity 13 | float64 angular_velocity 14 | float64 lateral_velocity 15 | 16 | # base state 17 | uint8 base_state 18 | uint8 control_mode 19 | uint16 fault_code 20 | float64 battery_voltage 21 | 22 | # motor state 23 | ScoutMotorState[4] motor_states 24 | # driver state 25 | ScoutDriverState[4] driver_states 26 | 27 | # light state 28 | bool light_control_enabled 29 | ScoutLightState front_light_state 30 | ScoutLightState rear_light_state 31 | -------------------------------------------------------------------------------- /scout_mini_omni_msgs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | scout_mini_omni_msgs 4 | 0.3.3 5 | Messages for AgileX Scout 6 | 7 | TODO 8 | 9 | TODO 10 | TODO 11 | 12 | BSD 13 | 14 | TODO 15 | TODO 16 | TODO 17 | 18 | catkin 19 | message_generation 20 | std_msgs 21 | message_runtime 22 | std_msgs 23 | 24 | 25 | 26 | 27 | --------------------------------------------------------------------------------