-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Sprint 22/23 / PI-412] - [Feature] Implement TF2 Tree #61
Conversation
> > Co-authored-by: FaaizHaikal <faaizhaikal@gmail.com> Co-authored-by: hiikariri <ndaviss224@gmail.com>
…lues Co-authored-by: hiikariri <ndaviss224@gmail.com> Co-authored-by: FaaizHaikal <faaizhaikal@gmail.com>
Co-authored-by: hiikariri <ndaviss224@gmail.com> Co-authored-by: FaaizHaikal <faaizhaikal@gmail.com>
enum : uint8_t { | ||
ROLL = 0, | ||
PITCH = 1, | ||
YAW = 2, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to assign int values in enum
enum : uint8_t { | ||
ODOM = 0, | ||
BASE_LINK = 1, | ||
TORSO = 2, | ||
HEAD = 3, | ||
GAZE = 4, | ||
RIGHT_THIGH = 5, | ||
RIGHT_CALF = 6, | ||
RIGHT_FOOT = 7, | ||
LEFT_THIGH = 8, | ||
LEFT_CALF = 9, | ||
LEFT_FOOT = 10 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
@@ -39,13 +39,14 @@ class TachimawariNode | |||
explicit TachimawariNode( | |||
rclcpp::Node::SharedPtr node, std::shared_ptr<control::ControlManager> control_manager); | |||
|
|||
void run_joint_manager(); | |||
void run_joint_manager(std::string path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void run_joint_manager(std::string path); | |
void run_joint_manager(const std::string & path); |
public: | ||
explicit Tf2Manager(); | ||
|
||
bool load_configuration(std::string path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool load_configuration(std::string path); | |
bool load_configuration(const std::string & path); |
} catch (nlohmann::json::parse_error & ex) { | ||
std::cerr << "parse error at byte " << ex.byte << std::endl; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to throw the exception instead of letting the program running with unknown behavior.
} catch (nlohmann::json::parse_error & ex) { | |
std::cerr << "parse error at byte " << ex.byte << std::endl; | |
} | |
} | |
} catch (nlohmann::json::parse_error & ex) { | |
std::cerr << "parse error at byte " << ex.byte << std::endl; | |
throw ex; | |
} | |
} |
|
||
private: | ||
static const std::vector<std::pair<int, int>> tf2_joint_pairs; | ||
std::string config_path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmiiw, i don't see this variable ever used
|
||
void run_imu_provider(); | ||
|
||
private: | ||
rclcpp::Node::SharedPtr node; | ||
rclcpp::TimerBase::SharedPtr node_timer; | ||
rclcpp::TimerBase::SharedPtr node_timer_tf; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmiiw, this also unused
JointNode( | ||
rclcpp::Node::SharedPtr node, std::shared_ptr<JointManager> joint_manager, std::string path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JointNode( | |
rclcpp::Node::SharedPtr node, std::shared_ptr<JointManager> joint_manager, std::string path); | |
JointNode( | |
rclcpp::Node::SharedPtr node, std::shared_ptr<JointManager> joint_manager, const std::string & path); |
src/tachimawari/joint/tf2/frame.cpp
Outdated
quaternion_w = q.w(); | ||
} | ||
|
||
void Frame::update_quaternion(keisan::Angle<double> imu_yaw) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/tachimawari/joint/tf2/frame.cpp
Outdated
{ | ||
} | ||
|
||
geometry_msgs::msg::TransformStamped Frame::get_transform_stamped(rclcpp::Time time_stamp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If object is not modified in the function, can pass as const reference instead.
src/tachimawari/joint/tf2/frame.cpp
Outdated
return t; | ||
} | ||
|
||
void Frame::update_quaternion(std::vector<Joint> current_joints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/tachimawari/joint/tf2/frame.cpp
Outdated
quaternion_w = q.w(); | ||
} | ||
|
||
double Frame::get_joint_angle(uint8_t quaternion_axis, std::vector<Joint> current_joints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
return true; | ||
} | ||
|
||
void Tf2Manager::update(std::vector<Joint> current_joints, keisan::Angle<double> imu_yaw) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -21,16 +21,23 @@ | |||
#ifndef TACHIMAWARI__JOINT__NODE__JOINT_NODE_HPP_ | |||
#define TACHIMAWARI__JOINT__NODE__JOINT_NODE_HPP_ | |||
|
|||
#include <tf2_ros/buffer.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
library order, check another files too
Jira Link: https://ichiro-its.atlassian.net/browse/PD-412
Description
Implement TF2 to represent the robot's physical movements as transform frames and publish them.
Type of Change
How Has This Been Tested?
Checklist:
feature/JIRA-ID-SHORT-DESCRIPTION
if has a JIRA ticketenhancement/SHORT-DESCRIPTION
if has/has no JIRA ticket and contain enhancementhotfix/SHORT-DESCRIPTION
if the change doesn't need to be tested (urgent)