ROS_Basics - RicoJia/notes GitHub Wiki
========================================================================
========================================================================
-
Example 1: Pub Sub
-
- logging_and_sleep
- pub_sub()
- sub_bind_spin
- test_server
- remap
-
- rosparam, param
-
-
another node
- private namespace
- latched topic (may not be a good idea for anything related to tf, because if your tf changes, the latched topic will be too old and will not be used)
- Publish laser scan msg
- launch a node
-
another node
-
Additional Notes:
-
source devel/setup.bash
: contains project-specific env variables. There's a globalsource devel/setup.bash
- double tab to auto complete rosservice call /service_name
- Function called by ros upon shutdown. Need to be called explicitly as ros doesn't call del automatically?
- but after sending shutdown signal, we can close the queues and processes
- rospy.on_shutdown(cb) calls cb after some objects get destructed
- object_tracking
-
-
message_filter?
- The tf::MessageFilter will take a subscription to any ros Message with a Header and cache it until it is possible to transform it into the target frame. Once data is ready, you can transform it to
target_frame_
. see tutorial
- The tf::MessageFilter will take a subscription to any ros Message with a Header and cache it until it is possible to transform it into the target frame. Once data is ready, you can transform it to
-
Launch File
-
rjje_arm launch file
- node name
-
roslaunch --wait
will wait for a roscore to come up
-
demo.launch
- include other launch files
- arg, default
-
object_tracking
- get ros param
-
rjje_arm launch file
-
- Affine Transforms
-
tf used in icp project
- Convert
Eigen::Affine3d
totf::Transform
: - publish "static" transform
- Convert
- publish anything related to tf periodically, do not use latched topic
- Tf2, lookup transform, what's improved
-
Laser Scans
-
rostest
-
file structure of a package that goes into python space, ROS Python Package: http://wiki.ros.org/rospy_tutorials/Tutorials/Makefile
ros_utils/setup.py -> scripts as the src folder ros_utils/scripts/SimpleRoboticsPythonUtils/__init__.py ros_utils/scripts/SimpleRoboticsPythonUtils/OtherFiles
-
printing
- enable ros debug: you have to specify a rosconsole config file, then export it to
ROSCONSOLE_CONFIG_FILE
. debug print set up
- enable ros debug: you have to specify a rosconsole config file, then export it to
- see all ros commands
export | grep ROS
- rosbash commands (defined in setup.bash)
roscd package rospack list rospack find # see contents of a package rosls sensor_msgs # Ros bags, <space> for pause rosbag play bag # Ros topic rostopic bw /topic #see bandwidth
- image topics rosbag are slow, they may cause topics not being able to receive the full messages/
========================================================================
========================================================================
-
- base_scan
- 2d lidar
- map msg
- Error subscribing: Character [ ] at element
- scan_matching:
- for every beam in observation, get the end point (x,y), then in the existing map, find nearest obstacle? and calculate the likelihood of that point being an obstacle, which is gaussian()
========================================================================
========================================================================
- move group 讲解
- ROS 中文版 https://www.ncnynl.com/archives/201610/947.html
- Action Server Example: https://github.com/arebgun/dynamixel_motor/blob/master/dynamixel_controllers/src/dynamixel_controllers/joint_trajectory_action_controller.py ========================================================================
========================================================================
-
URDF
-
load a world:
gazebo worlds/pioneer2dx.world
-
spawn a model
gz model -f rjje_arm.xacro.urdf -m "rjje_arm"
. Note that gazebo uses libsdformat, which can read both SDF and URDF files- There might be problems?
-
ROS Controllers
- Types
- effort - output is torque
- input: joint position, velocity, etc.
- joint_state
-
position controller
sudo apt-get install ros-noetic-position-controllers
- velocity controller
- joint_trajecotry
- effort - output is torque
- Hardware interface
- URDF: need gazebo ros_control, transmission
- config: joints (j1, j2), type (controller position), etc.
- launch file: controller manager,
- Setup
- api
rostopic pub /joint_2_controller/command std_msgs/Float64 "data: -1.0"
- Types
========================================================================
========================================================================
========================================================================
========================================================================