Skip to content

Feature/joy teleop - #85

Open
JosjaG wants to merge 18 commits into
masterfrom
feature/joy_teleop
Open

Feature/joy teleop#85
JosjaG wants to merge 18 commits into
masterfrom
feature/joy_teleop

Conversation

@JosjaG

@JosjaG JosjaG commented Jun 15, 2021

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread scripts/joystick_controls_node Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
</node>

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread scripts/joystick_controls_node Outdated
"""
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
Copy Markdown
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 thread scripts/joystick_controls_node Outdated
Comment on lines +34 to +36
while not rospy.is_shutdown():
self.publish_controls()
r.sleep()

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@MatthijsBurgh MatthijsBurgh left a comment

Copy link
Copy Markdown
Member

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.

@MatthijsBurgh MatthijsBurgh left a comment

Copy link
Copy Markdown
Member

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

JosjaG commented Jun 18, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

JosjaG commented Jun 21, 2022

Copy link
Copy Markdown
Contributor Author

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.

4 participants