Keyboard control

Keyboard control was added to the mycobot_rospackage and synchronized in real time in rviz. This function relies on pythonApi, so make sure to connect to the real robot arm.

Open a command line and run:

roslaunch mycobot_ros mycobot_teleop_keyboard.launch
#or
roslaunch mycobot_ros mycobot_teleop_keyboard.launch port:=/dev/ttyUSB0 baud:=115200

Due to the need for real robotic arm communication, the launch supports the setting of port numbers and Baud rates, which default to"/dev/ttyUSB0" and 115200.

The running resullts are as follows:

Screenshot

The information of myCobot is output from the command line as follows:

SUMMARY
========

PARAMETERS
 * /mycobot_services/baud: 115200
 * /mycobot_services/port: /dev/ttyUSB0
 * /robot_description: <?xml version="1....
 * /rosdistro: kinetic
 * /rosversion: 1.12.17

NODES
  /
    mycobot_services (mycobot_ros/mycobot_services.py)
    real_listener (mycobot_ros/listen_real.py)
    robot_state_publisher (robot_state_publisher/state_publisher)
    rviz (rviz/rviz)

auto-starting new master
process[master]: started with pid [1333]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to f977b3f4-b3a9-11eb-b0c8-d0c63728b379
process[rosout-1]: started with pid [1349]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [1357]
process[rviz-3]: started with pid [1367]
process[mycobot_services-4]: started with pid [1380]
process[real_listener-5]: started with pid [1395]
[INFO] [1620882819.196217]: start ...
[INFO] [1620882819.205050]: /dev/ttyUSB0,115200

MyCobot Status
--------------------------------
Joint Limit:
    joint 1: -170 ~ +170
    joint 2: -170 ~ +170
    joint 3: -170 ~ +170
    joint 4: -170 ~ +170
    joint 5: -170 ~ +170
    joint 6: -180 ~ +180

Connect Status: True

Servo Infomation: all connected

Servo Temperature: unknown

Atom Version: unknown

[INFO] [1620882819.435778]: ready

Next, open another command line and run:

rosrun mycobot_ros teleop_keyboard.py
#or
rosrun mycobot_ros teleop_keyboard.py _speed:=70

You'll see the following output on the command line:

Mycobot Teleop Keyboard Controller
---------------------------
Movimg options(control coordinations [x,y,z,rx,ry,rz]):
              w(x+)

    a(y-)     s(x-)     d(y+)

    z(z-) x(z+)

u(rx+)   i(ry+)   o(rz+)
j(rx-)   k(ry-)   l(rz-)

Gripper control:
    g - open
    h - close

Other:
    1 - Go to init pose
    2 - Go to home pose
    3 - Resave home pose
    q - Quit

currently:      speed: 50       change percent 5

The parameters supported by the script:

  • _speed:The movement speed of the robot arm
  • _change_percent:The percentage of the movement distance.

results matching ""

    No results matching ""