Skip to content

Instantly share code, notes, and snippets.

@Nasupl
Nasupl / roslaunch_api.py
Last active May 13, 2016 20:37
roslaunchのapiの使い方
import rospkg
import roslaunch
# パッケージパスの取得
rospack = rospkg.RosPack()
pkg_path = rospack.get_path('cit_bringup')
launch_path = path + '/launch/cit.launch'
# uuidの取得とロギング設定
uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
@Nasupl
Nasupl / pose_pub.py
Last active April 27, 2017 07:32
amclにinitalpose投げるやつ.roshから使ってね.カバリアンスはガバリアンスだけど許してね.
import rospy
from std_msgs.msg import Header
from geometry_msgs.msg import Pose, Point, Quaternion, PoseWithCovariance, PoseWithCovarianceStamped
from tf.transformations import quaternion_from_euler
def publish_pose(x, y, z, yaw):
pub = rospy.Publisher('initialpose', PoseWithCovarianceStamped, queue_size=10)
point = Point(x, y, z)
q = quaternion_from_euler(0.0, 0.0, yaw).tolist()
@Nasupl
Nasupl / result
Created August 23, 2017 04:56
vectorをインデックスをつけたままラムダ式でsortする
before sort
0 3
1 7
2 1
3 2
4 9
5 4
6 6
after sort
2 1