ceinem / dji_rs2_ros_controller

24 stars 4 forks source link

problem launching #2

Closed rileycoyote87 closed 2 years ago

rileycoyote87 commented 2 years ago

after building have an error on line 12/15 what did i do wrong?

started roslaunch server http://fx-VirtualBox:40353/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.14
 * /socketcan_bridge/can_device: can0

NODES
  /
    dji_rs2_ros_controller (dji_rs2_ros_controller/can_bus_controller.py)
    socketcan_bridge (socketcan_bridge/socketcan_bridge_node)

ROS_MASTER_URI=http://localhost:11311

process[dji_rs2_ros_controller-1]: started with pid [28571]
process[socketcan_bridge-2]: started with pid [28572]
[ INFO] [1665467928.463637437]: Successfully connected to can0.
Traceback (most recent call last):
  File "/home/fx/catkin_ws/devel/lib/dji_rs2_ros_controller/can_bus_controller.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/fx/catkin_ws/src/dji_rs2_ros_controller/dji_rs2_ros_controller/scripts/can_bus_controller.py", line 12, in <module>
    from dji_rs2_ros_controller.srv import *
ModuleNotFoundError: No module named 'dji_rs2_ros_controller'
[dji_rs2_ros_controller-1] process has died [pid 28571, exit code 1, cmd /home/fx/catkin_ws/devel/lib/dji_rs2_ros_controller/can_bus_controller.py __name:=dji_rs2_ros_controller __log:=/home/fx/.ros/log/fcebd90a-4928-11ed-992d-1967398312aa/dji_rs2_ros_controller-1.log].
log file: /home/fx/.ros/log/fcebd90a-4928-11ed-992d-1967398312aa/dji_rs2_ros_controller-1*.log
ceinem commented 2 years ago

yeah, maybe the build instructions should be more extensive. For building python ros packages, you need to make the python script an executable, using chmod +x dji_rs2_ros_controller/scripts/can_bus_controller.py Then build using catkin build dji_rs2_ros_controller. Then source your workspace using source devel/setup.bash. Let me know if that works.

rileycoyote87 commented 2 years ago

checked mutliple, src, devel, build, ones before and after compiling, same error I'm running this for testing purposes without a connection to the actual H/L/GND pins right now. that shouldn't make a difference?

fx@fx-VirtualBox:~/catkin_ws/build/dji_rs2_ros_controller/dji_rs2_ros_controller/catkin_generated/installspace$ ls -l can_bus_controller.py -rwxrwxr-x 1 fx fx 11802 okt 11 10:55 can_bus_controller.py

fx@fx-VirtualBox:~/catkin_ws/devel/lib/dji_rs2_ros_controller$ ls -l can_bus_controller.py -rwxr-xr-x 1 fx fx 595 okt 11 10:51 can_bus_controller.py

Error is the same

[ INFO] [1665479792.355170541]: Successfully connected to can0.
Traceback (most recent call last):
  File "/home/fx/catkin_ws/devel/lib/dji_rs2_ros_controller/can_bus_controller.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/fx/catkin_ws/src/dji_rs2_ros_controller/dji_rs2_ros_controller/scripts/can_bus_controller.py", line 12, in <module>
    from dji_rs2_ros_controller.srv import *
ModuleNotFoundError: No module named 'dji_rs2_ros_controller'
[dji_rs2_ros_controller-2] process has died [pid 66846, exit code 1, cmd /home/fx/catkin_ws/devel/lib/dji_rs2_ros_controller/can_bus_controller.py __name:=dji_rs2_ros_controller __log:=/home/fx/.ros/log/65405802-4945-11ed-9f6d-2983ca5ac5a2/dji_rs2_ros_controller-2.log].
log file: /home/fx/.ros/log/65405802-4945-11ed-9f6d-2983ca5ac5a2/dji_rs2_ros_controller-2*.log

Also I had to manually install muparser dependencies

This is at the bottom of my .bashrc file

source /opt/ros/noetic/setup.bash source ~/catkin_ws/devel/setup.bash

ceinem commented 2 years ago

What is in your catkin_ws/src folder? there you should have the this package. and within this package in the scripts folder you need to make the python script executable with chmod +x can_bus_controller.py. Don't adjust anything in the catkin_ws/devel oder catkin_ws/build directories, only in catkin_ws/src. You can do catkin clean to reset them.

Then you can build the package, then you can source it using source ~/catkin_ws/devel/setup.bash

rileycoyote87 commented 2 years ago

have been able to run ros examples and bag recording/playback

too many levels down? i used the git clone on the readme

inside catkin_ws/src

-dji_rs2_ros_controller -----dependencies -----dji_rs2_ros_controller -----readme.md

- CMakeLists.txt

it builds but says 5 skipped followed all instructions to the T, same error over and over have changed permissions. reinstalled, re-imaged, etc.

`fx@fx-VirtualBox:~/catkin_ws/src$ catkin build dji_rs2_ros_controller
-------------------------------------------------------
Profile:                     default
Extending:             [env] /opt/ros/noetic
Workspace:                   /home/fx/catkin_ws
-------------------------------------------------------
Build Space:        [exists] /home/fx/catkin_ws/build
Devel Space:        [exists] /home/fx/catkin_ws/devel
Install Space:      [unused] /home/fx/catkin_ws/install
Log Space:         [missing] /home/fx/catkin_ws/logs
Source Space:       [exists] /home/fx/catkin_ws/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Buildlisted Packages:        None
Skiplisted Packages:         None
-------------------------------------------------------
Workspace configuration appears valid.

NOTE: Forcing CMake to run for each package.
-------------------------------------------------------
[build] Found 9 packages in 0.0 seconds.                                       
[build] Updating package table.                                                
Starting  >>> catkin_tools_prebuild                                            
Finished  <<< catkin_tools_prebuild                 [ 1.0 seconds ]            
Starting  >>> can_msgs                                                         
Finished  <<< can_msgs                              [ 2.5 seconds ]            
Starting  >>> socketcan_interface                                              
Finished  <<< socketcan_interface                   [ 9.1 seconds ]            
Starting  >>> socketcan_bridge                                                 
Finished  <<< socketcan_bridge                      [ 16.6 seconds ]           
Starting  >>> dji_rs2_ros_controller                                           
Finished  <<< dji_rs2_ros_controller                [ 1.1 seconds ]            
[build] Summary: All 5 packages succeeded!                                     
[build]   Ignored:   5 packages were skipped or are skiplisted.                
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    None.                                                     
[build] Runtime: 30.2 seconds total.                                           
[build] Note: Workspace packages have changed, please re-source setup files to use them.
fx@fx-VirtualBox:~/catkin_ws/src$ `
rileycoyote87 commented 2 years ago

what version of linux and ros distro was this using? seems melodic on 18.04?

ceinem commented 2 years ago

From that log it seems to build fine. I think back then I programmed it on 18 with melodic, but it's also working fine on my 20/focal.

From your previous log file it seems like it has issues to import the service definitions from the srv directory. I don't really know what the issue is there, maybe because you have two directories called dji_rs2_ros_controller within each other (one from the git repo, one from the ros package). Maybe try renaming the top level one of those two, then do catkin clean, catkin build and source the workspace again. Let me know if this works.

rileycoyote87 commented 2 years ago

it does not, even when moving things around and removing top level. again it shouldnt be a problem to launch that I dont have pins connected right now?

INFO] [1665571866.881399238]: Successfully connected to can0. Traceback (most recent call last): File "/home/rh/catkin_ws/devel/lib/dji_rs2_ros_controller/can_bus_controller.py", line 15, in <module> exec(compile(fh.read(), python_script, 'exec'), context) File "/home/rh/catkin_ws/src/dji_rs2_ros_controller/scripts/can_bus_controller.py", line 12, in <module> from dji_rs2_ros_controller.srv import * ModuleNotFoundError: No module named 'dji_rs2_ros_controller' [dji_rs2_ros_controller-2] process has died [pid 61479, exit code 1,

directory tree of ~/catkin_ws/src is as follows


`rh@rh:~/catkin_ws/src$ tree
.
├── CMakeLists.txt -> /opt/ros/noetic/share/catkin/cmake/toplevel.cmake
├── dependencies
│   └── ros_canopen
│       ├── can_msgs
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   ├── msg
│       │   │   └── Frame.msg
│       │   └── package.xml
│       ├── canopen_402
│       │   ├── canopen_402_plugin.xml
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   ├── include
│       │   │   └── canopen_402
│       │   │       ├── base.h
│       │   │       └── motor.h
│       │   ├── package.xml
│       │   ├── src
│       │   │   ├── motor.cpp
│       │   │   └── plugin.cpp
│       │   └── test
│       │       └── clamping.cpp
│       ├── canopen_chain_node
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   ├── include
│       │   │   └── canopen_chain_node
│       │   │       └── ros_chain.h
│       │   ├── launch
│       │   │   └── chain.launch
│       │   ├── package.xml
│       │   ├── src
│       │   │   ├── chain_node.cpp
│       │   │   ├── ros_chain.cpp
│       │   │   ├── rosconsole_bridge.cpp
│       │   │   └── sync_node.cpp
│       │   └── srv
│       │       ├── GetObject.srv
│       │       └── SetObject.srv
│       ├── canopen_master
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   ├── include
│       │   │   └── canopen_master
│       │   │       ├── bcm_sync.h
│       │   │       ├── can_layer.h
│       │   │       ├── canopen.h
│       │   │       ├── exceptions.h
│       │   │       ├── layer.h
│       │   │       ├── objdict.h
│       │   │       └── timer.h
│       │   ├── master_plugin.xml
│       │   ├── package.xml
│       │   ├── src
│       │   │   ├── bcm_sync.cpp
│       │   │   ├── emcy.cpp
│       │   │   ├── master_plugin.cpp
│       │   │   ├── node.cpp
│       │   │   ├── objdict.cpp
│       │   │   ├── pdo.cpp
│       │   │   └── sdo.cpp
│       │   └── test
│       │       ├── test_node.cpp
│       │       └── test_parser.cpp
│       ├── canopen_motor_node
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   ├── include
│       │   │   └── canopen_motor_node
│       │   │       ├── controller_manager_layer.h
│       │   │       ├── handle_layer_base.h
│       │   │       ├── handle_layer.h
│       │   │       ├── motor_chain.h
│       │   │       ├── robot_layer.h
│       │   │       └── unit_converter.h
│       │   ├── package.xml
│       │   ├── src
│       │   │   ├── canopen_motor_chain_node.cpp
│       │   │   ├── controller_manager_layer.cpp
│       │   │   ├── handle_layer.cpp
│       │   │   ├── interface_mapping.h
│       │   │   ├── motor_chain.cpp
│       │   │   └── robot_layer.cpp
│       │   └── test
│       │       └── test_muparser.cpp
│       ├── CONTRIBUTING.md
│       ├── LICENSE
│       ├── README.md
│       ├── ros_canopen
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   └── package.xml
│       ├── socketcan_bridge
│       │   ├── CHANGELOG.rst
│       │   ├── CMakeLists.txt
│       │   ├── include
│       │   │   └── socketcan_bridge
│       │   │       ├── socketcan_to_topic.h
│       │   │       └── topic_to_socketcan.h
│       │   ├── package.xml
│       │   ├── src
│       │   │   ├── rosconsole_bridge.cpp
│       │   │   ├── socketcan_bridge_node.cpp
│       │   │   ├── socketcan_to_topic.cpp
│       │   │   ├── socketcan_to_topic_node.cpp
│       │   │   ├── topic_to_socketcan.cpp
│       │   │   └── topic_to_socketcan_node.cpp
│       │   └── test
│       │       ├── initialize_vcan.sh
│       │       ├── test_conversion.cpp
│       │       ├── to_socketcan.test
│       │       ├── to_socketcan_test.cpp
│       │       ├── to_topic.test
│       │       ├── to_topic_test.cpp
│       │       └── vcan0_to_vcan1.launch
│       └── socketcan_interface
│           ├── CHANGELOG.rst
│           ├── CMakeLists.txt
│           ├── include
│           │   └── socketcan_interface
│           │       ├── asio_base.h
│           │       ├── bcm.h
│           │       ├── delegates.h
│           │       ├── dispatcher.h
│           │       ├── dummy.h
│           │       ├── filter.h
│           │       ├── interface.h
│           │       ├── logging.h
│           │       ├── make_shared.h
│           │       ├── reader.h
│           │       ├── settings.h
│           │       ├── socketcan.h
│           │       ├── string.h
│           │       ├── threading.h
│           │       └── xmlrpc_settings.h
│           ├── package.xml
│           ├── socketcan_interface_plugin.xml
│           ├── src
│           │   ├── canbcm.cpp
│           │   ├── candump.cpp
│           │   ├── socketcan_interface_plugin.cpp
│           │   └── string.cpp
│           └── test
│               ├── test_delegates.cpp
│               ├── test_dispatcher.cpp
│               ├── test_dummy_interface.cpp
│               ├── test_filter.cpp
│               ├── test_settings.cpp
│               └── test_string.cpp
└── dji_rs2_ros_controller
    ├── CMakeLists.txt
    ├── launch
    │   └── gimbal_control.launch
    ├── package.xml
    ├── scripts
    │   ├── can_bus_controller.py
    │   └── check_sum.py
    └── srv
        ├── AddTwoInts.srv
        ├── SendJointPos.srv
        └── SendJointSpeed.srv

40 directories, 122 files
`
ceinem commented 2 years ago

No, having the gimbal not connected shouldn't be an issue.

It's still some issue with importing the ROS service definition into the main script. Can you type rossrv list in your terminal. It should return a long list of standard services, and somewhere in between should be the two dji_rs2 services. if they're not there, then something is going wrong in building the package.

rileycoyote87 commented 2 years ago
dji_rs2_ros_controller/AddTwoInts

dji_rs2_ros_controller/SendJointPos

dji_rs2_ros_controller/SendJointSpeed
ceinem commented 2 years ago

maybe try adding an empty file called __init__.py to the scripts directory. Then clean, re-build, re-source.

rileycoyote87 commented 2 years ago

same error, same services listed with rossrv list

[ INFO] [1665579955.996225906]: Successfully connected to can0.
Traceback (most recent call last):
  File "/home/rh/catkin_ws/devel/lib/dji_rs2_ros_controller/can_bus_controller.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/rh/catkin_ws/src/dji_rs2_ros_controller/scripts/can_bus_controller.py", line 12, in <module>
    from dji_rs2_ros_controller.srv import *
ModuleNotFoundError: No module named 'dji_rs2_ros_controller'
ceinem commented 2 years ago

I have no idea. Some more things to try:

  1. add a __init__.py file to the srv directory.
  2. Manually delete the build and devel folders in catkin_ws
  3. build again
  4. source again
rileycoyote87 commented 2 years ago

Resolved I think it has to do with following a guide that installs a 2nd catkin instead of the native being used from the ros install. that was a headspin. Im going to see how it goes with ros bags now. phew! thanks