Ros package run my code with problem : resource not found : core_api

#1

i am wrote a python code and i use flyt_python api on my code
the i create a ros package to run the python code
but all the module work well except api.navigation()
when i call it show me the bellow problem:ResourceNotFound: core_api

import api successed
[pyros_ros] Proc started as [17200]
<pyzmp.service.Service object at 0x8eac8570> MSGBUILDSVC
[INFO] [1557488253.829469]: RosInterface pyros_ros node started with args : []
[INFO] [1557488253.846592]: [pyros.rosinterface.ros_interface] ROS Interface initialized with:
- services :
- /get_global_namespace
- /./navigation/arm
- /.
/navigation/disarm
- /./navigation/land
- /.
/navigation/take_off
- /./navigation/position_hold
- /.
/navigation/position_set
- /./navigation/position_set_global
- /.
/navigation/velocity_set
- /./navigation/exec_script
- /.
/navigation/waypoint_get
- /./navigation/waypoint_set
- /.
/navigation/waypoint_execute
- /./navigation/waypoint_clear
- /.
/navigation/waypoint_pause
- /./navigation/waypoint_set_current
- /.
/navigation/set_home
- /./navigation/rtl
- /.
/payload/gimbal_set
- /./param/param_set
- /.
/param/param_get_all
- /./param/param_get
- /.
/param/param_save
- /./param/param_load
- /.
/param/param_create
- /./param/param_delete
- /.
/param/param_reset
- topics :
- /./mavros/state
- /.
/mavros/imu/data
- /./mavros/imu/data_euler
- /.
/mavros/local_position/local
- /./mavros/global_position/global
- /.
/mavros/battery
- /./mavros/vfr_hud
- /.
/mavros/rc/in
- /./mavros/distance_sensor/lidarlite_pub
- /.
/flyt/state
- /.*/mavros/payload_adc
- params : []
- enable_cache : False
-
Process pyros_ros:
Traceback (most recent call last):
File “/usr/lib/python2.7/multiprocessing/process.py”, line 258, in _bootstrap
self.run()
File “/usr/lib/python2.7/multiprocessing/process.py”, line 114, in run
self._target(*self._args, **self._kwargs)
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/pyros_ros.py”, line 165, in run
File “/usr/local/lib/python2.7/dist-packages/pyzmp/coprocess.py”, line 455, in run
exitstatus = self.eventloop(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/pyzmp/coprocess.py”, line 418, in eventloop
status = self._target(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/pyzmp/node.py”, line 250, in receive_reply
self._loop_target(*args, **kwargs)
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/basenode.py”, line 210, in update
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/rosinterface/ros_interface.py”, line 659, in update
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/baseinterface/baseinterface.py”, line 511, in update
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/baseinterface/baseinterface.py”, line 215, in _transient_change_detect
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/baseinterface/baseinterface.py”, line 246, in _transient_change_diff
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/baseinterface/baseinterface.py”, line 132, in _update_transients
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/baseinterface/baseinterface.py”, line 123, in _update_transients
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/rosinterface/ros_interface.py”, line 152, in ServiceMaker
File “/flyt/flytos/flytcore/lib/python2.7/dist-packages/pyros/rosinterface/service.py”, line 50, in init
File “/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py”, line 62, in load_manifest
sys.path = _generate_python_path(package_name, _rospack) + sys.path
File “/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py”, line 93, in _generate_python_path
m = rospack.get_manifest(pkg)
File “/usr/lib/python2.7/dist-packages/rospkg/rospack.py”, line 167, in get_manifest
return self._load_manifest(name)
File “/usr/lib/python2.7/dist-packages/rospkg/rospack.py”, line 211, in _load_manifest
retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self)
File “/usr/lib/python2.7/dist-packages/rospkg/rospack.py”, line 203, in get_path
raise ResourceNotFound(name, ros_paths=self._ros_paths)
> ResourceNotFound: core_api
> ROS path [0]=/opt/ros/kinetic/share/ros
> ROS path [1]=/home/odroid/catkin_ws/src
> ROS path [2]=/opt/ros/kinetic/share

#2

can anyone help me please?

#3

It is a sourcing issue.
You have sourced a catkin workspace placed at ’ /home/odroid/catkin_ws/src’ in your /home/odroid/.bashrc file.

Please remove the above line and any line pertaining to ROS from .bashrc file
Open a new terminal, FlytOS and its APIs will work just fine.

To use your workspace,

  • open a new terminal, and go to your workspace
  • clean up the build and devel folder of workspace
  • compile it again.
  • add this line: source /home/odroid/catkin_ws/devel/setup.bash in .bashrc file
#4

thanks for your answer
but in my /home/odroid/.bashrc does not have any line to point to ros.
my FlytOS and all API work well out of the ros package and i run the python file and API properly.
but when i use ros package i am faced with core_api problem.
i did your solution but it doesnt work.
i cleaned up the build and devel folders and i compiled it again and i added the source /home/odroid/catkin_ws/devel/setup.bash to .bashrc and sourced it again. However, the problem has still remained.
my package name is auto and my launch file is auto_drone.launch. and i run it by

roslaunch auto auto_drone.launch

in my launch file i wrote these lines:

<node name="drone_auto_final" pkg="auto" type="drone_auto_final.py" output="screen" />

all the codes and modules was compiled and executed properly but when i run this line below

from flyt_python import api
drone=api.navigation()

the problem happen.
Thanks for your attention in advance. I was wondering to reply.

#5

hello
my problem is solved.
very thanks for your answer.
i added some sources to my code and its my mistake.