3434namespace tachimawari ::joint
3535{
3636
37- std::string JointNode::get_node_prefix () {return " joint" ;}
37+ std::string JointNode::get_node_prefix () { return " joint" ; }
3838
39- std::string JointNode::control_joints_topic () {return get_node_prefix () + " /control_joints" ;}
39+ std::string JointNode::control_joints_topic () { return get_node_prefix () + " /control_joints" ; }
4040
41- std::string JointNode::set_joints_topic () {return get_node_prefix () + " /set_joints" ;}
41+ std::string JointNode::set_joints_topic () { return get_node_prefix () + " /set_joints" ; }
4242
43- std::string JointNode::set_torques_topic () {return get_node_prefix () + " /set_torques" ;}
43+ std::string JointNode::set_torques_topic () { return get_node_prefix () + " /set_torques" ; }
4444
45- std::string JointNode::status_topic () {return " measurement/status" ;}
45+ std::string JointNode::status_topic () { return " measurement/status" ; }
4646
47- std::string JointNode::current_joints_topic () {return get_node_prefix () + " /current_joints" ;}
47+ std::string JointNode::current_joints_topic () { return get_node_prefix () + " /current_joints" ; }
4848
49- JointNode::JointNode (
50- rclcpp::Node::SharedPtr node, std::shared_ptr<JointManager> joint_manager, const std::string & path)
51- : joint_manager(joint_manager),
52- middleware (),
53- tf2_broadcaster(std::make_shared<tf2_ros::TransformBroadcaster>(node)),
54- tf2_manager(std::make_shared<Tf2Manager>()),
55- imu_yaw(keisan::make_degree(0 ))
49+ JointNode::JointNode (rclcpp::Node::SharedPtr node, std::shared_ptr<JointManager> joint_manager)
50+ : joint_manager(joint_manager), middleware(), imu_yaw(keisan::make_degree(0 ))
5651{
57- tf2_manager->load_configuration (path);
58-
5952 control_joints_subscriber = node->create_subscription <ControlJoints>(
6053 control_joints_topic (), 10 , [this ](const ControlJoints::SharedPtr message) {
6154 this ->middleware .set_rules (message->control_type , message->ids );
@@ -74,7 +67,7 @@ JointNode::JointNode(
7467 std::vector<Joint> joints;
7568 std::transform (
7669 message->ids .begin (), message->ids .end (), std::back_inserter (joints),
77- [](uint8_t id) -> Joint {return Joint (id, 0 );});
70+ [](uint8_t id) -> Joint { return Joint (id, 0 ); });
7871
7972 this ->joint_manager ->torque_enable (joints, message->torque_enable );
8073 });
@@ -87,7 +80,7 @@ JointNode::JointNode(
8780 current_joints_publisher = node->create_publisher <CurrentJoints>(current_joints_topic (), 10 );
8881}
8982
90- void JointNode::update () {middleware.update ();}
83+ void JointNode::update () { middleware.update (); }
9184
9285void JointNode::publish_current_joints ()
9386{
@@ -104,15 +97,4 @@ void JointNode::publish_current_joints()
10497 current_joints_publisher->publish (msg_joints);
10598}
10699
107- void JointNode::publish_frame_tree ()
108- {
109- const auto & current_joints = this ->joint_manager ->get_current_joints ();
110- tf2_manager->update (current_joints, imu_yaw);
111-
112- rclcpp::Time now = rclcpp::Clock ().now ();
113- for (auto & frame : tf2_manager->get_frames ()) {
114- tf2_broadcaster->sendTransform (frame.get_transform_stamped (now));
115- }
116- }
117-
118100} // namespace tachimawari::joint
0 commit comments