본문 바로가기

Project/KUSMO

[KUSMO] 2/2~3 (Jetson Nano Navigation Stack 구성 완료)

728x90

2/2

 

  • Jetson Nano Navigation Stack 구성 완료

- Launch File 구성

<?xml version="1.0"?>
<launch>

  <!-- Transformation Configurations --> 
  <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser" args="0.11 0 0.22 0 0 0 base_link laser 30" />
  <!-- base_link to imu_link will be provided by the iahrs_driver -->
  <node pkg="tf" type="static_transform_publisher" name="base_link_broadcaster" args="0 0 0.11 0 0 0 base_footprint base_link 30" />
  <!-- odom to base_footprint transform will be provided by the robot_pose_ekf node -->
  <!-- map to odom will be provided by the AMCL -->
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0 0 0 0 0 0 map odom 30" />

  <!-- Wheel Encoder Tick Publisher and Base Controller Using Arduino -->  
  <!-- motor_controller_diff_drive_2.ino is the Arduino sketch -->
  <!-- Subscribe: /cmd_vel -->
  <!-- Publish: /right_ticks, /left_ticks -->
  <node pkg="rosserial_python" type="serial_node.py" name="serial_node">
    <param name="port" value="/dev/ttyUSB0"/>
    <param name="baud" value="115200"/>
  </node>

  <!-- Lidar Data Publisher Using RPLIDAR from Slamtec -->
  <!-- Used for obstacle avoidance and can be used for mapping --> 
  <!-- Publish: /scan -->
  <node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
    <param name="serial_port"         type="string" value="/dev/ttyRpLidar"/>
    <param name="serial_baudrate"     type="int"    value="115200"/>
    <param name="frame_id"            type="string" value="laser"/>
    <param name="inverted"            type="bool"   value="false"/>
    <param name="angle_compensate"    type="bool"   value="true"/>
  </node>  

  <!-- IMU Data Publisher Using the IAHRS IMU Sensor -->
  <param name="m_bSingle_TF_option" type="bool" value="true" /> <!--false-->
  <node pkg="iahrs_driver" type="iahrs_driver" name="iahrs_driver" output="screen" />

  <!-- Wheel Odometry Publisher -->
  <!-- Subscribe: /right_ticks, /left_ticks, /initial_2d -->
  <!-- Publish: /odom_data_euler, /odom_data_quat -->
  <node pkg="localization_data_pub" type="ekf_odom_pub" name="ekf_odom_pub">
  </node> 
	
  <!-- Extended Kalman Filter from robot_pose_ekf Node-->
  <!-- Subscribe: /odom, /imu_data, /vo -->
  <!-- Publish: /robot_pose_ekf/odom_combined -->
  <remap from="odom" to="odom_data_quat" />
  <remap from="imu_data" to="imu/data" />
  <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf">
    <param name="output_frame" value="odom"/>
    <param name="base_footprint_frame" value="base_footprint"/>
    <param name="freq" value="30.0"/>
    <param name="sensor_timeout" value="1.0"/>
    <param name="odom_used" value="true"/>
    <param name="imu_used" value="true"/>
    <param name="vo_used" value="false"/>
    <param name="gps_used" value="false"/>
    <param name="debug" value="false"/>
    <param name="self_diagnose" value="false"/>
  </node>
	
  <!-- Initial Pose and Goal Publisher -->
  <!-- Publish: /initialpose, /move_base_simple/goal -->
  <!-- Launch Rviz -->
  <node pkg="rviz" type="rviz" name="rviz">
  </node> 

  <!-- Subscribe: /initialpose, /move_base_simple/goal -->
  <!-- Publish: /initial_2d, /goal_2d --> 
  <!-- Launch rviz_click_to_2d node -->
  <node pkg="localization_data_pub" type="rviz_click_to_2d" name="rviz_click_to_2d">
  </node>   

  <!-- Map File -->
  <arg name="map_file" default="/home/kusmo/catkin_ws/maps/test.yaml"/>
	
  <!-- Map Server -->
  <!-- Publish: /map, /map_metadata -->
  <node pkg="map_server" name="map_server" type="map_server" args="$(arg map_file)" />
	
  <!-- Add AMCL example for differential drive robots for Localization -->
  <!-- Subscribe: /scan, /tf, /initialpose, /map -->
  <!-- Publish: /amcl_pose, /particlecloud, /tf -->
  <include file="$(find amcl)/examples/amcl_diff.launch"/>
	
  <!-- Move Base Node -->
  <!-- Subscribe: /move_base_simple/goal -->
  <!-- Publish: /cmd_vel -->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find navstack_pub)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find navstack_pub)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find navstack_pub)/param/local_costmap_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find navstack_pub)/param/global_costmap_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find navstack_pub)/param/base_local_planner_params.yaml" command="load" />
  </node>

</launch>

  • Launch file 실행 결과 (Hector SLAM을 통해 연구실 내의 map을 미리 생성하고 'test'라는 이름으로 저장
  • 두 DC 모터중 한쪽 모터가 회전하면 반대쪽 모터의 엔코더값이 같이 증가하는 문제 발생
    • 코드상의 문제나 노이즈가 원인으로 추정됨
  • base_footprint와 odom간에 X축 상으로 많은 거리차이가 있음

 

  • tf 구성 결과

 

 

 

2/3

  • 각 엔코더의 전원을 따로 공급하여 Encoder 관련 문제 해결
  • L298N의 PWM과 INT 핀을 Arduino에 연결
  • 모터가 직선 방향으로는 잘 주행하나 나머지 방향으로는 제대로 주행하지 못함
  • Lidar가 제대로 동작하지 못함

 

 

 

 

2/5

  • DC Motor Encoder 값 관련 수정
  • 기존 DC 모터에서 BLDC 모터로 변경