Skip to content

Commit

Permalink
Change topic name (xarm_states to robot_states)
Browse files Browse the repository at this point in the history
  • Loading branch information
vimior committed Sep 7, 2022
1 parent 4eeddeb commit cfea824
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
5 changes: 3 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ For simplified Chinese version: [简体中文版](./ReadMe_cn.md)
- add support for Gazebo simulation, can be controlled by moveit.
- support adding customized tool model.
- (2022-09-07) Change the parameter type of service (__set_tgpio_modbus_timeout__/__getset_tgpio_modbus_data__), and add parameters to support transparent transmission
- (2022-09-07) Change topic name (xarm_states to robot_states)
- (2022-09-07) Update submodule xarm-sdk to version 1.11.0


Expand Down Expand Up @@ -118,7 +119,7 @@ __Reminder 3: All following instructions will base on xArm6,please use prope

__joint_states__: is of type __sensor_msgs::msg::JointState__

__xarm_states__: is of type __xarm_msgs::msg::RobotMsg__
__robot_states__: is of type __xarm_msgs::msg::RobotMsg__

__xarm_cgpio_states__: is of type __xarm_msgs::msg::CIOState__

Expand All @@ -135,7 +136,7 @@ __Reminder 3: All following instructions will base on xArm6,please use prope
# service test
$ ros2 run xarm_api test_xarm_ros_client
# topic test
$ ros2 run xarm_api test_xarm_states
$ ros2 run xarm_api test_robot_states
```

- ### 5.5 xarm_controller
Expand Down
5 changes: 3 additions & 2 deletions ReadMe_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- 支持加载其它模型到机械臂末端
- 新增xarm_moveit_servo支持xbox手柄/SpaceMouse/键盘控制
- (2022-09-07) 变更service(__set_tgpio_modbus_timeout__/__getset_tgpio_modbus_data__)的参数类型,增加参数支持透传
- (2022-09-07) 变更Topic名字(xarm_states改为robot_states)
- (2022-09-07) 更新子模块xarm-sdk到1.11.0版本

## 3. 准备工作
Expand Down Expand Up @@ -115,7 +116,7 @@ __注意3: 以下启动说明以6轴为例,5轴和7轴的用法只需找到

__joint_states__: 格式为 __sensor_msgs::msg::JointState__

__xarm_states__: 格式为 __xarm_msgs::msg::RobotMsg__
__robot_states__: 格式为 __xarm_msgs::msg::RobotMsg__

__xarm_cgpio_states__: 格式为 __xarm_msgs::msg::CIOState__

Expand All @@ -132,7 +133,7 @@ __注意3: 以下启动说明以6轴为例,5轴和7轴的用法只需找到
# 测试service
$ ros2 run xarm_api test_xarm_ros_client
# 测试topic
$ ros2 run xarm_api test_xarm_states
$ ros2 run xarm_api test_robot_states
```

- ### 5.5 xarm_controller
Expand Down
8 changes: 4 additions & 4 deletions xarm_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ target_link_libraries(test_xarm_velo_move
${ament_LIBRARIES}
)

add_executable(test_xarm_states
test/test_xarm_states.cpp
add_executable(test_robot_states
test/test_robot_states.cpp
)
ament_target_dependencies(test_xarm_states ${dependencies})
ament_target_dependencies(test_robot_states ${dependencies})

ament_export_libraries(xarm_ros_driver)
ament_export_libraries(xarm_ros_client)
Expand All @@ -121,7 +121,7 @@ install(
xarm_driver_node
test_xarm_ros_client
test_xarm_velo_move
test_xarm_states
test_robot_states
DESTINATION lib/${PROJECT_NAME}
)

Expand Down
2 changes: 1 addition & 1 deletion xarm_api/src/xarm_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace xarm_api
xarm_state_msg_.angle.resize(dof_);

joint_state_pub_ = hw_node_->create_publisher<sensor_msgs::msg::JointState>("joint_states", 10);
robot_state_pub_ = hw_node_->create_publisher<xarm_msgs::msg::RobotMsg>("xarm_states", 10);
robot_state_pub_ = hw_node_->create_publisher<xarm_msgs::msg::RobotMsg>("robot_states", 10);
cgpio_state_pub_ = hw_node_->create_publisher<xarm_msgs::msg::CIOState>("xarm_cgpio_states", 10);
ftsensor_ext_state_pub_ = hw_node_->create_publisher<geometry_msgs::msg::WrenchStamped>("uf_ftsensor_ext_states", 10);
ftsensor_raw_state_pub_ = hw_node_->create_publisher<geometry_msgs::msg::WrenchStamped>("uf_ftsensor_raw_states", 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ void joint_states_callback(const sensor_msgs::msg::JointState::SharedPtr states)
RCLCPP_INFO(rclcpp::get_logger("joint_states"), "positon: %s", pos_str.c_str());
}

void xarm_states_callback(const xarm_msgs::msg::RobotMsg::SharedPtr states)
void robot_states_callback(const xarm_msgs::msg::RobotMsg::SharedPtr states)
{
RCLCPP_INFO(rclcpp::get_logger("xarm_states"), "state: %d, error: %d", states->state, states->err);
RCLCPP_INFO(rclcpp::get_logger("robot_states"), "state: %d, error: %d", states->state, states->err);
}

void xarm_cgpio_states_callback(const xarm_msgs::msg::CIOState::SharedPtr states)
Expand All @@ -42,19 +42,19 @@ int main(int argc, char **argv)
{
rclcpp::init(argc, argv);
std::string hw_ns = "xarm";
std::shared_ptr<rclcpp::Node> node = rclcpp::Node::make_shared("test_xarm_states", hw_ns);
std::shared_ptr<rclcpp::Node> node = rclcpp::Node::make_shared("test_robot_states", hw_ns);

RCLCPP_INFO(rclcpp::get_logger("test_xarm_states"), "namespace: %s", node->get_namespace());
RCLCPP_INFO(rclcpp::get_logger("test_xarm_states"), "test_xarm_states start");
RCLCPP_INFO(rclcpp::get_logger("test_robot_states"), "namespace: %s", node->get_namespace());
RCLCPP_INFO(rclcpp::get_logger("test_robot_states"), "test_robot_states start");

rclcpp::Subscription<sensor_msgs::msg::JointState>::SharedPtr joint_state_sub = node->create_subscription<sensor_msgs::msg::JointState>("joint_states", 100, joint_states_callback);
rclcpp::Subscription<xarm_msgs::msg::RobotMsg>::SharedPtr xarm_state_sub = node->create_subscription<xarm_msgs::msg::RobotMsg>("xarm_states", 100, xarm_states_callback);
rclcpp::Subscription<xarm_msgs::msg::RobotMsg>::SharedPtr xarm_state_sub = node->create_subscription<xarm_msgs::msg::RobotMsg>("robot_states", 100, robot_states_callback);
rclcpp::Subscription<xarm_msgs::msg::CIOState>::SharedPtr cgpio_sub = node->create_subscription<xarm_msgs::msg::CIOState>("xarm_cgpio_states", 100, xarm_cgpio_states_callback);

signal(SIGINT, exit_sig_handler);
rclcpp::spin(node);
rclcpp::shutdown();

RCLCPP_INFO(rclcpp::get_logger("test_xarm_states"), "test_xarm_states over");
RCLCPP_INFO(rclcpp::get_logger("test_robot_states"), "test_robot_states over");
return 0;
}
2 changes: 1 addition & 1 deletion xarm_msgs/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## msg
- [xarm_msgs::msg::RobotMsg](./msg/RobotMsg.msg)
- xarm_api->topic: __xarm_states__
- xarm_api->topic: __robot_states__
- [xarm_msgs::msg::CIOState](./msg/CIOState.msg)
- xarm_api->topic: __xarm_cgpio_states__
- [sensor_msgs::msg::JointState](http://docs.ros.org/en/api/sensor_msgs/html/msg/JointState.html)
Expand Down

0 comments on commit cfea824

Please sign in to comment.