Why switching_state does not work properly ?

asked 2020-01-06 14:21:51 -0500

Piotr70 gravatar image

updated 2020-01-06 14:35:18 -0500

gvdhoorn gravatar image

I am a beginner in ROS. Earlier I asked a question in the forum but I think it was not precise and understandable. I was able to run using canopen_motor_node and canopen_chain_node ELMO GOLD series controller. Running it using canopen_chain_node, I can freely control all device states with getObject STATUSWORD and setObject CONTROLWORD.

Running canopen_motor_node, the switching_state does not work properly after calling /driver/init service. Regardless of the switching_state value, whether it is 2,3,4 or 5, the controller switches to OPERATION ENABLED mode after starting. The device behaves the same for the PP and PV controller. I think this is not the normal behavior of the canopen_motor_node module. Maybe I didn't understand something. Is this a configuration problem? Or maybe the problem is with my device?

my init yaml file:

  device: slcan0 # socketcan network
  loopback: false # socket should loop back messages    
  driver_plugin: can::SocketCANInterface
  master_allocator: canopen::SimpleMaster::Allocator
  interval_ms: 10 # set to 0 to disable sync
  # update_ms: <interval_ms> #update interval of control loop, must be set explecitly if sync is disabled
  overflow: 0 # overflow sync counter at value or do not set it (0, default)
# struct syntax
    id: 127
    eds_pkg: can_test # optionals package name for relative path
    eds_file: "config/CANedsGoldV003.eds" # path to EDS/DCF file
defaults: # optional, all defaults can be overwritten per node
  # canopen_chain_node settings ..
  motor_allocator: canopen::Motor402::Allocator # select allocator for motor layer
  motor_layer: # settings passed to motor layer (plugin-specific)
    switching_state: 4 # (Operation_Enable), state for mode switching
  pos_to_device: "rint(rad2deg(pos)*1000)" # rad -> mdeg
  pos_from_device: "deg2rad(obj6064)/1000" # actual position [mdeg] -> rad
  vel_to_device: "rint(rad2deg(vel)*1000)" # rad/s -> mdeg/s
  vel_from_device: "deg2rad(obj606C)/1000" # actual velocity [mdeg/s] -> rad/s
  eff_to_device: "rint(eff)" # just round to integer
  eff_from_device: "0" # unset
# dcf_overlay: # "ObjectID": "ParameterValue" (both as string)

my controller yaml file:

  type: "position_controllers/JointPositionController"
  joint: node1
  required_drive_mode: 1

  type: "velocity_controllers/JointVelocityController"
  joint: node1
  required_drive_mode: 3

  type: "joint_state_controller/JointStateController"
    - node1
  publish_rate: 50

my URDF file:

<robot name="knee">
  <link name="link1" />
  <link name="link2" />

  <joint name="node1" type="continuous">
    <parent link="link1"/>
    <child link="link2"/>
    <origin xyz="1 0 0" rpy="0 0 0" />
    <axis xyz="1 0 0" />

my launch file:

<?xml version="1.0" encoding="UTF-8"?>
  <!-- URDF -->
  <param name="robot_description" textfile="$(find can_test)/config/robot_description.urdf"/>
  <node name="joint_state_pub" pkg="joint_state_publisher" type="joint_state_publisher" >
  <!-- canopen_motor_node -->
  <node name="motor" pkg="canopen_motor_node" type="canopen_motor_node">
    <rosparam command="load" file="$(find can_test)/config/can_config.yaml" />

  <!-- controller -->
  <rosparam command="load" file="$(find can_test)/config/controller.yaml" />

  <!-- load_controllers -->
  <node name="controller" pkg="controller_manager" type="controller_manager" args="spawn joint_velocity_controller joint_state_controller" respawn="false" output="screen"/>

  <node name="rqt_publisher" pkg="rqt_publisher" type="rqt_publisher" />
  <node name="rqt_topic" pkg="rqt_topic" type="rqt_topic" />
  <node name="rqt_service_caller1" pkg="rqt_service_caller" type="rqt_service_caller" />
  <node name="rqt_service_caller2" pkg="rqt_service_caller" type="rqt_service_caller ...
edit retag flag offensive close merge delete


Hello @Piotr70 , have you found any solution?

martinlucan gravatar image martinlucan  ( 2021-08-30 09:12:03 -0500 )edit