ROS杂项

命令类

断网修复

sudo service network-manager stop
sudo rm /var/lib/NetworkManager/NetworkManager.state
sudo service network-manager start

ros查找导航包

rospack plugins --attrib=plugin nav_core

查看c++动态链接库具体报错信息

c++filt

ros启动动态参数服务器

rosrun rqt_reconfigure rqt_reconfigure

保存地图

rosrun map_server map_saver -f 地图名

rviz节点

<node pkg="rviz" type="rviz" name="rviz" required="true" 
          args="-d $(find pid_test)/rviz/test.rviz"/>

apt install 无法获得锁

 sudo rm /var/lib/apt/lists/lock

查看设备端口号

ll /dev/ttyUSB*

查看消息格式

rosmsg show 

tensorflow相关

激活环境

source activate tensorflow

推出环境

 source deactivate

tensorboard查看


tensorboard --logdir=

git pull 命令 | 菜鸟教程icon-default.png?t=M4ADhttps://www.runoob.com/git/git-pull.html

参数类

关于TEB调整参数

1、关于Robot Footprint Model

        机器人模型设置的不好,会使得机器人在避障时表现的非常糟糕,具体参数设置在ros wiki上有详细的解释和办法。

2、关于碰撞、障碍参数:

        min_obstacle_dist :与障碍物期望的最小距离,这个和Robot Footprint Model联系使用,具体模型对于的min_obstacle_dist 不同,大概意思就是加入一个膨胀将小车包裹起来。

        inflation_dist :这个是障碍物周围的缓冲区,进缓冲区会导致规划器减速,不过这个值得比min_obstacle_dist大才有效。可以设置相对小一些,牺牲安全提高速度。

        include_costmap_obstacles:这个必须设置成true才能规避实时探测到的,建图时不存在的障碍物。

        costmap_obstacles_behind_robot_dist:是考虑后方n米范围内的障碍物,设置的越大,考虑范围越广,不过相对而言计算量就越大。

3、优化器的参数:

        penalty_epsilon:这个参数会为速度的约束提供一个缓冲的效果,就是在到达速度限制前会产生一定的惩罚让其提前减速达到缓冲的效果。

        weight_kinematics_forward_drive:这个参数就是倒车,不过这个参数的意思是迫使机器人只选择前进的方向,也就是权重越大,倒车惩罚越大。但是teb不会完全禁止倒车。

        weight_kinematics_turning_radius是机器人最小转向半径的权重,越大则越容易达到最小转向半径的情况。其实我们是不希望到达最小转弯半径的,会使得车辆行驶有很大的顿挫感觉。

        weight_optimaltime:这个参数是最优时间权重,如果大了,那么车会在直道上快速加速。

代价地图:costmap

        配置错误可能会出现没有本地代价地图

        commen:



footprint: [[-0.05,  -0.19], [-0.05, 0.19], [0.45, 0.19], [0.45,-0.19]]
#robot_radius: 0.105


transform_tolerance: 0.2
map_type: costmap

obstacle_layer:
 enabled: true
 obstacle_range: 5.0
 raytrace_range: 5.5
 inflation_radius: 0.2
 track_unknown_space: false
 combination_method: 1

 observation_sources: laser_scan_sensor
 laser_scan_sensor: {data_type: LaserScan, topic: scan, marking: true, clearing: true}


inflation_layer:
  enabled:              true
  cost_scaling_factor:  10.0  # exponential rate at which the obstacle cost drops off (default: 10)
  inflation_radius:     2.5  # max. distance from an obstacle at which costs are incurred for planning paths.

static_layer:
  enabled:              true
  map_topic:            "/map"

        global

global_costmap:
  global_frame: map
  robot_base_frame: base_link

  update_frequency: 10.0
  publish_frequency: 10.0
  transform_tolerance: 0.5

  static_map: true

  plugins:
    - {name: static_layer,            type: "costmap_2d::StaticLayer"}
    - {name: obstacle_layer,          type: "costmap_2d::VoxelLayer"}
    - {name: inflation_layer,         type: "costmap_2d::InflationLayer"}

 

        local:

local_costmap:
  global_frame: odom
  robot_base_frame: base_link

  update_frequency: 10.0
  publish_frequency: 10.0
  transform_tolerance: 0.5  

  static_map: false  
  rolling_window: true
  width: 3
  height: 3
  resolution: 0.05

  map_type: costmap
  observation_sources: scan
  scan: {sensor_frame: base_scan, data_type: LaserScan, topic: scan, marking: true, clearing: true}


  plugins:
   - {name: static_layer,        type: "costmap_2d::StaticLayer"}
   - {name: obstacle_layer,      type: "costmap_2d::ObstacleLayer"}

利用turtlebot创建gazebo中世界的map

1、将turtlebot3_world.launch 中的

<arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_world.world"/>

修改为你想要扫的world。并 roslaunch

2、启动slam

roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping

3、启动键盘控制

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

4、代码保存

rosrun map_server map_saver -f ~/racemap

opencv-python相关API

1、打开摄像头

import cv2

cap = cv2.VideoCapture(0)
while True:
    ret_,fram = cap.read()
    cv2.imshow('fram',fram)
    if cv2.waitKey(1)& 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()

2、opencv默认的颜色排列为BGR对图片显示之前的图片颜色处理

#灰度    
gray = cv2.cvtColor(fram,cv2.COLOR_BGR2GRAY)
#hsv
hsv = cv2.cvtColor(fram,cv2.COLOR_BGR2HSV)
#rgb
rgb = cv2.cvtColor(fram,cv2.COLOR_BGR2RGB)

3、cv画图、添加字

  # 矩形
cv2.rectangle(fram, (350, 0), (500, 250), (0, 255, 0), 1)
    # 圆形
cv2.circle(fram, (255, 255), 100, (255, 0, 0), 1)
    # 加字体
cv2.putText(fram, 'python', (100, 100),cv2.FONT_HERSHEY_SCRIPT_SIMPLEX,4,(255,255,255),2,cv2.LINE_AA)

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值