Skip to content

Commit

Permalink
feat: tidy codes
Browse files Browse the repository at this point in the history
  • Loading branch information
borednuna committed May 25, 2024
1 parent c590e5b commit f07ebda
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion include/tachimawari/joint/tf2/frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Frame
double translation_y;
double translation_z;

double quaternion_x; // maybe change to keisan angle
double quaternion_x;
double quaternion_y;
double quaternion_z;
double quaternion_w;
Expand Down
2 changes: 1 addition & 1 deletion include/tachimawari/joint/tf2/frame_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ class FrameId

} // namespace tachimawari::joint

#endif // TACHIMAWARI__JOINT_TF2__FRAME_ID_HPP_
#endif // TACHIMAWARI__JOINT_TF2__FRAME_ID_HPP_
16 changes: 8 additions & 8 deletions src/tachimawari/joint/node/joint_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
namespace tachimawari::joint
{

std::string JointNode::get_node_prefix() { return "joint"; }
std::string JointNode::get_node_prefix() {return "joint";}

std::string JointNode::control_joints_topic() { return get_node_prefix() + "/control_joints"; }
std::string JointNode::control_joints_topic() {return get_node_prefix() + "/control_joints";}

std::string JointNode::set_joints_topic() { return get_node_prefix() + "/set_joints"; }
std::string JointNode::set_joints_topic() {return get_node_prefix() + "/set_joints";}

std::string JointNode::set_torques_topic() { return get_node_prefix() + "/set_torques"; }
std::string JointNode::set_torques_topic() {return get_node_prefix() + "/set_torques";}

std::string JointNode::status_topic() { return "measurement/status"; }
std::string JointNode::status_topic() {return "measurement/status";}

std::string JointNode::current_joints_topic() { return get_node_prefix() + "/current_joints"; }
std::string JointNode::current_joints_topic() {return get_node_prefix() + "/current_joints";}

JointNode::JointNode(
rclcpp::Node::SharedPtr node, std::shared_ptr<JointManager> joint_manager, std::string path)
Expand Down Expand Up @@ -74,7 +74,7 @@ JointNode::JointNode(
std::vector<Joint> joints;
std::transform(
message->ids.begin(), message->ids.end(), std::back_inserter(joints),
[](uint8_t id) -> Joint { return Joint(id, 0); });
[](uint8_t id) -> Joint {return Joint(id, 0);});

this->joint_manager->torque_enable(joints, message->torque_enable);
});
Expand All @@ -87,7 +87,7 @@ JointNode::JointNode(
current_joints_publisher = node->create_publisher<CurrentJoints>(current_joints_topic(), 10);
}

void JointNode::update() { middleware.update(); }
void JointNode::update() {middleware.update();}

void JointNode::publish_current_joints()
{
Expand Down
31 changes: 16 additions & 15 deletions src/tachimawari/node/tachimawari_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,27 @@ TachimawariNode::TachimawariNode(
imu_node(nullptr),
control_node(nullptr)
{
node_timer = node->create_wall_timer(8ms, [this]() {
if (this->control_manager) {
this->control_manager->add_default_bulk_read_packet();
this->control_manager->send_bulk_read_packet();
node_timer = node->create_wall_timer(
8ms, [this]() {
if (this->control_manager) {
this->control_manager->add_default_bulk_read_packet();
this->control_manager->send_bulk_read_packet();

if (this->imu_node) {
this->imu_node->update();
}
if (this->imu_node) {
this->imu_node->update();
}

if (this->control_node) {
this->control_node->update();
}
if (this->control_node) {
this->control_node->update();
}

if (this->joint_node) {
this->joint_node->update();
if (this->joint_node) {
this->joint_node->update();

this->joint_node->publish_current_joints();
this->joint_node->publish_frame_tree();
this->joint_node->publish_current_joints();
this->joint_node->publish_frame_tree();
}
}
}
});
}

Expand Down

0 comments on commit f07ebda

Please sign in to comment.