创建自定义消息
This commit is contained in:
parent
eaf598eb0b
commit
7f377533a1
51
src/rc_msgs/.gitignore
vendored
Normal file
51
src/rc_msgs/.gitignore
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
devel/
|
||||
logs/
|
||||
build/
|
||||
bin/
|
||||
lib/
|
||||
msg_gen/
|
||||
srv_gen/
|
||||
msg/*Action.msg
|
||||
msg/*ActionFeedback.msg
|
||||
msg/*ActionGoal.msg
|
||||
msg/*ActionResult.msg
|
||||
msg/*Feedback.msg
|
||||
msg/*Goal.msg
|
||||
msg/*Result.msg
|
||||
msg/_*.py
|
||||
build_isolated/
|
||||
devel_isolated/
|
||||
|
||||
# Generated by dynamic reconfigure
|
||||
*.cfgc
|
||||
/cfg/cpp/
|
||||
/cfg/*.py
|
||||
|
||||
# Ignore generated docs
|
||||
*.dox
|
||||
*.wikidoc
|
||||
|
||||
# eclipse stuff
|
||||
.project
|
||||
.cproject
|
||||
|
||||
# qcreator stuff
|
||||
CMakeLists.txt.user
|
||||
|
||||
srv/_*.py
|
||||
*.pcd
|
||||
*.pyc
|
||||
qtcreator-*
|
||||
*.user
|
||||
|
||||
/planning/cfg
|
||||
/planning/docs
|
||||
/planning/src
|
||||
|
||||
*~
|
||||
|
||||
# Emacs
|
||||
.#*
|
||||
|
||||
# Catkin custom files
|
||||
CATKIN_IGNORE
|
12
src/rc_msgs/CMakeLists.txt
Normal file
12
src/rc_msgs/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(rc_msgs)
|
||||
|
||||
find_package(rosidl_default_generators REQUIRED)
|
||||
rosidl_generate_interfaces(${PROJECT_NAME}
|
||||
"msg/Ps2Data.msg"
|
||||
"msg/DataControl.msg"
|
||||
"msg/DataMotor.msg"
|
||||
)
|
||||
|
||||
ament_package()
|
||||
|
21
src/rc_msgs/LICENSE
Normal file
21
src/rc_msgs/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 zucheng Lv
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
6
src/rc_msgs/README.md
Normal file
6
src/rc_msgs/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# rc_msg
|
||||
Some ROS 2 custom messages for Robotaster
|
||||
|
||||
Usage
|
||||
Modify or add files in the /msg directory as needed
|
||||
colcon build
|
5
src/rc_msgs/msg/DataControl.msg
Normal file
5
src/rc_msgs/msg/DataControl.msg
Normal file
@ -0,0 +1,5 @@
|
||||
int16 tau
|
||||
int16 vw
|
||||
int32 pos
|
||||
uint16 kp
|
||||
uint16 kd
|
3
src/rc_msgs/msg/DataMotor.msg
Normal file
3
src/rc_msgs/msg/DataMotor.msg
Normal file
@ -0,0 +1,3 @@
|
||||
int16 tau
|
||||
int16 vw
|
||||
int32 pos
|
20
src/rc_msgs/msg/Ps2Data.msg
Normal file
20
src/rc_msgs/msg/Ps2Data.msg
Normal file
@ -0,0 +1,20 @@
|
||||
# control input message
|
||||
float32 lx
|
||||
float32 ly
|
||||
float32 rx
|
||||
float32 ry
|
||||
|
||||
float32 up_down
|
||||
float32 left_right
|
||||
|
||||
bool l1
|
||||
bool l2
|
||||
bool r1
|
||||
bool r2
|
||||
|
||||
# 四种模式
|
||||
uint8 mode # 0:手柄控制 1:键盘控制 2:自瞄 3:手动瞄准
|
||||
|
||||
bool select
|
||||
bool start
|
||||
|
16
src/rc_msgs/package.xml
Normal file
16
src/rc_msgs/package.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<package format="3">
|
||||
<name>rc_msgs</name>
|
||||
<version>0.0.1</version>
|
||||
<description>Describe custom messages</description>
|
||||
<maintainer email="1683502971@qq.com">biao</maintainer>
|
||||
<license>MIT</license>
|
||||
|
||||
<buildtool_depend>rosidl_default_generators</buildtool_depend>
|
||||
<exec_depend>rosidl_default_runtime</exec_depend>
|
||||
<member_of_group>rosidl_interface_packages</member_of_group>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
@ -17,6 +17,13 @@ struct Motor_t
|
||||
MotorData data;
|
||||
};
|
||||
|
||||
// struct Leg_Motor_t
|
||||
// {
|
||||
// Motor_t foot;
|
||||
// Motor_t small;
|
||||
// Motor_t big;
|
||||
// };
|
||||
|
||||
class MotorControlNode : public rclcpp::Node
|
||||
{
|
||||
public:
|
||||
|
@ -19,8 +19,8 @@ void MotorControlNode::control_motor()
|
||||
data.motorType = MotorType::GO_M8010_6;
|
||||
cmd.mode = queryMotorMode(MotorType::GO_M8010_6, MotorMode::FOC);
|
||||
cmd.id = 0;
|
||||
cmd.q = 0.0;
|
||||
cmd.dq = 0.0;
|
||||
cmd.q = 0.0*queryGearRatio(MotorType::GO_M8010_6);;
|
||||
cmd.dq = 0.0*queryGearRatio(MotorType::GO_M8010_6);;
|
||||
cmd.kp = 0.0;
|
||||
cmd.kd = 0.0;
|
||||
cmd.tau = 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user