Skip to content
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

Publish JointState messages for the wheels #26

Merged
merged 1 commit into from Jun 28, 2016

Conversation

@lopsided98
Copy link
Contributor

commented Jun 23, 2016

This PR adds support for publishing JointState messages for the wheels on the Create. This allows robot_state_publisher to generate transforms for the wheels. These messages could also allow other nodes to access the velocities of the wheels.

This fixes #25.

To support these changes, AutonomyLab/libcreate#19 must be merged.

@@ -49,6 +49,12 @@ CreateDriver::CreateDriver(ros::NodeHandle& nh) : nh_(nh), priv_nh_("~")
tf_odom_.child_frame_id = str_base_footprint;
odom_msg_.header.frame_id = "odom";
odom_msg_.child_frame_id = str_base_footprint;
joint_state_msg_.name.resize(2);

This comment has been minimized.

Copy link
@jacobperron

jacobperron Jun 25, 2016

Member

should we populate header.frame_id too? I'm not familiar with joint_state_publisher

This comment has been minimized.

Copy link
@lopsided98

lopsided98 Jun 25, 2016

Author Contributor

joint_state_publisher doesn't do it, so I don't think it's necessary.

void CreateDriver::publishJointState() {
// Publish joint states
joint_state_msg_.header.stamp = ros::Time::now();
joint_state_msg_.position[0] = robot_->getLeftWheelDistance() / (create::util::CREATE_2_WHEEL_DIAMETER / 2);

This comment has been minimized.

Copy link
@jacobperron

jacobperron Jun 25, 2016

Member

I think you can make this more efficient by computing the radius once: static float CREATE_2_WHEEL_RADIUS = create::util::CREATE_2_WHEEL_DIAMETER / 2.0;

This comment has been minimized.

Copy link
@lopsided98

lopsided98 Jun 25, 2016

Author Contributor

Technically, I don't think it is any more efficient, since it should be computed at compile time because both operands are constants, but it looks cleaner to use a variable.

This comment has been minimized.

Copy link
@lopsided98

lopsided98 Jun 25, 2016

Author Contributor

Actually, you might be right, because the constant is in a different library so the compiler can't guarantee that its value can't change. Either way, I'll just do what you suggested.

@jacobperron

This comment has been minimized.

Copy link
Member

commented Jun 25, 2016

Looks good. I'll try it out next week 👍

I guess you should update the calls to get velocity to reflect changes in libcreate

@lopsided98

This comment has been minimized.

Copy link
Contributor Author

commented Jun 25, 2016

I squashed the commits, renamed the methods, updated the README and stored the radius in a variable.

@jacobperron

This comment has been minimized.

Copy link
Member

commented Jun 28, 2016

Please update the git tag in CMakeLists.txt to master.
In the future I'll release libcreate as a catkin package to avoid using git.

@jacobperron jacobperron merged commit 7ff3d57 into AutonomyLab:indigo-devel Jun 28, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.