New node [Python]. Which must be declared?
I took a node from someone, but just the .py file. I'm trying to build the package using catkincreatepackage, but I don't know which one of these packages must be declared.
This is how the script starts:
#!/usr/bin/env python
import rospy
import sys
from std_msgs.msg import String
from std_msgs.msg import Empty
from geometry_msgs.msg import Twist
from ardrone_autonomy.msg import Navdata
import threading
import tf
import time
from std_msgs.msg import Empty
from nav_msgs.msg import Odometry
from sensor_msgs.msg import Image, CameraInfo, CompressedImage
from cv_bridge import CvBridge, CvBridgeError
import cv2
from geometry_msgs.msg import Twist
from geometry_msgs.msg import PoseStamped
import numpy as np
from states_variables.ARdroneStateVariables import ARdroneStateVariables
Can anyone please help me? I googled a lot but didn't find what I need. I'm using ROS kinetic and Gazebo 7
Asked by Dylan on 2018-10-15 18:41:37 UTC
Answers
in terminal go to catkin_ws/src and type:
$catkin_create_pkg pkg_name rospy std_msgs geometry_msgs ardrone_autonomy tf nav_msgs sensor_msgs cv_bridge geometry_msgs
and out your code in src folder of your pkg and make catkin
Asked by Hamid Didari on 2018-10-15 23:52:46 UTC
Comments
But why do you declare just those and you don’t declare, for example, sys or threading or time or cv2? Thanks
Asked by Dylan on 2018-10-16 05:26:18 UTC
there is two type of import one of from ros pkg and one of python lib , in this example i know which one is ros pkg and which one is not .
Asked by Hamid Didari on 2018-10-16 06:03:55 UTC
So, you're saying that the ros packages must be declared but not the python libraries? In the future, how would I know which one is one type or the other?
Asked by Dylan on 2018-10-17 08:57:45 UTC
@Dylan this is how you know if it's a ROS package. Basically, it has a compliant package.xml
, contains a CMakeLists.txt
which uses catkin
, and ...
Asked by jayess on 2019-01-17 17:37:19 UTC
has its own folder.
Asked by jayess on 2019-01-17 17:37:33 UTC
Comments