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

Naming and message type of the topic joint_states/target #2

Open
JuanDelAguila opened this issue Nov 22, 2022 · 1 comment
Open

Naming and message type of the topic joint_states/target #2

JuanDelAguila opened this issue Nov 22, 2022 · 1 comment

Comments

@JuanDelAguila
Copy link

JuanDelAguila commented Nov 22, 2022

@joaomoura24 and I have been discussing that the topic joint_states/target maybe should be renamed to joint_states/command to remain consistent with conventions in robot control. Additionally, the topic joint_states/target uses a sensor_msgs/JointState message type which is usually reserved for reading joint_states, not for commanding. Perhaps a more standard message type should be used for commanding joints such as std_msgs/Float64MultiArray.

@cmower
Copy link
Member

cmower commented Nov 22, 2022

Thanks @JuanDelAguila

I think the best thing is to create a flag that the user can set in the robot yaml configuration file, e.g. target_message_type: 'JointState' # or 'Float64MultiArray'. First you will need to implement extractor methods, e.g.

@staticmethod
def get_target_from_joint_state_msg(msg: JointState):
    # TODO: convert JointState to list
    return q

@staticmethod
def get_target_from_float64multiarray(msg: Float64MultiArray):
    # TODO: convert Float64MultiArray to list
    return

then after the following if-statement

if not self.pb_obj.is_visual_robot:
self.joint_state_target_callback = self.set_target

you can set the extractor function as a class variable, e.g.

if self.target_message_type == 'JointState':
    self.get_target_from_msg = self.get_target_from_jointstate
elif # TODO...

then call this function inside the set_target method.

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

No branches or pull requests

2 participants