kobuki-base / kobuki_ros

ROS2 runtime libraries, nodes and launchers for the Kobuki
46 stars 27 forks source link

ROS2 Robot wheels not moving using rosnode but works using native app #22

Closed alexandru-oana closed 3 years ago

alexandru-oana commented 3 years ago

I'm using foxy and i have some troubles when trying to move the robot.

If i use like this it as a ros2 node, and press the keys as instructions recommend, the wheels are not moving:

ros2 run kobuki_keyop kobuki_keyop_node --ros-args --params-file /kobuki/src/kobuki_ros/kobuki_keyop/config/keyop_params.yaml
[INFO] [1618388630.700607817] [kobuki_keyop_node]: KeyOp : using linear  vel step [0.100000].
[INFO] [1618388630.700846402] [kobuki_keyop_node]: KeyOp : using linear  vel max  [3.400000].
[INFO] [1618388630.700884305] [kobuki_keyop_node]: KeyOp : using angular vel step [0.020000].
[INFO] [1618388630.700915798] [kobuki_keyop_node]: KeyOp : using angular vel max  [1.200000].
[INFO] [1618388630.706318129] [kobuki_keyop_node]: KeyOp: connected.
Reading from keyboard
---------------------------
Forward/back arrows : linear velocity incr/decr.
Right/left arrows : angular velocity incr/decr.
Spacebar : reset linear/angular velocities.
d : disable motors.
e : enable motors.
[INFO] [1618388632.536844692] [kobuki_keyop_node]: KeyOp: die, die, die (disabling power to the device's motor system).
[INFO] [1618388635.008851951] [kobuki_keyop_node]: KeyOp: Enabling power to the device subsystem.

What is strange, is that, if i check: ros2 topic echo /cmd_vel i get the x/y/z altered accordingly to what keys i've pressed in the other screen were ros2 node was running. But, as i've said, the wheels are not actually moving.

The wheels are moving only with the native app:


$ kobuki-simple-keyop

Simple Keyop : Utility for driving kobuki by keyboard.

Parameters
----------
 - linear_vel_max   [1]
 - linear_vel_step  [0.05]
 - angular_vel_max  [6.6]
 - angular_vel_step [0.33]

Reading from keyboard
---------------------
Forward/back arrows : linear velocity incr/decr.
Right/left arrows : angular velocity incr/decr.
Spacebar : reset linear/angular velocities.
q : quit.

current pose: [x: 5.61871e-310, y: 6.94459e-310, heading: 4.67794e-310]

Any thoughts ?

alexandru-oana commented 3 years ago

I've opened the /dev/kobuki in minicom in other terminal and then killed it, basically i left the resource locked. The native app throws an error as it should:

terminate called after throwing an instance of 'ecl::StandardException'
  what():
Location : /kobuki/src/kobuki_core/src/driver/kobuki.cpp:134
         : /kobuki/src/ecl_core/ecl_devices/src/lib/serial_pos.cpp:156
Flag     : Could not open the requested object.
Detail   : Device is already locked. Try 'lsof | grep /dev/kobuki' to find other processes that currently have the port open (if the device is a symbolic link you may need to replace the device name with the device that it is pointing to) [posix error in case it is something else: 11

Aborted (core dumped)

But i could start the ros2 node without any issues. and it even says: Connected. ( but of course it doesn't do anything to the wheels ). I didn't looked, yet, into the source code of the ros2 node to what is connecting to.