Team-Isaac-Polito / reseq_ros2

High-level ROS2 code to control the ReseQ robot
GNU General Public License v3.0
0 stars 0 forks source link

agevar error #8

Closed Tizio0o0o0o closed 1 year ago

Tizio0o0o0o commented 1 year ago

Should agevar works now?

rinning in terminal 1

ros2 run teleop_twist_keyboard teleop_twist_keyboard

and in terminal 2

ros2 run reseq_ros2 agevar

after any command in terminal 1, this is the output in terminal 2

[INFO] [1686567958.370844236] [agevar]: Starting with parameters a: 0.0, b: 0.0, d: 0.0, r_eq: 0.0, modules: [0], joints: [0]
[INFO] [1686567958.374999549] [agevar]: Agevar node started!
Traceback (most recent call last):
  File "/home/sergio/ros2_ws/install/reseq_ros2/lib/reseq_ros2/agevar", line 33, in <module>
    sys.exit(load_entry_point('reseq-ros2==0.0.0', 'console_scripts', 'agevar')())
  File "/home/sergio/ros2_ws/install/reseq_ros2/lib/python3.10/site-packages/reseq_ros2/agevar.py", line 139, in main
    rclpy.spin(agevar)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py", line 222, in spin
    executor.spin_once()
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 713, in spin_once
    raise handler.exception()
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in __call__
    self._handler.send(None)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 418, in handler
    await call_coroutine(entity, arg)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 343, in _execute_subscription
    await await_or_execute(sub.callback, msg)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
    return callback(*args)
  File "/home/sergio/ros2_ws/install/reseq_ros2/lib/python3.10/site-packages/reseq_ros2/agevar.py", line 80, in remote_callback
    wdx, wsw = self.vel_motors(linear_vel, angular_vel, sign)
  File "/home/sergio/ros2_ws/install/reseq_ros2/lib/python3.10/site-packages/reseq_ros2/agevar.py", line 118, in vel_motors
    wdx = (lin_vel + ang_vel * self.d / 2) / self.r_eq
ZeroDivisionError: float division by zero
[ros2run]: Process exited with failure 1
marc0777 commented 1 year ago

Agevar now needs it's parameters set using ROS parameters. You can to this by using the following sintax:

ros2 run package node --ros-args -p parameter:=value -p parameter2:=value

To make it easier we also made a launch file which handles all the correct parameters. To use it, you can simply:

ros2 launch reseq_ros2 reseq_launch.py config_file:=src/reseq_ros2/config/config_mk2.yaml simulation:=true

The simulation:=true will stop the communication node from starting, since it's not needed.

Eventually this information will be added to the readme.