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

Feature/joy teleop #85

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Feature/joy teleop #85

wants to merge 18 commits into from

Conversation

JosjaG
Copy link
Contributor

@JosjaG JosjaG commented Jun 15, 2021

No description provided.

Comment on lines 60 to 62
if abs(mapping['right_stick_horizontal']) < 0.1 and abs(mapping['right_stick_vertical']) < 0.1 and abs(mapping['left_stick_horizontal']) < 0.1:
self.base_command = Twist()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vanwaar dit stuk? Je zou denken dat dit het logische resultaat van alles hierboven.

self.base_command = Twist()

def publish_controls(self):
self.base_pub.publish(self.base_command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zit hier geen risico in als er geen input meer komt. Gaat ie dan niet eindeloos doorrijden.

}
self._send_controls(controller_mappings[self.controller_mode])

def get_gripper_state(self, state_msg):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant you take this from the robot object.

@MatthijsBurgh MatthijsBurgh force-pushed the feature/joy_teleop branch 4 times, most recently from a12d44e to d55ef54 Compare June 18, 2021 11:51
@@ -206,6 +206,9 @@
<remap from="odom" to="base/measurements" />
</node>

<!-- Joystick controller -->
<include file="$(find hero_bringup)/launch/tools/joy_teleop.launch" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only on the robot you want to launch this right?

Comment on lines +92 to +93
if state_msg.name[20] == 'hand_motor_joint':
if state_msg.position[20] > 0.6:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The joint could also be at another index. So find index of item in list.

self.base_pub.publish(self.base_command)

def map_joystick(self, joy_msg):
controller_mappings = {4: {'A': joy_msg.buttons[0],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a class attribute, so it isn't generated every call

"""
Subscribes to the Joy messages sent via the controller and the joy node and then transforms these to the desired behavior
"""
self.controller_mode = 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a class attribute, plus maybe add a short explanation.

Comment on lines 34 to 36
while not rospy.is_shutdown():
self.publish_controls()
r.sleep()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blocks the constructor

if __name__ == "__main__":
rospy.init_node("joystick_controls_node")
ConversionNode = JoystickControls()
sys.exit(rospy.spin())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is never reached as the constructor is blocking.

from robot_skills.arm import arms


class JoystickControls(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to have the class definition in the library

Copy link
Member

@MatthijsBurgh MatthijsBurgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should be merged after/together with tue-robotics/tue-env-targets#234. It is clear that the joy package is needed, so that needs to be installed on the machine that will run this code. It would be best to not include this in the package.xml as that would result in it being installed on all machines.

Plus as the ros-joy target is being changed. Please make clear which other packages are needed, if this is the case.

Copy link
Member

@MatthijsBurgh MatthijsBurgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires a dependency on robot_skills. Which we shouldn't. So that requires this code to be moved to a separate/new repo.

@JosjaG
Copy link
Contributor Author

JosjaG commented Jun 18, 2022

I agree that it is an undesired dependency, but I don't think this should be a new repo. Having new repos for small features makes our codebase even less clear/organized.

Do we have a different repo that suits this node?

@MatthijsBurgh
Copy link
Member

I agree that it is an undesired dependency, but I don't think this should be a new repo. Having new repos for small features makes our codebase even less clear/organized.

I disagree, mixing everything together that doesn't belong together does create a big mess in my opinion.

Without creating one package with a lot of dependencies, small features do require a separate package.

@JosjaG
Copy link
Contributor Author

JosjaG commented Jun 21, 2022

What dependency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants