Score:0

Trying to paste a typed command to a terminal

us flag

I am very new to robotics and ROS and am looking for some help trying to create some keyboard shortcuts that allow me to paste them into a terminal.

Currently i am using the xdotool to do this. I am able to create a new shortcut and have the xdotool print to the terminal if i do something simple like ( ex. 'Hello world' or 'test' ) The text i need to have printed to the terminal has several differant symbols and characters, i dont know if this is why i am having an issue.

The typed text i need to printed is:

rosservice call /xm540arm/torque_enable "{cmd_type: 'group', name: 'arm', enable: false}"

when creating a new shortcut this is what i have put in the command section:

/bin/bash -c "sleep 0.5 && xdotool type 'rosservice call /xm540arm/torque_enable "{cmd_type: 'group', name: 'arm', enable: false}"'

I am not sure if the way i am doing this is correct or not, i am open to any suggestions or other options to accomplish this task.

any help would be greatly appreciated

thanks Mike

Mike Becker avatar
us flag
im sorry i guess i left out that information. i am running ubuntu 20.04 and have mate for the desktop. using a raspberry pi4 as the computer
Mike Becker avatar
us flag
I was able to get the message to print to the terminal. it is not printing it exactly the same as i have it type to print. When i run the command that got printed to the terminal this is the return message i get. rosservice call /xm540arm/torque_enable {cmd_type:group,name:arm,enable:false} ERROR: Unable to send request. One of the fields has an incorrect type: field enable is not a bool srv file: string cmd_type string name bool enable ---
David avatar
cn flag
Additional info needs to be added to the question via edit not as comments.
terdon avatar
cn flag
Are you sure this is really what you want? I suspect you are actually looking for shell aliases and not a way to paste commands. Can you explain what the final objective is? Do you want to run the commands or just see them?
Score:1
cn flag

Since you have a double-quoted string, you need to escape any internal double quotes so that they are not read as ending the quoted string:

/bin/bash -c "sleep 0.5 && xdotool type 'rosservice call /xm540arm/torque_enable \"{cmd_type: 'group', name: 'arm', enable: false}\"'"
Mike Becker avatar
us flag
terdon thank you for the reply, i will try that and let you know how it works out. What i am trying to accomplish is to have the command run to turn the torque off to the robot arms motors. then i can pose the arm and torque the motor back on without having to copy and paste each time i need a new pose. I am open to your comment about shell aliases. All of this is still new to me so i will have to do some research about them to learn what they are and how to use them. thanks again
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.