├── LICENSE
├── README-ZH.md
├── README.md
├── bunker_base
├── CMakeLists.txt
├── include
│ └── bunker_base
│ │ ├── bunker_messenger.hpp
│ │ └── bunker_params.hpp
├── launch
│ └── bunker_base.launch
├── package.xml
├── rviz
│ └── model_display.rviz
└── src
│ ├── bunker_base_node.cpp
│ └── bunker_messenger.cpp
├── bunker_bringup
├── CMakeLists.txt
├── launch
│ ├── bunker_robot_base.launch
│ └── bunker_teleop_keyboard.launch
├── package.xml
└── scripts
│ ├── bringup_can2usb.bash
│ └── setup_can2usb.bash
└── bunker_msgs
├── CHANGELOG.md
├── CMakeLists.txt
├── msg
├── BunkerMotorState.msg
├── BunkerRsStatus.msg
└── BunkerStatus.msg
└── package.xml
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2020, WestonRobot
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README-ZH.md:
--------------------------------------------------------------------------------
1 | # 松灵机器人产品BUNKER 的ROS package
2 |
3 | ## ROS Packages 说明
4 |
5 | * bunker_bringup: launch and configuration files to start ROS nodes
6 | * bunker_base: a ROS wrapper around Bunker SDK to monitor and control the robot
7 | * bunker_msgs: bunker related message definitions
8 | * (bunker_ros: meta package for the Bunker 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. 将bunker 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/bunker_ros.git
88 | $ cd ..
89 | $ catkin_make
90 | ```
91 |
92 | 3. 启动 ROS nodes
93 |
94 | * 开始 the base node
95 |
96 | ```
97 | $ roslaunch bunker_bringup bunker_minimal.launch
98 | ```
99 |
100 | * Start the keyboard tele-op node
101 |
102 | ```
103 | $ roslaunch bunker_bringup bunker_teleop_keyboard.launch
104 | ```
105 |
106 | **SAFETY PRECAUSION**:
107 |
108 | 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.
109 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ROS Packages for Bunker Mobile Robot
2 |
3 | ## Packages
4 |
5 | This repository contains minimal packages to control the bunker robot using ROS.
6 |
7 | * bunker_bringup: launch and configuration files to start ROS nodes
8 | * bunker_base: a ROS wrapper around [ugv_sdk](https://github.com/agilexrobotics/ugv_sdk) to monitor and control the bunker robot
9 | * bunker_msgs: bunker related message definitions
10 |
11 | ## Supported Hardware
12 |
13 | * bunker
14 | * bunker_mini
15 | * bunker pro
16 |
17 | ### Update the packages for your customized robot
18 |
19 | **Additional sensors**
20 |
21 | It's likely that you may want to add additional sensors to the bunker 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.
22 |
23 | A [sample](bunker_description/sample/bunker_v2_nav.xacro) ".xacro" file is present in this repository, in which the base ".xacro" file of an empty bunker platform is first included, and then additional links are defined.
24 |
25 | The nodes in this ROS package are made to handle only the control of the bunker base and publishing of the status. Additional nodes may need to be created by the user to handle the sensors.
26 |
27 | **Alternative odometry calculation**
28 |
29 | By default the bunker_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.
30 |
31 | ```
32 | $ bunker_bringup bunker_minimal.launch odom_topic_name:=""
33 | ```
34 |
35 | ## Communication interface setup
36 |
37 | Please refer to the [README](https://github.com/agilexrobotics/ugv_sdk_sdk#hardware-interface) of "ugv_sdk" package for setup of communication interfaces.
38 |
39 | #### Note on CAN interface on Nvidia Jetson Platforms
40 |
41 | 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.
42 |
43 | ## Basic usage of the ROS packages
44 |
45 | 1. Install dependent libraries
46 |
47 | ```
48 | $ sudo apt install -y ros-$ROS_DISTRO-teleop-twist-keyboard
49 | ```
50 |
51 | 2. Clone the packages into your catkin workspace and compile
52 |
53 | (the following instructions assume your catkin workspace is at: ~/catkin_ws/src)
54 |
55 | ```
56 | $ cd ~/catkin_ws/src
57 | $ git clone https://github.com/agilexrobotics/ugv_sdk.git
58 | $ git clone https://github.com/agilexrobotics/bunker_ros.git
59 | $ cd ..
60 | $ catkin_make
61 | ```
62 |
63 | 3. Setup CAN-To-USB adapter
64 |
65 | * Enable gs_usb kernel module(If you have already added this module, you do not need to add it)
66 | ```
67 | $ sudo modprobe gs_usb
68 | ```
69 |
70 | * first time use bunker-ros package
71 | ```
72 | $ rosrun bunker_bringup setup_can2usb.bash
73 | ```
74 |
75 | * if not the first time use bunker-ros package(Run this command every time you turn off the power)
76 | ```
77 | $ rosrun bunker_bringup bringup_can2usb.bash
78 | ```
79 |
80 | * Testing command
81 | ```
82 | # receiving data from can0
83 | $ candump can0
84 | ```
85 |
86 | 4. Launch ROS nodes
87 |
88 | * Start the base node for the real robot
89 |
90 | ```
91 | $ roslaunch bunker_bringup bunker_robot_base.launch
92 | ```
93 |
94 | The [bunker_bringup/bunker_robot_base.launch](bunker_bringup/launch/bunker_robot_base.launch) has 4 parameters:
95 |
96 | - port_name: specifies the port used to communicate with the robot, default = "can0"
97 |
98 | - odom_topic_name: sets the name of the topic which calculated odometry is published to, defaults = "odom"
99 |
100 |
101 |
102 | * Start the keyboard tele-op node
103 |
104 | ```
105 | $ roslaunch bunker_bringup bunker_teleop_keyboard.launch
106 | ```
107 |
108 | **SAFETY PRECAUSION**:
109 |
110 | 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.
111 |
--------------------------------------------------------------------------------
/bunker_base/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(bunker_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 | bunker_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 bunker_messenger
28 | CATKIN_DEPENDS ugv_sdk bunker_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(bunker_messenger STATIC src/bunker_messenger.cpp)
44 | target_link_libraries(bunker_messenger ${catkin_LIBRARIES})
45 | add_dependencies(bunker_messenger ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
46 |
47 | add_executable(bunker_base_node src/bunker_base_node.cpp)
48 | target_link_libraries(bunker_base_node bunker_messenger ${catkin_LIBRARIES})
49 |
50 | #############
51 | ## Install ##
52 | #############
53 |
54 | install(TARGETS bunker_messenger bunker_base_node
55 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
56 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
57 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
58 |
59 | install(DIRECTORY include/${PROJECT_NAME}/
60 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
61 |
62 | install(DIRECTORY launch
63 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
64 |
--------------------------------------------------------------------------------
/bunker_base/include/bunker_base/bunker_messenger.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * bunker_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 BUNKER_MESSENGER_HPP
11 | #define BUNKER_MESSENGER_HPP
12 |
13 | #include
14 |
15 | #include
16 | #include
17 | // #include
18 | #include
19 |
20 | #include "ugv_sdk/mobile_robot/bunker_robot.hpp"
21 | #include
22 |
23 | namespace westonrobot
24 | {
25 | class BunkerROSMessenger
26 | {
27 | public:
28 | explicit BunkerROSMessenger(ros::NodeHandle *nh);
29 | BunkerROSMessenger(BunkerRobot *bunker, ros::NodeHandle *nh);
30 |
31 | std::string odom_frame_;
32 | std::string base_frame_;
33 | std::string odom_topic_name_;
34 | bool pub_tf_;
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);
43 |
44 | void GetCurrentMotionCmdForSim(double &linear, double &angular);
45 |
46 | private:
47 | BunkerRobot *bunker_;
48 | ros::NodeHandle *nh_;
49 |
50 | std::mutex twist_mutex_;
51 | geometry_msgs::Twist current_twist_;
52 |
53 | ros::Publisher odom_publisher_;
54 | ros::Publisher status_publisher_;
55 | ros::Publisher rs_status_publisher_;
56 | ros::Subscriber motion_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 PublishOdometryToROS(double linear, double angular, double dt);
71 | };
72 | } // namespace westonrobot
73 |
74 | #endif /* BUNKER_MESSENGER_HPP */
75 |
--------------------------------------------------------------------------------
/bunker_base/include/bunker_base/bunker_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 BUNKER_PARAMS_HPP
11 | #define BUNKER_PARAMS_HPP
12 |
13 | namespace westonrobot
14 | {
15 | struct BunkerParams
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 /* BUNKER_PARAMS_HPP */
34 |
--------------------------------------------------------------------------------
/bunker_base/launch/bunker_base.launch:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/bunker_base/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | bunker_base
4 | 0.3.3
5 | AgileX Bunker robot driver
6 |
7 | Ruixiang Du
8 | WestonRobot
9 |
10 | BSD
11 |
12 | TODO
13 | TODO
14 | TODO
15 |
16 | catkin
17 | bunker_msgs
18 | roscpp
19 | roslaunch
20 | sensor_msgs
21 | ugv_sdk
22 | controller_manager
23 | geometry_msgs
24 | bunker_msgs
25 | roscpp
26 | sensor_msgs
27 | topic_tools
28 | ugv_sdk
29 |
30 |
31 |
--------------------------------------------------------------------------------
/bunker_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 |
--------------------------------------------------------------------------------
/bunker_base/src/bunker_base_node.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include "ugv_sdk/utilities/protocol_detector.hpp"
9 | #include "ugv_sdk/mobile_robot/bunker_robot.hpp"
10 | //#include "ugv_sdk/bunker/bunker_base.hpp"
11 | #include "bunker_base/bunker_messenger.hpp"
12 |
13 | using namespace westonrobot;
14 |
15 | std::shared_ptr robot;
16 |
17 | void DetachRobot(int signal) {
18 | // robot->Disconnect();
19 | // robot->Terminate();
20 | // robot->DisableLightControl();
21 | }
22 |
23 | int main(int argc, char **argv) {
24 | // setup ROS node
25 | ros::init(argc, argv, "bunker_odom");
26 | ros::NodeHandle node(""), private_node("~");
27 |
28 | std::signal(SIGINT, DetachRobot);
29 |
30 | // check wether controlling bunker mini
31 | bool is_bunker_mini = false;
32 | private_node.param("is_bunker_mini", is_bunker_mini, false);
33 | std::cout << "Working as bunker mini: " << is_bunker_mini << std::endl;
34 |
35 | // instantiate a robot object
36 | std::unique_ptr bunker;
37 | //robot = std::make_shared(is_bunker_mini);
38 | ProtocolDetector detector;
39 | try
40 | {
41 | detector.Connect("can0");
42 | auto proto = detector.DetectProtocolVersion(5);
43 | if (proto == ProtocolVersion::AGX_V1) {
44 | std::cout << "Detected protocol: AGX_V1" << std::endl;
45 | bunker = std::unique_ptr(
46 | new BunkerRobot(ProtocolVersion::AGX_V1));
47 | }
48 | else if (proto == ProtocolVersion::AGX_V2)
49 | {
50 | std::cout << "Detected protocol: AGX_V2" << std::endl;
51 | bunker = std::unique_ptr(
52 | new BunkerRobot(ProtocolVersion::AGX_V2));
53 | }
54 | else
55 | {
56 | std::cout << "Detected protocol: UNKONWN" << std::endl;
57 | return -1;
58 | }
59 | if (bunker == nullptr)
60 | std::cout << "Failed to create robot object" << std::endl;
61 | }
62 | catch (std::exception error)
63 | {
64 | ROS_ERROR("please bringup up can or make sure can port exist");
65 | ros::shutdown();
66 | }
67 |
68 |
69 | BunkerROSMessenger messenger(bunker.get(), &node);
70 |
71 | // fetch parameters before connecting to robot
72 | std::string port_name;
73 | private_node.param("port_name", port_name, std::string("can0"));
74 | private_node.param("odom_frame", messenger.odom_frame_,
75 | std::string("odom"));
76 | private_node.param("base_frame", messenger.base_frame_,
77 | std::string("base_link"));
78 | private_node.param("simulated_robot", messenger.simulated_robot_,
79 | false);
80 | private_node.param("control_rate", messenger.sim_control_rate_, 50);
81 | private_node.param("odom_topic_name", messenger.odom_topic_name_,
82 | std::string("odom"));
83 | private_node.param("pub_tf", messenger.pub_tf_,
84 | true);
85 |
86 | if (!messenger.simulated_robot_) {
87 | // connect to robot and setup ROS subscription
88 | if (port_name.find("can") != std::string::npos) {
89 | bunker->Connect(port_name);
90 | bunker->EnableCommandedMode();
91 | ROS_INFO("Using CAN bus to talk with the robot");
92 | } else {
93 | ROS_INFO("Using UART to talk with the robot");
94 | }
95 | }
96 | messenger.SetupSubscription();
97 |
98 | // publish robot state at 50Hz while listening to twist commands
99 | ros::Rate rate(50);
100 | while (true) {
101 | if (!messenger.simulated_robot_) {
102 | messenger.PublishStateToROS();
103 | } else {
104 | double linear, angular;
105 | messenger.GetCurrentMotionCmdForSim(linear, angular);
106 | messenger.PublishSimStateToROS(linear, angular);
107 | }
108 | ros::spinOnce();
109 | rate.sleep();
110 | }
111 |
112 | return 0;
113 | }
114 |
--------------------------------------------------------------------------------
/bunker_base/src/bunker_messenger.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * bunker_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 "bunker_base/bunker_messenger.hpp"
11 |
12 | #include
13 |
14 | #include "bunker_msgs/BunkerStatus.h"
15 | //#include "bunker_msgs/BunkerLightCmd.h"
16 | #include "bunker_msgs/BunkerRsStatus.h"
17 |
18 | namespace westonrobot
19 | {
20 | BunkerROSMessenger::BunkerROSMessenger(ros::NodeHandle *nh)
21 | : bunker_(nullptr), nh_(nh) {}
22 |
23 | BunkerROSMessenger::BunkerROSMessenger(BunkerRobot *bunker, ros::NodeHandle *nh)
24 | : bunker_(bunker), nh_(nh) {}
25 |
26 | void BunkerROSMessenger::SetupSubscription()
27 | {
28 | // odometry publisher
29 | odom_publisher_ = nh_->advertise(odom_topic_name_, 50);
30 | status_publisher_ = nh_->advertise("/bunker_status", 10);
31 | rs_status_publisher_ = nh_->advertise("/rs_status",10);
32 |
33 | // cmd subscriber
34 | motion_cmd_subscriber_ = nh_->subscribe(
35 | "/cmd_vel", 5, &BunkerROSMessenger::TwistCmdCallback, this);
36 |
37 | }
38 |
39 | void BunkerROSMessenger::TwistCmdCallback(
40 | const geometry_msgs::Twist::ConstPtr &msg)
41 | {
42 | if (!simulated_robot_)
43 | {
44 | bunker_->SetMotionCommand(msg->linear.x, msg->angular.z);
45 | }
46 | else
47 | {
48 | std::lock_guard guard(twist_mutex_);
49 | current_twist_ = *msg.get();
50 | }
51 | // ROS_INFO("cmd received:%f, %f", msg->linear.x, msg->angular.z);
52 | }
53 |
54 | void BunkerROSMessenger::GetCurrentMotionCmdForSim(double &linear,
55 | double &angular)
56 | {
57 | std::lock_guard guard(twist_mutex_);
58 | linear = current_twist_.linear.x;
59 | angular = current_twist_.angular.z;
60 | }
61 |
62 |
63 |
64 | void BunkerROSMessenger::PublishStateToROS()
65 | {
66 | current_time_ = ros::Time::now();
67 | double dt = (current_time_ - last_time_).toSec();
68 |
69 | static bool init_run = true;
70 | if (init_run)
71 | {
72 | last_time_ = current_time_;
73 | init_run = false;
74 | return;
75 | }
76 |
77 | //auto state = bunker_->GetBunkerState();
78 | auto robot_state = bunker_->GetRobotState();
79 | auto actuator_state = bunker_->GetActuatorState();
80 | // publish bunker state message
81 | bunker_msgs::BunkerStatus status_msg;
82 | bunker_msgs::BunkerRsStatus rs_status_msg;
83 |
84 | status_msg.header.stamp = current_time_;
85 |
86 | status_msg.linear_velocity = robot_state.motion_state.linear_velocity;
87 | status_msg.angular_velocity = robot_state.motion_state.angular_velocity;
88 | status_msg.base_state = robot_state.system_state.vehicle_state;
89 | status_msg.control_mode = robot_state.system_state.control_mode;
90 | status_msg.fault_code = robot_state.system_state.error_code;
91 | status_msg.battery_voltage = robot_state.system_state.battery_voltage;
92 |
93 | rs_status_msg.header.stamp = current_time_;
94 | rs_status_msg.stick_left_h = robot_state.rc_state.stick_left_h;
95 | rs_status_msg.stick_left_v = robot_state.rc_state.stick_left_v;
96 | rs_status_msg.stick_right_h = robot_state.rc_state.stick_right_h;
97 | rs_status_msg.stick_right_v = robot_state.rc_state.stick_right_v;
98 |
99 | rs_status_msg.swa = robot_state.rc_state.swa;
100 | rs_status_msg.swb = robot_state.rc_state.swb;
101 | rs_status_msg.swc = robot_state.rc_state.swc;
102 | rs_status_msg.swd = robot_state.rc_state.swd;
103 |
104 | rs_status_msg.var_a = robot_state.rc_state.var_a;
105 |
106 | if(bunker_->GetParserProtocolVersion() == ProtocolVersion::AGX_V1)
107 | {
108 | for (int i = 0; i < 2; ++i)
109 | {
110 | status_msg.motor_states[i].current = actuator_state.actuator_state[i].current;
111 | status_msg.motor_states[i].rpm = actuator_state.actuator_state[i].rpm;
112 | status_msg.motor_states[i].temperature = actuator_state.actuator_state[i].motor_temp;
113 | }
114 | }
115 | else
116 | {
117 | for (int i = 0; i < 2; ++i)
118 | {
119 | status_msg.motor_states[i].current = actuator_state.actuator_hs_state[i].current;
120 | status_msg.motor_states[i].rpm = actuator_state.actuator_hs_state[i].rpm;
121 | status_msg.motor_states[i].temperature = actuator_state.actuator_ls_state[i].motor_temp;
122 | }
123 |
124 |
125 | }
126 | status_publisher_.publish(status_msg);
127 | rs_status_publisher_.publish(rs_status_msg);
128 |
129 |
130 | // publish odometry and tf
131 | PublishOdometryToROS(robot_state.motion_state.linear_velocity, robot_state.motion_state.angular_velocity, dt);
132 |
133 | // record time for next integration
134 | last_time_ = current_time_;
135 | }
136 |
137 | void BunkerROSMessenger::PublishSimStateToROS(double linear, double angular)
138 | {
139 | current_time_ = ros::Time::now();
140 |
141 | double dt = (current_time_ - last_time_).toSec();
142 |
143 | static bool init_run = true;
144 | if (init_run)
145 | {
146 | last_time_ = current_time_;
147 | init_run = false;
148 | return;
149 | }
150 |
151 | // publish bunker state message
152 | bunker_msgs::BunkerStatus status_msg;
153 | status_msg.header.stamp = current_time_;
154 | status_msg.linear_velocity = linear;
155 | status_msg.angular_velocity = angular;
156 | status_msg.base_state = 0x00;
157 | status_msg.control_mode = 0x01;
158 | status_msg.fault_code = 0x00;
159 | status_msg.battery_voltage = 29.5;
160 | status_publisher_.publish(status_msg);
161 |
162 | // publish odometry and tf
163 | PublishOdometryToROS(linear, angular, dt);
164 |
165 | // record time for next integration
166 | last_time_ = current_time_;
167 | }
168 |
169 | void BunkerROSMessenger::PublishOdometryToROS(double linear, double angular,
170 | double dt)
171 | {
172 | // perform numerical integration to get an estimation of pose
173 | linear_speed_ = linear;
174 | angular_speed_ = angular;
175 |
176 | double d_x = linear_speed_ * std::cos(theta_) * dt;
177 | double d_y = linear_speed_ * std::sin(theta_) * dt;
178 | double d_theta = angular_speed_ * dt;
179 |
180 | position_x_ += d_x;
181 | position_y_ += d_y;
182 | theta_ += d_theta;
183 |
184 | geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(theta_);
185 |
186 | // publish tf transformation
187 | geometry_msgs::TransformStamped tf_msg;
188 | tf_msg.header.stamp = current_time_;
189 | tf_msg.header.frame_id = odom_frame_;
190 | tf_msg.child_frame_id = base_frame_;
191 |
192 | tf_msg.transform.translation.x = position_x_;
193 | tf_msg.transform.translation.y = position_y_;
194 | tf_msg.transform.translation.z = 0.0;
195 | tf_msg.transform.rotation = odom_quat;
196 |
197 | if(pub_tf_)tf_broadcaster_.sendTransform(tf_msg);
198 |
199 | // publish odometry and tf messages
200 | nav_msgs::Odometry odom_msg;
201 | odom_msg.header.stamp = current_time_;
202 | odom_msg.header.frame_id = odom_frame_;
203 | odom_msg.child_frame_id = base_frame_;
204 |
205 | odom_msg.pose.pose.position.x = position_x_;
206 | odom_msg.pose.pose.position.y = position_y_;
207 | odom_msg.pose.pose.position.z = 0.0;
208 | odom_msg.pose.pose.orientation = odom_quat;
209 |
210 | odom_msg.twist.twist.linear.x = linear_speed_;
211 | odom_msg.twist.twist.linear.y = 0.0;
212 | odom_msg.twist.twist.angular.z = angular_speed_;
213 |
214 | odom_publisher_.publish(odom_msg);
215 | }
216 | } // namespace westonrobot
217 |
--------------------------------------------------------------------------------
/bunker_bringup/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(bunker_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 bunker_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}/bunker_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/bunker_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_bunker_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 |
--------------------------------------------------------------------------------
/bunker_bringup/launch/bunker_robot_base.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/bunker_bringup/launch/bunker_teleop_keyboard.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/bunker_bringup/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | bunker_bringup
4 | 0.0.0
5 | The bunker_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 |
--------------------------------------------------------------------------------
/bunker_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
--------------------------------------------------------------------------------
/bunker_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
--------------------------------------------------------------------------------
/bunker_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 |
--------------------------------------------------------------------------------
/bunker_msgs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake_minimum_required(VERSION 2.8.3)
4 | project(bunker_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 | BunkerStatus.msg
51 | BunkerMotorState.msg
52 | BunkerRsStatus.msg
53 | )
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 | catkin_package(CATKIN_DEPENDS std_msgs message_runtime)
77 |
78 | ################################################
79 | ## Declare ROS dynamic reconfigure parameters ##
80 | ################################################
81 |
82 | ## To declare and build dynamic reconfigure parameters within this
83 | ## package, follow these steps:
84 | ## * In the file package.xml:
85 | ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
86 | ## * In this file (CMakeLists.txt):
87 | ## * add "dynamic_reconfigure" to
88 | ## find_package(catkin REQUIRED COMPONENTS ...)
89 | ## * uncomment the "generate_dynamic_reconfigure_options" section below
90 | ## and list every .cfg file to be processed
91 |
92 | ## Generate dynamic reconfigure parameters in the 'cfg' folder
93 | # generate_dynamic_reconfigure_options(
94 | # cfg/DynReconf1.cfg
95 | # cfg/DynReconf2.cfg
96 | # )
97 |
98 | ###################################
99 | ## catkin specific configuration ##
100 | ###################################
101 | ## The catkin_package macro generates cmake config files for your package
102 | ## Declare things to be passed to dependent projects
103 | ## INCLUDE_DIRS: uncomment this if your package contains header files
104 | ## LIBRARIES: libraries you create in this project that dependent projects also need
105 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need
106 | ## DEPENDS: system dependencies of this project that dependent projects also need
107 | catkin_package(
108 | # INCLUDE_DIRS include
109 | # LIBRARIES bunker_python
110 | # CATKIN_DEPENDS rospy bunker_msgs std_msgs
111 | # DEPENDS system_lib
112 | )
113 |
114 | ###########
115 | ## Build ##
116 | ###########
117 |
118 | ## Specify additional locations of header files
119 | ## Your package locations should be listed before other locations
120 | include_directories(
121 | # include
122 | ${catkin_INCLUDE_DIRS}
123 | )
124 |
125 | ## Declare a C++ library
126 | # add_library(${PROJECT_NAME}
127 | # src/${PROJECT_NAME}/bunker_python.cpp
128 | # )
129 |
130 | ## Add cmake target dependencies of the library
131 | ## as an example, code may need to be generated before libraries
132 | ## either from message generation or dynamic reconfigure
133 | # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
134 |
135 | ## Declare a C++ executable
136 | ## With catkin_make all packages are built within a single CMake context
137 | ## The recommended prefix ensures that target names across packages don't collide
138 | # add_executable(${PROJECT_NAME}_node src/bunker_python_node.cpp)
139 |
140 | ## Rename C++ executable without prefix
141 | ## The above recommended prefix causes long target names, the following renames the
142 | ## target back to the shorter version for ease of user use
143 | ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
144 | # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
145 |
146 | ## Add cmake target dependencies of the executable
147 | ## same as for the library above
148 | # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
149 |
150 | ## Specify libraries to link a library or executable target against
151 | # target_link_libraries(${PROJECT_NAME}_node
152 | # ${catkin_LIBRARIES}
153 | # )
154 |
155 | #############
156 | ## Install ##
157 | #############
158 |
159 | # all install targets should use catkin DESTINATION variables
160 | # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
161 |
162 | ## Mark executable scripts (Python etc.) for installation
163 | ## in contrast to setup.py, you can choose the destination
164 | # install(PROGRAMS
165 | # scripts/my_python_script
166 | # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
167 | # )
168 |
169 | ## Mark executables and/or libraries for installation
170 | # install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
171 | # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
172 | # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
173 | # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
174 | # )
175 |
176 | ## Mark cpp header files for installation
177 | # install(DIRECTORY include/${PROJECT_NAME}/
178 | # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
179 | # FILES_MATCHING PATTERN "*.h"
180 | # PATTERN ".svn" EXCLUDE
181 | # )
182 |
183 | ## Mark other files for installation (e.g. launch and bag files, etc.)
184 | # install(FILES
185 | # # myfile1
186 | # # myfile2
187 | # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
188 | # )
189 |
190 | #############
191 | ## Testing ##
192 | #############
193 |
194 | ## Add gtest based cpp test target and link libraries
195 | # catkin_add_gtest(${PROJECT_NAME}-test test/test_bunker_python.cpp)
196 | # if(TARGET ${PROJECT_NAME}-test)
197 | # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
198 | # endif()
199 |
200 | ## Add folders to be run by python nosetests
201 | # catkin_add_nosetests(test)
202 |
--------------------------------------------------------------------------------
/bunker_msgs/msg/BunkerMotorState.msg:
--------------------------------------------------------------------------------
1 | float64 current
2 | float64 rpm
3 | float64 temperature
--------------------------------------------------------------------------------
/bunker_msgs/msg/BunkerRsStatus.msg:
--------------------------------------------------------------------------------
1 | Header header
2 |
3 | int8 stick_left_h
4 | int8 stick_left_v
5 | int8 stick_right_h
6 | int8 stick_right_v
7 |
8 | uint8 swa
9 | uint8 swb
10 | uint8 swc
11 | uint8 swd
12 |
13 | uint8 var_a
14 |
--------------------------------------------------------------------------------
/bunker_msgs/msg/BunkerStatus.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 |
15 | # base state
16 | uint8 base_state
17 | uint8 control_mode
18 | uint16 fault_code
19 | float64 battery_voltage
20 |
21 | # motor state
22 | BunkerMotorState[2] motor_states
23 |
24 | # light state
25 | #bool light_control_enabled
26 | #BunkerLightState front_light_state
27 | #BunkerLightState rear_light_state
28 |
--------------------------------------------------------------------------------
/bunker_msgs/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | bunker_msgs
4 | 0.3.3
5 | Messages for AgileX Bunker
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 |
--------------------------------------------------------------------------------