Answer
stringlengths 44
28.2k
β | Id
stringlengths 1
6
| CreationDate
stringlengths 23
23
| Tags
stringlengths 4
94
| Body
stringlengths 54
35.7k
| Title
stringlengths 13
150
|
---|---|---|---|---|---|
<p>You can use the CollisionMonitor package inside the Nav2 Stack.</p>
<p>Here is a tutorial: <a href="https://navigation.ros.org/tutorials/docs/using_collision_monitor.html#using-collision-monitor" rel="nofollow noreferrer">Using Collision Monitor</a> and here are the sources <a href="https://github.com/ros-planning/navigation2/tree/main/nav2_collision_monitor" rel="nofollow noreferrer">Github</a></p>
| 108131 | 2024-02-07T20:59:19.577 | |navigation|ros2|nav2|avoid-obstacle| | <p>I am using the navigation stack (nav2) without problems, but I would like to understand how I can make the robot stop from its path if it finds a dynamic obstacle in front of it (at a minimum distance of n metres)?</p>
<p>Is there a demo or tutorial to take inspiration from?</p>
<p>many thanks in advance</p>
| Make the robot stop if it finds an obstacle in front |
<p>Have a look at <a href="https://github.com/PickNikRobotics/topic_based_ros2_control/blob/37a98e652818ac4b884786558a2f3c0373415c16/src/topic_based_system.cpp#L149" rel="nofollow noreferrer">this implementation of
topic_based_ros2_control</a> here.</p>
<p>Note that in general, it is not recommended to use a node inside the hardware interface if you have realtime requirements. Write your custom controller with realtime-safe implementations instead.</p>
| 108134 | 2024-02-07T22:09:59.187 | |ros2|ros2-control|hardware-interface| | <p>Is there any example for adding subscriber to hardware interface ? Publisher works fine.
My code is below, I dont know where its going wrong but unable to get values after publishing using CLI.</p>
<p>.hpp file
'''</p>
<blockquote>
<p>namespace diffdrive_ctre { class HardwareCommandPub : public
rclcpp::Node { public:</p>
<pre><code>HardwareCommandPub();
void publishData();
void pincmdcheck();
</code></pre>
<p>private:
rclcpp::Publisher<amr_v4_msgs_srvs::msg::Motor>::SharedPtr pub_;
rclcpp::Publisher<std_msgs::msg::Bool>::SharedPtr estop_pub_;
rclcpp::Subscription<amr_v4_msgs_srvs::msg::Pin>::SharedPtr pin_sub_;
rclcpp::TimerBase::SharedPtr timer_;
amr_v4_msgs_srvs::msg::Pin latest_pin_cmd; };</p>
<p>class DiffDriveCTREHardware : public
hardware_interface::SystemInterface {</p>
</blockquote>
<p>'''
.cpp file</p>
<blockquote>
<p>HardwareCommandPub::HardwareCommandPub() : Node("Motor_Status") {</p>
<p>pub_ =
this->create_publisher<amr_v4_msgs_srvs::msg::Motor>("talonFX_right/status",
10); estop_pub_ =
this->create_publisher<std_msgs::msg::Bool>("/e_stop", 10); pin_sub_
= this->create_subscription<amr_v4_msgs_srvs::msg::Pin>("/amr/pin_cmd",
10,
[this](const amr_v4_msgs_srvs::msg::Pin::SharedPtr pin_cmd) { latest_pin_cmd = *pin_cmd; });</p>
<p>}</p>
<p>void HardwareCommandPub::publishData() { // //motor1 auto message
= amr_v4_msgs_srvs::msg::Motor(); message.temperature_right = motor_right.GetDeviceTemp().ToString(); message.bus_voltage_right =
motor_right.GetSupplyVoltage().ToString();<br />
message.output_current_right =
motor_right.GetStatorCurrent().ToString(); message.error_right =
motor_right.GetStickyFault_Hardware().ToString();</p>
<p>// //motor2 message.temperature_left =
motor_left.GetDeviceTemp().ToString(); message.bus_voltage_left =
motor_left.GetSupplyVoltage().ToString();<br />
message.output_current_left =
motor_left.GetStatorCurrent().ToString(); message.error_left =
motor_left.GetStickyFault_Hardware().ToString();</p>
<pre><code>// //motor pin message.temperature_pin = pin_motor.GetDeviceTemp().ToString(); message.bus_voltage_pin =
</code></pre>
<p>pin_motor.GetSupplyVoltage().ToString(); message.output_current_pin
= pin_motor.GetStatorCurrent().ToString(); message.error_pin = pin_motor.GetStickyFault_Hardware().ToString();</p>
<p>//estop auto message_estop = std_msgs::msg::Bool();<br />
message_estop.data = estop_temp; if (rclcpp::ok()) {
estop_pub_->publish(message_estop);
pub_->publish(message);
pincmdcheck(); } }</p>
<p>void HardwareCommandPub::pincmdcheck() { pin_temp =
latest_pin_cmd.pin_command; RCLCPP_INFO(
rclcpp::get_logger("Pin test"),
"Got pin cmd '%i'and '%i' and '%s'!",pin_temp,latest_pin_cmd.pin_command); }</p>
</blockquote>
<p><a href="https://i.stack.imgur.com/83BQJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/83BQJ.png" alt="enter image description here" /></a></p>
| Subscriber in Hardware Interface (ros2_control) |
<p>I almost forgot to answer my own question, but here is what I found works. The comments should be helpful in telling what each line does</p>
<pre><code>// use Octomap iterator to find colors, first deserialize
octomap::AbstractOcTree* tree = octomap_msgs::msgToMap(octomap_msg);
ROS_INFO("Deserialized Octomap");
// going from base to derived types (Abstract -> Color)
octomap::ColorOcTree* octree = dynamic_cast<octomap::ColorOcTree*>(tree);
ROS_INFO("Dynamic Casted");
// iterator
for(octomap::ColorOcTree::leaf_iterator it = octree->begin_leafs(), end = octree->end_leafs(); it!=end; ++it){
// ROS_INFO("In iterator");
// get color -> class octomap::ColorOcTreeNode::Color has three fields r, g, b (0 to 255)
octomap::ColorOcTreeNode::Color currentColor = it->getColor();
// ROS_INFO("Color extracted");
// ROS_INFO_STREAM("R is " << currentColor.r << " G is " << currentColor.g << " B is " << currentColor.b << '\n');
<span class="math-container">```</span>
</code></pre>
| 108137 | 2024-02-07T23:36:45.497 | |ros|slam|octomap| | <p>is there any way to get the color of each voxel in an Octomap as it is being built in real-time? The package I am looking at, <a href="https://github.com/floatlazer/semantic_slam" rel="nofollow noreferrer">https://github.com/floatlazer/semantic_slam</a>, is a semantic SLAM package which assigns colors to different parts of the Octomap based on what the object is. I would like to extract and use those colors to allow a robot to navigate to a desired type of object.</p>
<p>Is there a way to do this? I saw that Octomap has a conversions.h file, but I am not sure how to use it since I am a bit new to using Octomap.</p>
| Extract color from Octomap |
<p>In addition to the above comment, you will never be able to source that much power from a pair of 9 Volt batteries. If you do use a battery eliminator circuit keep in mind that they operate in the linear regime and are therefor not very efficient. You would be better off using switch mode DC to DC converters and a LiPo battery. There are lots of options, look at spark fun and find the ratings you need. Here is a <a href="https://www.sparkfun.com/products/9370" rel="nofollow noreferrer">link</a> to a converter and <a href="https://www.sparkfun.com/categories/tags/power" rel="nofollow noreferrer">here</a> are some batteries. If you need to increase the voltage use a <a href="https://www.sparkfun.com/search/results?term=boost+converter" rel="nofollow noreferrer">boost</a> converter, you dont need to stack these in series.</p>
| 108142 | 2024-02-08T09:01:14.683 | |arduino|motor|electronics| | <p>I am new to robotics and am struggling with the electronics a bit. I am using two 9Β V batteries in series to provide 18Β V. I need to power 2 x 12 W DC motors and an Arduino Uno. I need to divide the input power of 18 volts into 3 streams: 2 x (12Β V, 1Β A) streams for the motors + 1 x (6Β V, 0.2Β A) for the Arduino.</p>
<p>I thought of using a 1Β Ξ© resistor and a 2Β Ξ© resistor in parallel to get two streams: 12 volts and 6 volts respectively, but I am not sure if that will ensure the right current values will be drawn. I tried looking online but couldn't find a method. How can I go about carrying this out? Any help will be greatly appreciated!</p>
| Controlling power input for different currents and voltages connected to the same power source |
<p>It's not possible at this stage. Zenoh currently requires libstd via some dependencies.
Porting Zenoh to no_std is something that have been discussed and an experiment was even started. But it's a big job and this experiment is currently on hold, due to other priorities (e.g. v1.0.0).</p>
<p>So for embedded Rust, I think the short term solution is to use Zenoh Pico via the Rust FFI.</p>
| 108149 | 2024-02-08T13:41:23.307 | |ros|rmw|zenoh| | <p>Since Zenoh will be a tier-1 RMW for ROS, I was thinking, "why not use Zenoh's rust API for microcontrollers ? "
As embedded rust is a thing and is widely used. I am aware of Zenoh Pico (C implementation) but .... Rust. This is just for implementation, nothing for production or anything like that.</p>
| Is it possible to use the Zenoh Rust Api on embedded rust? |
<p>ok, in the end that was the right way, but the wrong tool.</p>
<p>To publish global positions the right plugin to use is the <strong>OdometryPublisher</strong> (<a href="https://gazebosim.org/api/sim/7/classgz_1_1sim_1_1systems_1_1OdometryPublisher.html" rel="nofollow noreferrer">docs</a>). It works more or less the same way as the PosePublisher, apart from the published messages of course.</p>
<hr />
<p>ORIGINAL ANSWER</p>
<p><strike>Found the solution after struggling some more...</strike>
Scratch that, this publishes</p>
<blockquote>
<p>the transform of its child entities</p>
</blockquote>
<p>as <a href="https://gazebosim.org/api/gazebo/3.5/classignition_1_1gazebo_1_1systems_1_1PosePublisher.html#details" rel="nofollow noreferrer">per docs</a>...</p>
<p>I don't know about the seemingly incomplete conversion of the <code>/world/<world_name>/pose/</code>info topic, but I've found out that to get a model position in the world you need to add the <strong>PosePublisher</strong> plugin to the model.</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0"?>
<sdf version="1.6">
<model name="quadcopter">
<pose>0 0 0 0 0 0</pose>
<link name="base">
<pose frame="">0 0 0 0 0 0</pose>
<!-- ......... -->
</link>
<!-- ......... -->
<plugin
filename="gz-sim-pose-publisher-system"
name="gz::sim::systems::PosePublisher">
<publish_link_pose>true</publish_link_pose>
<publish_collision_pose>false</publish_collision_pose>
<publish_visual_pose>false</publish_visual_pose>
<publish_nested_model_pose>false</publish_nested_model_pose>
</plugin>
</model>
</sdf>
</code></pre>
<p>This will enable a <code>/model/<model_name>/pose</code> topic that you can then bridge to ROS2 via <strong>ros_gz_bridge</strong>.</p>
| 108167 | 2024-02-08T21:57:49.943 | |ros-humble|topic|gz-sim| | <p>I'm trying to understand how I can possibly get the global position of a model in a Gazebo simulation through ROS2.</p>
<p>I've seen that Gazebo publishes data to the <code>/world/<world_name>/pose/info</code> topic via messages of type <code>gz.msgs.Pose_V</code>. Following this, I created a bridge to ROS2 via ros_gz_bridge:</p>
<pre><code>ros2 run ros_gz_bridge parameter_bridge /world/world_demo/dynamic_pose/info@tf2_msgs/msg/TFMessage[gz.msgs.Pose_V
</code></pre>
<p>(I got the corresponding ROS2 message from the <a href="https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_bridge/README.md#example-1a-gazebo-transport-talker-and-ros-2-listener" rel="nofollow noreferrer">ros_gz_bridge README</a>
Unfortunately, the "translation" is incomplete and in the messages received in ROS2 there's no indication of the entity each portion refers to.
<a href="https://i.stack.imgur.com/iMsSJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iMsSJ.png" alt="enter image description here" /></a></p>
<p>Am I missing something here? Is there a way to accomplish this at the moment?</p>
<p>I'm using:<br />
ROS2 humble<br />
Gazebo Garden</p>
| Get robot position wrt world frame in ROS2-Gazebo Garden |
<p>1 - take a look in this similar issue ( can be a CMakesList.txt issue) : <a href="https://github.com/ros-controls/ros2_controllers/issues/358" rel="nofollow noreferrer">https://github.com/ros-controls/ros2_controllers/issues/358</a></p>
<p>2- Or check if you have installed <strong>Controller-Manager</strong> pkg in your foxy distro.</p>
<p>3 - Or as stated here:</p>
<p><a href="https://github.com/ros-controls/ros2_control/issues/1055" rel="nofollow noreferrer">https://github.com/ros-controls/ros2_control/issues/1055</a></p>
<p>You can try install</p>
<pre><code>sudo apt-get install ros-foxy-ackermann-steering-controller
</code></pre>
<p>And check if controller is being tracked:</p>
<pre><code>ros2 control list controller_types
</code></pre>
| 108174 | 2024-02-09T05:10:20.283 | |gazebo|ros2|ros2-control|ros-foxy|gazebo-ros2-control| | <p>I have a ros2 project which is running in one system(with ros2 humble) perfectly but i am getting error on other system(with ros2 foxy). I need to run it on 2nd system as my first system dosen't has a graphics card and I am trying to train a Reinforcement learning model.</p>
<p>The full source code with steps to execute are available at: <a href="https://github.com/nice-user1/ros2_acker" rel="nofollow noreferrer">https://github.com/nice-user1/ros2_acker</a></p>
<p><strong>NOTE: The code might not produce error in you system. I think i got error because i ran this code on a pc in which i have recently installed ros2.</strong></p>
<p><strong>NOTE: In the launch file, I have changed:</strong></p>
<pre><code>ackermann_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["asc"],
)
</code></pre>
<p><strong>TO</strong></p>
<pre><code>ackermann_spawner = Node(
package="controller_manager",
executable="spawner.py",
arguments=["asc"],
)
</code></pre>
<p><strong>the ".py" difference which is required to run the bot in foxy."</strong></p>
<p>I am getting the following error when trying to launch a 4 wheel robot with ackeman steering controller.</p>
<pre><code>[gzserver-4] [ERROR] [1707452057.685204860] [controller_manager]: Loader for controller 'asc' not found.
[ERROR] [spawner.py-7]: process has died [pid 11896, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py asc --ros-args'].
</code></pre>
<p><strong>Terminal Output:</strong></p>
<pre><code>ros2 launch race_it rsp.launch.py
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [11876]
[INFO] [joint_state_publisher-2]: process started with pid [11878]
[INFO] [rviz2-3]: process started with pid [11880]
[INFO] [gzserver-4]: process started with pid [11882]
[INFO] [gzclient -5]: process started with pid [11884]
[INFO] [spawn_entity.py-6]: process started with pid [11888]
[INFO] [spawner.py-7]: process started with pid [11896]
[robot_state_publisher-1] Parsing robot urdf xml string.
[robot_state_publisher-1] Link chassis_link had 4 children
[robot_state_publisher-1] Link front_left_hinge had 1 children
[robot_state_publisher-1] Link front_left_link had 0 children
[robot_state_publisher-1] Link front_right_hinge had 1 children
[robot_state_publisher-1] Link front_right_link had 0 children
[robot_state_publisher-1] Link rear_left_link had 0 children
[robot_state_publisher-1] Link rear_right_link had 0 children
[robot_state_publisher-1] [INFO] [1707452055.941781873] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1707452055.941842196] [robot_state_publisher]: got segment chassis_link
[robot_state_publisher-1] [INFO] [1707452055.941848866] [robot_state_publisher]: got segment front_left_hinge
[robot_state_publisher-1] [INFO] [1707452055.941852469] [robot_state_publisher]: got segment front_left_link
[robot_state_publisher-1] [INFO] [1707452055.941855559] [robot_state_publisher]: got segment front_right_hinge
[robot_state_publisher-1] [INFO] [1707452055.941858690] [robot_state_publisher]: got segment front_right_link
[robot_state_publisher-1] [INFO] [1707452055.941861669] [robot_state_publisher]: got segment rear_left_link
[robot_state_publisher-1] [INFO] [1707452055.941864743] [robot_state_publisher]: got segment rear_right_link
[spawner.py-7] [INFO] [1707452056.077780697] [spawner_asc]: Waiting for /controller_manager services
[spawn_entity.py-6] [INFO] [1707452056.264494914] [spawn_entity]: Spawn Entity started
[spawn_entity.py-6] [INFO] [1707452056.265402694] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-6] [INFO] [1707452056.267455715] [spawn_entity]: Waiting for entity xml on robot_description
[joint_state_publisher-2] [INFO] [1707452056.328889187] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic...
[spawn_entity.py-6] [INFO] [1707452056.351479418] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-6] [INFO] [1707452056.351703468] [spawn_entity]: Waiting for service /spawn_entity
[rviz2-3] [INFO] [1707452056.502326668] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-3] [INFO] [1707452056.502462903] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[rviz2-3] [INFO] [1707452056.541439091] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-3] Parsing robot urdf xml string.
[spawn_entity.py-6] [INFO] [1707452057.354769010] [spawn_entity]: Calling service /spawn_entity
[gzserver-4] Warning [parser_urdf.cc:1130] multiple inconsistent <name> exists due to fixed joint reduction overwriting previous value [Gazebo/Blue] with [Gazebo/Green].
[gzserver-4] Warning [parser_urdf.cc:1130] multiple inconsistent <name> exists due to fixed joint reduction overwriting previous value [Gazebo/Blue] with [Gazebo/Red].
[gzserver-4] Warning [parser_urdf.cc:1130] multiple inconsistent <name> exists due to fixed joint reduction overwriting previous value [Gazebo/Blue] with [Gazebo/Green].
[gzserver-4] Warning [parser_urdf.cc:1130] multiple inconsistent <name> exists due to fixed joint reduction overwriting previous value [Gazebo/Blue] with [Gazebo/Red].
[spawn_entity.py-6] [INFO] [1707452057.373071391] [spawn_entity]: Spawn status: Successfully sent factory message to Gazebo.
[INFO] [spawn_entity.py-6]: process has finished cleanly [pid 11888]
[gzserver-4] [INFO] [1707452057.472799835] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-4] [INFO] [1707452057.474547679] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
[gzserver-4] [INFO] [1707452057.474712194] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-4] [INFO] [1707452057.474744288] [gazebo_ros2_control]: Loading parameter files /home/pratham/Desktop/Pratham/misc/ros2_acker/install/race_it/share/race_it/config/controller/my_controllers.yaml
[gzserver-4] [INFO] [1707452057.476062252] [gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-4] [INFO] [1707452057.476430900] [gazebo_ros2_control]: Recieved urdf from param server, parsing...
[gzserver-4] [INFO] [1707452057.482758994] [gazebo_ros2_control]: Loading joint: front_left_hinge_joint
[gzserver-4] [INFO] [1707452057.482793501] [gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1707452057.482801424] [gazebo_ros2_control]: position
[gzserver-4] [INFO] [1707452057.482821224] [gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1707452057.482827754] [gazebo_ros2_control]: position
[gzserver-4] [INFO] [1707452057.482846866] [gazebo_ros2_control]: Loading joint: front_right_hinge_joint
[gzserver-4] [INFO] [1707452057.482853506] [gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1707452057.482857999] [gazebo_ros2_control]: position
[gzserver-4] [INFO] [1707452057.482862852] [gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1707452057.482867314] [gazebo_ros2_control]: position
[gzserver-4] [INFO] [1707452057.482873115] [gazebo_ros2_control]: Loading joint: rear_left_joint
[gzserver-4] [INFO] [1707452057.482877907] [gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1707452057.482882814] [gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1707452057.482887665] [gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1707452057.482892149] [gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1707452057.482897501] [gazebo_ros2_control]: Loading joint: rear_right_joint
[gzserver-4] [INFO] [1707452057.482902196] [gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1707452057.482906606] [gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1707452057.482911016] [gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1707452057.482915236] [gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1707452057.483025053] [gazebo_ros2_control]: Loading controller_manager
[gzserver-4] [WARN] [1707452057.488805408] [gazebo_ros2_control]: Desired controller update period (0.0333333 s) is slower than the gazebo simulation period (0.001 s).
[gzserver-4] [INFO] [1707452057.488882867] [gazebo_ros2_control]: Loaded gazebo_ros2_control.
[gzserver-4] [INFO] [1707452057.685163156] [controller_manager]: Loading controller 'asc'
[gzserver-4] [ERROR] [1707452057.685204860] [controller_manager]: Loader for controller 'asc' not found.
[gzserver-4] [INFO] [1707452057.685212517] [controller_manager]: Available classes:
[gzserver-4] [INFO] [1707452057.685221409] [controller_manager]: controller_manager/test_controller
[gzserver-4] [INFO] [1707452057.685225693] [controller_manager]: controller_manager/test_controller_failed_init
[gzserver-4] [INFO] [1707452057.685229383] [controller_manager]: controller_manager/test_controller_with_interfaces
[gzserver-4] [INFO] [1707452057.685233156] [controller_manager]: diff_drive_controller/DiffDriveController
[gzserver-4] [INFO] [1707452057.685236984] [controller_manager]: effort_controllers/JointGroupEffortController
[gzserver-4] [INFO] [1707452057.685240652] [controller_manager]: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster
[gzserver-4] [INFO] [1707452057.685244516] [controller_manager]: forward_command_controller/ForwardCommandController
[gzserver-4] [INFO] [1707452057.685248123] [controller_manager]: imu_sensor_broadcaster/IMUSensorBroadcaster
[gzserver-4] [INFO] [1707452057.685251681] [controller_manager]: joint_state_broadcaster/JointStateBroadcaster
[gzserver-4] [INFO] [1707452057.685255145] [controller_manager]: joint_state_controller/JointStateController
[gzserver-4] [INFO] [1707452057.685258594] [controller_manager]: joint_trajectory_controller/JointTrajectoryController
[gzserver-4] [INFO] [1707452057.685262045] [controller_manager]: position_controllers/JointGroupPositionController
[gzserver-4] [INFO] [1707452057.685265702] [controller_manager]: tricycle_controller/TricycleController
[gzserver-4] [INFO] [1707452057.685269334] [controller_manager]: velocity_controllers/JointGroupVelocityController
[ERROR] [spawner.py-7]: process has died [pid 11896, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py asc --ros-args'].
</code></pre>
<p>Most likely it would be some issues related to some ros2 packages not being installed which i am unable to figure out.</p>
<p>Thanks</p>
| Error: Loader for controller 'asc' not found |
<p>Another plugin, namely <a href="https://gazebosim.org/api/sim/8/classgz_1_1sim_1_1systems_1_1ApplyJointForce.html" rel="nofollow noreferrer">ApplyJointForce</a>, can actually be used for this type of torque control.</p>
<p>Our robot xacro now takes a <code>mode</code> argument in order to activate either <code>JointPositionController</code> (position), <code>JointController</code> (velocity) or <code>ApplyJointForce</code> (effort) and allow the corresponding type of control.</p>
| 108186 | 2024-02-09T14:39:45.437 | |gazebo| | <p>I use Gazebo Garden (and ROS 2 humble) and wish to build a computed-torque controller, that directly outputs the torque to send to the motors.</p>
<h2>Desired behavior</h2>
<p>According to the <a href="https://gazebosim.org/api/sim/8/classgz_1_1sim_1_1systems_1_1JointController.html" rel="nofollow noreferrer">JointController plugin</a> reference, the plugin is designed to perform velocity control.</p>
<p>The <code><use_force_commands></code> flag only tells that the plugins uses torque internally, through a PID. Without this flag it seems a pure velocity is sent to the motor, which emulates a perfect servo motor.</p>
<p>Is it possible to use this plugin - or another - to directly control the effort we set on the joint?
That would be equivalent to setting 0-gains and only use the PID feed-forward term but this one is assumed to be constant.</p>
<p>The only alternative would be using <code>ros control</code> but it seems way more complex as we just want to add arbitrary efforts on the joints.</p>
| Joint Effort control in Gazebo Sim |
<p>It seems you can use dynamic configure to modify the parameters dynamically and check if fix your orientation
<a href="https://github.com/OctoMap/octomap_mapping/blob/kinetic-devel/octomap_server/cfg/OctomapServer.cfg" rel="nofollow noreferrer">Octomap Params</a></p>
<pre><code>rosrun rqt_reconfigure rqt_reconfigure
</code></pre>
<p>Or add in your launch file a static transform Publisher between your robot base_link and map frames with desired orientation</p>
<pre><code><node pkg="tf" type="static_transform_publisher" name="octomap_to_base_link" args="0 0 0 0 0 0 1 map base_link 100" />
</code></pre>
| 108192 | 2024-02-09T19:54:31.437 | |ros|octomap| | <p>I am trying to use a projected Octomap as an occupancy grid to pass onto the ROS navigation stack, but when I create one using the octomap_server package, it creates an occupancy grid which is rotated 90 degrees from the top down view (i.e., It projects from the side when it should be projecting downwards). The Octomap and the projected Octomap are shown below.
<a href="https://i.stack.imgur.com/tyGIe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tyGIe.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/ofXjk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ofXjk.jpg" alt="enter image description here" /></a></p>
<p>Is there any way to change the direction from which Octomap creates the projection?</p>
| Octomap and Projected Octomap not lining up |
<p>The missing piece was my ip route table. I needed to change the route to the Create in order to "switch" Turtlebots.</p>
<p><code>sudo ip route del 192.168.186.0/24</code></p>
<p><code>sudo ip route add 192.168.186.0/24 via <RPi IP></code></p>
<p><code>export ROS_DISCOVERY_SERVER=<RPi IP>:11811</code></p>
<p>That seems to work.</p>
| 108194 | 2024-02-09T20:26:50.080 | |ros2|ros-humble|turtlebot4|networking| | <p>Is there a way to enforce that clients can only send/receive messages to each other if they have the same discovery server URI?</p>
<p>I am trying to setup a classroom environment where on a single WLAN multiple Turtlebot 4s can be communicated with from student PCs without each student affecting another's robot.</p>
<p>I set up the following test:</p>
<ul>
<li>Set up discovery server with a TB4 <a href="https://turtlebot.github.io/turtlebot4-user-manual/setup/discovery_server.html" rel="nofollow noreferrer">with the instructions here</a>. I can teleop it with my laptop. Everything works fine.</li>
<li>Set up discovery server on a Raspberry Pi 4 whose micro SD card has the latest TB4 image (to avoid buying a 2nd Turtlebot just to do this test). Note that this is connected to the same network as the Turtlebot and my laptop.</li>
<li>Change the <code>ROS_DISCOVERY_SERVER</code> environment variable on my laptop to the URI of the standalone RPi.</li>
<li>Publish commands to <code>/cmd_vel</code> from my laptop. I expected this to NOT move the robot since the discovery server is matched with the standalone RPi. But the Turtlebot 4 gets the msgs and drives.</li>
</ul>
<p>I want to be able to easily "switch" Turtlebots, but it seems like changing <code>ROS_DISCOVERY_SERVER</code> is not enough.</p>
<p>I think what I'm setting up are discovery partitions <a href="https://fast-dds.docs.eprosima.com/en/latest/fastdds/ros2/discovery_server/ros2_discovery_server.html#discovery-partitions" rel="nofollow noreferrer">based on the documentation</a>, but I'm not 100% sure. At the end of the partitions section, the docs state "Once two endpoints know each other, they do not need the server network between them to listen to each other messages." Is that what is messing this up, and if so can I disable that?</p>
<p>Any help understanding what's going wrong is appreciated.</p>
| Multiple discovery servers on the same network |
<p>No this is not possible yet. But we are working on that feature, see <a href="https://github.com/ros-controls/ros2_control/pull/1240" rel="nofollow noreferrer">this PR here</a>. This feature might come with Jazzy.</p>
| 108205 | 2024-02-10T14:03:34.207 | |control|ros-humble|ros2-control|hardware-interface| | <p>I would like to write a controller that needs all joint states to update a single joint.</p>
<p>My idea was to create a class <code>MyStateInterface</code> which inherits from <code>hardware_interface::StateInterface</code> and stores all information for each joint. Then, I would like to export this class inside the hardware interface to pass the joint information to the controller.</p>
<p>To make it clear, I modify this example:</p>
<pre><code>std::vector<double> hw_states_;
CallbackReturn MyRobotHardware::on_init(const hardware_interface::HardwareInfo & info) {
// set some default values when starting the first time
hw_states_.resize(info_.joints.size(), 0.0);
return CallbackReturn::SUCCESS;
}
std::vector<hardware_interface::StateInterface>
MyRobotHardware::export_state_interfaces()
{
std::vector<hardware_interface::StateInterface> state_interfaces;
for (uint i = 0; i < info_.joints.size(); i++)
{
state_interfaces.emplace_back(hardware_interface::StateInterface(
info_.joints[i].name, // joint name from controller.yaml
hardware_interface::HW_IF_POSITION, // "position"
&hw_states_[i] // the joint value
));
}
return state_interfaces;
}
</code></pre>
<p>To something like this:</p>
<pre><code>std::vector<MyStateHandle> hw_states_;
CallbackReturn MyRobotHardware::on_init(const hardware_interface::HardwareInfo & info) {
// set some default object when starting the first time
hw_states_.resize(info_.joints.size(), MyStateHandle());
return CallbackReturn::SUCCESS;
}
std::vector<hardware_interface::StateInterface>
MyRobotHardware::export_state_interfaces()
{
std::vector<hardware_interface::StateInterface> state_interfaces;
for (uint i = 0; i < info_.joints.size(); i++)
{
state_interfaces.emplace_back(hardware_interface::StateInterface(
info_.joints[i].name, // joint name from controller.yaml
"my_state_handle", // a made up name
&hw_states_[i] // information for controlling the joint
));
}
return states_interfaces;
}
</code></pre>
<p>This didn't work because there is no matching function for the call hardware_interface::StateInterface(const std::string &name, const std::string &interface_name, MyStateHandle *value_ptr=nullptr) because there is only the function hardware_interface::StateInterface(const std::string &name, const std::string &interface_name, double *value_ptr=nullptr)</p>
<p>I want to know if there is a way to pass a class full of control data from the hardware interface to the controller, or am I on a completely wrong track?</p>
| Custom hardware interface type |
<p>Have a look at the <a href="https://github.com/ros-controls/ros2_control/blob/master/hardware_interface/include/hardware_interface/component_parser.hpp" rel="nofollow noreferrer">component parser</a> used within the controller_manager of ros2_control. It should be possible to use that in your node.</p>
| 108225 | 2024-02-11T19:04:56.463 | |ros2|xacro|ros2-control| | <p>I have a xacro file that I used for a specific piece of hardware.
I figured out how to store custom data structures within the gpio framework within ros2_control</p>
<p>example:</p>
<pre><code> <gpio name="motion_command_output">
<param name="byteIndex">0</param>
<param name="bitMask">0x01</param>
</gpio>
</code></pre>
<p>This would get automatically loading into the associated plugin and the data was available in the hardwareinfo structure/map.</p>
<p>I want to use the same xacro file but in a regular lifecycle node.
It seems that I can read and parse the file in the launch file with</p>
<pre><code> device_config = xacro.process_file(io_config_file_path)
device_config_parsed = device_config.toprettyxml(indent=' ')
</code></pre>
<p>But there isn't really a way to load that into the parameters.</p>
<p>I have tried a bunch of different options and it blows up or nothing happens.
Another option would be just to parse the file in the node with tinyxml2.</p>
<p>Any ideas?</p>
<p>Thanks</p>
| Reading a ros2_control xacro file in a regular node |
<p>@Christoph Froehlich was right, the issue were communication problems with the UR.</p>
<p>You will receive robot state information from the driver even if you can't control the robot. My issue was that I used the default value of reverse_ip which is <code>0.0.0.0</code>, this is also the value default in the <code>ur_driver</code>s <code>urX.launch.py</code>. However, the <code>URPositionHardwareInterface::on_activate</code> will invalidate <code>0.0.0.0</code> and set it to an empty string. This in turn triggers the underlying <code>Universal Robots Client Library</code> to use <code>172.18.0.2</code> as default IP.</p>
<p>On the control panel of the UR in the protocol:</p>
<pre><code>Not able to open socket script_command_socket to host: 172.18.0.2 at port: 50004: Connection timed out
</code></pre>
<p>I am glad that that resolved itself, but I don't understand why there is no feedback to the controller, that the hardware interface didn't succeed with the given control. Furthermore, I can't understand why the <code>reverse_ip</code> parameter is not a default-less required parameter in the <code>ur_driver</code>.</p>
| 108237 | 2024-02-12T12:26:34.270 | |ros-humble|ros2-control|universal-robots|ros2-controllers|ur-driver| | <p>I use <a href="https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/tree/humble" rel="nofollow noreferrer">
Universal_Robots_ROS2_Driver </a> in order to do motion planning with MoveIt in ROS Humble. I use the Pilz Industrial Motion Planner as planning pipeline, which seems to work after some addition to the code. I can confirm that a reasonable trajectory gets generated. The utilized controller (<code>ros2_control</code> framework), also accepts the goal and and returns after a while the result code <code>SUCEEDED</code>. <strong>The catch is, the robot has not moved at all.</strong></p>
<ul>
<li>I can see the correct current joint angles of the robot in RViz, which also change when I do free-drive. So I assume the robot and the driver have connected.</li>
<li>I achieve the same behavior if I call the action provided by the conroller on console.</li>
<li>It does not matter which controller I use either <code>scaled_joint_trajectroy_controller</code> or <code>joint_trajectory_controller</code>.</li>
</ul>
<p>How would I debug further?</p>
<p><strong>EDIT</strong></p>
<p><code>ros2_controllers.yaml</code>:</p>
<pre><code>controller_manager:
ros__parameters:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
io_and_status_controller:
type: ur_controllers/GPIOController
speed_scaling_state_broadcaster:
type: ur_controllers/SpeedScalingStateBroadcaster
force_torque_sensor_broadcaster:
type: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster
joint_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController
scaled_joint_trajectory_controller:
type: ur_controllers/ScaledJointTrajectoryController
forward_velocity_controller:
type: velocity_controllers/JointGroupVelocityController
forward_position_controller:
type: position_controllers/JointGroupPositionController
speed_scaling_state_broadcaster:
ros__parameters:
state_publish_rate: 100.0
tf_prefix: "$(var tf_prefix)"
io_and_status_controller:
ros__parameters:
tf_prefix: "$(var tf_prefix)"
force_torque_sensor_broadcaster:
ros__parameters:
sensor_name: <span class="math-container">$(var tf_prefix)tcp_fts_sensor
state_interface_names:
- force.x
- force.y
- force.z
- torque.x
- torque.y
- torque.z
frame_id: $</span>(var tf_prefix)tool0
topic_name: ft_data
joint_trajectory_controller:
ros__parameters:
joints:
- <span class="math-container">$(var tf_prefix)shoulder_pan_joint
- $</span>(var tf_prefix)shoulder_lift_joint
- <span class="math-container">$(var tf_prefix)elbow_joint
- $</span>(var tf_prefix)wrist_1_joint
- <span class="math-container">$(var tf_prefix)wrist_2_joint
- $</span>(var tf_prefix)wrist_3_joint
command_interfaces:
- position
state_interfaces:
- position
- velocity
state_publish_rate: 100.0
action_monitor_rate: 20.0
allow_partial_joints_goal: false
constraints:
stopped_velocity_tolerance: 0.2
goal_time: 0.0
<span class="math-container">$(var tf_prefix)shoulder_pan_joint: { trajectory: 0.0, goal: 0.0 }
$</span>(var tf_prefix)shoulder_lift_joint: { trajectory: 0.0, goal: 0.0 }
<span class="math-container">$(var tf_prefix)elbow_joint: { trajectory: 0.0, goal: 0.0 }
$</span>(var tf_prefix)wrist_1_joint: { trajectory: 0.0, goal: 0.0 }
<span class="math-container">$(var tf_prefix)wrist_2_joint: { trajectory: 0.0, goal: 0.0 }
$</span>(var tf_prefix)wrist_3_joint: { trajectory: 0.0, goal: 0.0 }
scaled_joint_trajectory_controller:
ros__parameters:
joints:
- <span class="math-container">$(var tf_prefix)shoulder_pan_joint
- $</span>(var tf_prefix)shoulder_lift_joint
- <span class="math-container">$(var tf_prefix)elbow_joint
- $</span>(var tf_prefix)wrist_1_joint
- <span class="math-container">$(var tf_prefix)wrist_2_joint
- $</span>(var tf_prefix)wrist_3_joint
command_interfaces:
- position
state_interfaces:
- position
- velocity
state_publish_rate: 100.0
action_monitor_rate: 20.0
allow_partial_joints_goal: false
constraints:
stopped_velocity_tolerance: 0.2
goal_time: 0.0
<span class="math-container">$(var tf_prefix)shoulder_pan_joint: { trajectory: 0.0, goal: 0.0 }
$</span>(var tf_prefix)shoulder_lift_joint: { trajectory: 0.0, goal: 0.0 }
<span class="math-container">$(var tf_prefix)elbow_joint: { trajectory: 0.0, goal: 0.}
$</span>(var tf_prefix)wrist_1_joint: { trajectory: 0.0, goal: 0.0 }
<span class="math-container">$(var tf_prefix)wrist_2_joint: { trajectory: 0.0, goal: 0.0 }
$</span>(var tf_prefix)wrist_3_joint: { trajectory: 0.0, goal: 0.0 }
speed_scaling_interface_name: $(var tf_prefix)speed_scaling/speed_scaling_factor
forward_velocity_controller:
ros__parameters:
joints:
- <span class="math-container">$(var tf_prefix)shoulder_pan_joint
- $</span>(var tf_prefix)shoulder_lift_joint
- <span class="math-container">$(var tf_prefix)elbow_joint
- $</span>(var tf_prefix)wrist_1_joint
- <span class="math-container">$(var tf_prefix)wrist_2_joint
- $</span>(var tf_prefix)wrist_3_joint
interface_name: velocity
forward_position_controller:
ros__parameters:
joints:
- <span class="math-container">$(var tf_prefix)shoulder_pan_joint
- $</span>(var tf_prefix)shoulder_lift_joint
- <span class="math-container">$(var tf_prefix)elbow_joint
- $</span>(var tf_prefix)wrist_1_joint
- <span class="math-container">$(var tf_prefix)wrist_2_joint
- $</span>(var tf_prefix)wrist_3_joint
</code></pre>
<p><strong>EDIT2:</strong></p>
<p>interfaces:
command interfaces</p>
<pre><code>[94melbow_joint/position [available] [claimed][0m
[96melbow_joint/velocity [available] [unclaimed][0m
[94mgpio/io_async_success [available] [claimed][0m
[94mgpio/standard_analog_output_cmd_0 [available] [claimed][0m
[94mgpio/standard_analog_output_cmd_1 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_0 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_1 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_10 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_11 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_12 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_13 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_14 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_15 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_16 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_17 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_2 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_3 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_4 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_5 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_6 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_7 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_8 [available] [claimed][0m
[94mgpio/standard_digital_output_cmd_9 [available] [claimed][0m
[94mgpio/tool_voltage_cmd [available] [claimed][0m
[94mhand_back_control/hand_back_control_async_success [available] [claimed][0m
[94mhand_back_control/hand_back_control_cmd [available] [claimed][0m
[94mpayload/cog.x [available] [claimed][0m
[94mpayload/cog.y [available] [claimed][0m
[94mpayload/cog.z [available] [claimed][0m
[94mpayload/mass [available] [claimed][0m
[94mpayload/payload_async_success [available] [claimed][0m
[94mresend_robot_program/resend_robot_program_async_success [available] [claimed][0m
[94mresend_robot_program/resend_robot_program_cmd [available] [claimed][0m
[94mshoulder_lift_joint/position [available] [claimed][0m
[96mshoulder_lift_joint/velocity [available] [unclaimed][0m
[94mshoulder_pan_joint/position [available] [claimed][0m
[96mshoulder_pan_joint/velocity [available] [unclaimed][0m
[94mspeed_scaling/target_speed_fraction_async_success [available] [claimed][0m
[94mspeed_scaling/target_speed_fraction_cmd [available] [claimed][0m
[94mwrist_1_joint/position [available] [claimed][0m
[96mwrist_1_joint/velocity [available] [unclaimed][0m
[94mwrist_2_joint/position [available] [claimed][0m
[96mwrist_2_joint/velocity [available] [unclaimed][0m
[94mwrist_3_joint/position [available] [claimed][0m
[96mwrist_3_joint/velocity [available] [unclaimed][0m
[94mzero_ftsensor/zero_ftsensor_async_success [available] [claimed][0m
[94mzero_ftsensor/zero_ftsensor_cmd [available] [claimed][0m
state interfaces
elbow_joint/effort
elbow_joint/position
elbow_joint/velocity
gpio/analog_io_type_0
gpio/analog_io_type_1
gpio/analog_io_type_2
gpio/analog_io_type_3
gpio/digital_input_0
gpio/digital_input_1
gpio/digital_input_10
gpio/digital_input_11
gpio/digital_input_12
gpio/digital_input_13
gpio/digital_input_14
gpio/digital_input_15
gpio/digital_input_16
gpio/digital_input_17
gpio/digital_input_2
gpio/digital_input_3
gpio/digital_input_4
gpio/digital_input_5
gpio/digital_input_6
gpio/digital_input_7
gpio/digital_input_8
gpio/digital_input_9
gpio/digital_output_0
gpio/digital_output_1
gpio/digital_output_10
gpio/digital_output_11
gpio/digital_output_12
gpio/digital_output_13
gpio/digital_output_14
gpio/digital_output_15
gpio/digital_output_16
gpio/digital_output_17
gpio/digital_output_2
gpio/digital_output_3
gpio/digital_output_4
gpio/digital_output_5
gpio/digital_output_6
gpio/digital_output_7
gpio/digital_output_8
gpio/digital_output_9
gpio/program_running
gpio/robot_mode
gpio/robot_status_bit_0
gpio/robot_status_bit_1
gpio/robot_status_bit_2
gpio/robot_status_bit_3
gpio/safety_mode
gpio/safety_status_bit_0
gpio/safety_status_bit_1
gpio/safety_status_bit_10
gpio/safety_status_bit_2
gpio/safety_status_bit_3
gpio/safety_status_bit_4
gpio/safety_status_bit_5
gpio/safety_status_bit_6
gpio/safety_status_bit_7
gpio/safety_status_bit_8
gpio/safety_status_bit_9
gpio/standard_analog_input_0
gpio/standard_analog_input_1
gpio/standard_analog_output_0
gpio/standard_analog_output_1
gpio/tool_analog_input_0
gpio/tool_analog_input_1
gpio/tool_analog_input_type_0
gpio/tool_analog_input_type_1
gpio/tool_mode
gpio/tool_output_current
gpio/tool_output_voltage
gpio/tool_temperature
shoulder_lift_joint/effort
shoulder_lift_joint/position
shoulder_lift_joint/velocity
shoulder_pan_joint/effort
shoulder_pan_joint/position
shoulder_pan_joint/velocity
speed_scaling/speed_scaling_factor
system_interface/initialized
tcp_fts_sensor/force.x
tcp_fts_sensor/force.y
tcp_fts_sensor/force.z
tcp_fts_sensor/torque.x
tcp_fts_sensor/torque.y
tcp_fts_sensor/torque.z
wrist_1_joint/effort
wrist_1_joint/position
wrist_1_joint/velocity
wrist_2_joint/effort
wrist_2_joint/position
wrist_2_joint/velocity
wrist_3_joint/effort
wrist_3_joint/position
wrist_3_joint/velocity
</code></pre>
<p>components:</p>
<pre><code>Hardware Component 1
name: ur5e
type: system
plugin name: ur_robot_driver/URPositionHardwareInterface
state: id=3 label=active
command interfaces
shoulder_pan_joint/position [94m[available][0m [94m[claimed][0m
shoulder_pan_joint/velocity [94m[available][0m [unclaimed]
shoulder_lift_joint/position [94m[available][0m [94m[claimed][0m
shoulder_lift_joint/velocity [94m[available][0m [unclaimed]
elbow_joint/position [94m[available][0m [94m[claimed][0m
elbow_joint/velocity [94m[available][0m [unclaimed]
wrist_1_joint/position [94m[available][0m [94m[claimed][0m
wrist_1_joint/velocity [94m[available][0m [unclaimed]
wrist_2_joint/position [94m[available][0m [94m[claimed][0m
wrist_2_joint/velocity [94m[available][0m [unclaimed]
wrist_3_joint/position [94m[available][0m [94m[claimed][0m
wrist_3_joint/velocity [94m[available][0m [unclaimed]
gpio/io_async_success [94m[available][0m [94m[claimed][0m
speed_scaling/target_speed_fraction_cmd [94m[available][0m [94m[claimed][0m
speed_scaling/target_speed_fraction_async_success [94m[available][0m [94m[claimed][0m
resend_robot_program/resend_robot_program_cmd [94m[available][0m [94m[claimed][0m
resend_robot_program/resend_robot_program_async_success [94m[available][0m [94m[claimed][0m
hand_back_control/hand_back_control_cmd [94m[available][0m [94m[claimed][0m
hand_back_control/hand_back_control_async_success [94m[available][0m [94m[claimed][0m
payload/mass [94m[available][0m [94m[claimed][0m
payload/cog.x [94m[available][0m [94m[claimed][0m
payload/cog.y [94m[available][0m [94m[claimed][0m
payload/cog.z [94m[available][0m [94m[claimed][0m
payload/payload_async_success [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_0 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_1 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_2 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_3 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_4 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_5 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_6 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_7 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_8 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_9 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_10 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_11 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_12 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_13 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_14 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_15 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_16 [94m[available][0m [94m[claimed][0m
gpio/standard_digital_output_cmd_17 [94m[available][0m [94m[claimed][0m
gpio/standard_analog_output_cmd_0 [94m[available][0m [94m[claimed][0m
gpio/standard_analog_output_cmd_1 [94m[available][0m [94m[claimed][0m
gpio/tool_voltage_cmd [94m[available][0m [94m[claimed][0m
zero_ftsensor/zero_ftsensor_cmd [94m[available][0m [94m[claimed][0m
zero_ftsensor/zero_ftsensor_async_success [94m[available][0m [94m[claimed][0m
state interfaces
shoulder_pan_joint/position [94m[available][0m
shoulder_pan_joint/velocity [94m[available][0m
shoulder_pan_joint/effort [94m[available][0m
shoulder_lift_joint/position [94m[available][0m
shoulder_lift_joint/velocity [94m[available][0m
shoulder_lift_joint/effort [94m[available][0m
elbow_joint/position [94m[available][0m
elbow_joint/velocity [94m[available][0m
elbow_joint/effort [94m[available][0m
wrist_1_joint/position [94m[available][0m
wrist_1_joint/velocity [94m[available][0m
wrist_1_joint/effort [94m[available][0m
wrist_2_joint/position [94m[available][0m
wrist_2_joint/velocity [94m[available][0m
wrist_2_joint/effort [94m[available][0m
wrist_3_joint/position [94m[available][0m
wrist_3_joint/velocity [94m[available][0m
wrist_3_joint/effort [94m[available][0m
speed_scaling/speed_scaling_factor [94m[available][0m
tcp_fts_sensor/force.x [94m[available][0m
tcp_fts_sensor/force.y [94m[available][0m
tcp_fts_sensor/force.z [94m[available][0m
tcp_fts_sensor/torque.x [94m[available][0m
tcp_fts_sensor/torque.y [94m[available][0m
tcp_fts_sensor/torque.z [94m[available][0m
gpio/digital_output_0 [94m[available][0m
gpio/digital_input_0 [94m[available][0m
gpio/digital_output_1 [94m[available][0m
gpio/digital_input_1 [94m[available][0m
gpio/digital_output_2 [94m[available][0m
gpio/digital_input_2 [94m[available][0m
gpio/digital_output_3 [94m[available][0m
gpio/digital_input_3 [94m[available][0m
gpio/digital_output_4 [94m[available][0m
gpio/digital_input_4 [94m[available][0m
gpio/digital_output_5 [94m[available][0m
gpio/digital_input_5 [94m[available][0m
gpio/digital_output_6 [94m[available][0m
gpio/digital_input_6 [94m[available][0m
gpio/digital_output_7 [94m[available][0m
gpio/digital_input_7 [94m[available][0m
gpio/digital_output_8 [94m[available][0m
gpio/digital_input_8 [94m[available][0m
gpio/digital_output_9 [94m[available][0m
gpio/digital_input_9 [94m[available][0m
gpio/digital_output_10 [94m[available][0m
gpio/digital_input_10 [94m[available][0m
gpio/digital_output_11 [94m[available][0m
gpio/digital_input_11 [94m[available][0m
gpio/digital_output_12 [94m[available][0m
gpio/digital_input_12 [94m[available][0m
gpio/digital_output_13 [94m[available][0m
gpio/digital_input_13 [94m[available][0m
gpio/digital_output_14 [94m[available][0m
gpio/digital_input_14 [94m[available][0m
gpio/digital_output_15 [94m[available][0m
gpio/digital_input_15 [94m[available][0m
gpio/digital_output_16 [94m[available][0m
gpio/digital_input_16 [94m[available][0m
gpio/digital_output_17 [94m[available][0m
gpio/digital_input_17 [94m[available][0m
gpio/safety_status_bit_0 [94m[available][0m
gpio/safety_status_bit_1 [94m[available][0m
gpio/safety_status_bit_2 [94m[available][0m
gpio/safety_status_bit_3 [94m[available][0m
gpio/safety_status_bit_4 [94m[available][0m
gpio/safety_status_bit_5 [94m[available][0m
gpio/safety_status_bit_6 [94m[available][0m
gpio/safety_status_bit_7 [94m[available][0m
gpio/safety_status_bit_8 [94m[available][0m
gpio/safety_status_bit_9 [94m[available][0m
gpio/safety_status_bit_10 [94m[available][0m
gpio/analog_io_type_0 [94m[available][0m
gpio/robot_status_bit_0 [94m[available][0m
gpio/analog_io_type_1 [94m[available][0m
gpio/robot_status_bit_1 [94m[available][0m
gpio/analog_io_type_2 [94m[available][0m
gpio/robot_status_bit_2 [94m[available][0m
gpio/analog_io_type_3 [94m[available][0m
gpio/robot_status_bit_3 [94m[available][0m
gpio/tool_analog_input_type_0 [94m[available][0m
gpio/tool_analog_input_0 [94m[available][0m
gpio/standard_analog_input_0 [94m[available][0m
gpio/standard_analog_output_0 [94m[available][0m
gpio/tool_analog_input_type_1 [94m[available][0m
gpio/tool_analog_input_1 [94m[available][0m
gpio/standard_analog_input_1 [94m[available][0m
gpio/standard_analog_output_1 [94m[available][0m
gpio/tool_output_voltage [94m[available][0m
gpio/robot_mode [94m[available][0m
gpio/safety_mode [94m[available][0m
gpio/tool_mode [94m[available][0m
gpio/tool_output_current [94m[available][0m
gpio/tool_temperature [94m[available][0m
system_interface/initialized [94m[available][0m
gpio/program_running [94m[available][0m
</code></pre>
| joint_trajectory_controller returns SUCCEED but does not move joints |
<p>Fixed by running</p>
<pre><code>sudo apt-get remove ros-*
</code></pre>
<p>then reinstalling using <a href="http://wiki.ros.org/noetic/Installation/Ubuntu" rel="nofollow noreferrer">http://wiki.ros.org/noetic/Installation/Ubuntu</a>, and creating a new conda environment. Not sure what actually caused the issue.</p>
| 108243 | 2024-02-12T16:44:22.070 | |ros|python|rospy| | <p>I had a problem with initializing a ROS node in python in a larger project. The following minimum reproducible example has the same issue:</p>
<pre><code>#!/usr/bin/env python
import rospy
if __name__ == '__main__':
print("Init node")
rospy.init_node('testNode', anonymous=True)
print("Node initialized")
</code></pre>
<p>Only the "Init node" is printed, and the script freezes in the rospy.init_node() call.</p>
<p>roscore is already running, confirmed by <em>rostopic list</em> returning the <em>/rosout</em> topic.</p>
<p>I have tried reinstalling ros and all python packages, as well as rebuilding the ros project.</p>
<p>When debugging using pdb, the program is stuck in the following loop:</p>
<pre><code>while hasattr(f, "f_code"):
co = f.f_code
filename = os.path.normcase(co.co_filename)
if filename == file_name and f.f_lineno == lineno and co.co_name == func_name:
if f.f_back:
f = f.f_back
</code></pre>
<p>in the following path: */opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py(64)findCaller()
*</p>
<p>Any help would be greatly appreciated!</p>
<p>EDIT:</p>
<p>It is also not possible to ctrl + c to stop the process, and I have to close the terminal for it to stop.</p>
<p>If I comment out the call to <code>logger.info("init_node, name[%s], pid[%s]", resolved_node_name, os.getpid())</code> which leads to the infinite loop as shown above, the program instead gets stuck in the following loop:</p>
<pre><code>while not node.uri and not is_shutdown():
time.sleep(0.00001) #poll for XMLRPC init
</code></pre>
<p>in <em>/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/init.py(105)start_node()</em></p>
| rospy.init_node() stuck in loop |
<p>If I understood correctly, you are trying to count how many lasers are being used in the ray plugin just checking the topic published with a <code>LaserScan</code> msg.</p>
<p>I think you could use the <code>angle_min</code> and <code>angle_max</code> with <code>angle_increment</code> in order to know the samples used.</p>
<p>In case you want to know the actual samples in each message (perhaps some laserscans are being skipped by inf values or whatever) I find interesting to use the flag <code>--noarr</code>. This flag omits the arrays and just shows the type of the data as well as the length of the arrays (in this case, check ranges). The use of it would be as simple as:
<code>rostopic echo /<scan_topic> --noarr</code></p>
<p>Resulting in:</p>
<blockquote>
<pre><code>header:
seq: 276
stamp:
secs: 29
nsecs: 851000000
frame_id: "os0_lidar"
angle_min: 0.0
angle_max: 3.14159011841
angle_increment: 0.00870000012219
time_increment: 0.0
scan_time: 0.0500000007451
range_min: 0.10000000149
range_max: 20.0
ranges: "<array type: float32, length: 362>"
intensities: "<array type: float32, length: 0>"```
</code></pre>
</blockquote>
| 108247 | 2024-02-12T19:31:35.087 | |ros-humble|gazebo-plugin|gazebo-11|2dlaserscan| | <p>Is there an easy way to check how many laser scanner samples are being generated by the ray plugin? I know I can check it in the URDF, XACRO or SDF but I want to confirm it by looking at the messages.</p>
<p>I'm aware that I can create a node that subscribes to the <code>/scan</code> topic and do <code>.size()</code> to the vector of msgs. I wonder if there's a built-in option.</p>
| How to easily check how many laser scanner samples are being generated by the ray plugin? |
<p>You can try adding <code>arguments=["--ros-args", "--log-level", "debug"],</code> to the Node which you are interested in at the launch file.</p>
<p>Or in the case where you seem to be using the nav2_bringup straight, you can change it at <a href="https://github.com/ros-planning/navigation2/blob/ab9b1010d7a126c0c407cd09228d97068646ee4c/nav2_bringup/launch/navigation_launch.py#L134" rel="nofollow noreferrer">https://github.com/ros-planning/navigation2/blob/ab9b1010d7a126c0c407cd09228d97068646ee4c/nav2_bringup/launch/navigation_launch.py#L134</a></p>
<p>You should also be able to give argument <code>log_level:=debug</code> when launching the launch file since that is being handled in <a href="https://github.com/ros-planning/navigation2/blob/ab9b1010d7a126c0c407cd09228d97068646ee4c/nav2_bringup/launch/navigation_launch.py#L119" rel="nofollow noreferrer">the launch file</a>. Downside is that then all nodes will have debug level and there will be lots of extras</p>
<p>Example of launch file addition</p>
<pre><code> controller_server = Node(
package="nav2_controller",
executable="controller_server",
output={"both": {"screen", "log", "own_log"}},
emulate_tty=True,
parameters=[],
arguments=["--ros-args", "--log-level", "debug"],
)
</code></pre>
| 108248 | 2024-02-12T19:38:01.307 | |ros2|rqt|rclcpp| | <p>I canβt see messages using RCLCPP_DEBUG by terminal and rqt, but I can using other levels of verbosity( INFO, ERROR, FATALβ¦).Selecting debug in rqt to see those messages doesnβt work either.</p>
<p>Iβm using rolling, working in C++ in a plugin of a controller and launching tb3_simulation_launch.py from nav2_bringup.</p>
<p>I also saw a post here where they recommended to set the environment variable:</p>
<p><code>RCLCPP_LOG_MIN_SEVERITY=RCLCPP_LOG_MIN_SEVERITY_DEBUG</code></p>
<p>but that didnβt work either. It must be something silly that Iβm missing. Has this ever happened to you?</p>
<p>Thank you</p>
| Canβt see debug messages using RCLCPP_DEBUG |
<p>Have you seen this <a href="https://github.com/ICube-Robotics/ethercat_driver_ros2" rel="nofollow noreferrer">EtherCAT driver</a>?</p>
| 108268 | 2024-02-13T12:38:43.480 | |ros2|ros2-control|hardware-interface|ros2-controllers|ethercat| | <p>I am learning ros2_control with the real hardware. I need some help writing hardware interface for the current setup. I do not have experience writing on the communication side of the real hardware.</p>
<p>setup:
I have Jetson nano, drives, motors, and sensors communicating via EtherCAT and using ros2 foxy and SOEM_ROS2 package. these were installed and running without ros2 control, simply via publisher and subscriber. The whole system controls the x,y,z axis with prismatic joint. It is not a robot. so no end effector.
Now, I want to integrate ros2 control with the whole system. I don't know how to get the values from the hardware for the read and write methods of the hardware interface.
I appreciate any help you can provide.</p>
| How to use ros2_control with actual hardware communicating via etherCAT? |
<p>In normal case, ROS2 Humble binary installation is available in Ubuntu 22.04 version, unless you have built a separate container environment.</p>
<p><a href="https://i.stack.imgur.com/YMaN6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YMaN6.png" alt="enter image description here" /></a></p>
<pre><code>**Installation**
Options for installing ROS 2 Humble Hawksbill:
Binary packages
Binaries are only created for the Tier 1 operating systems listed in REP-2000. Given the nature of Rolling, this list may be updated at any time. If you are not running any of the following operating systems you may need to build from source or use a container solution to run ROS 2 on your platform.
We provide ROS 2 binary packages for the following platforms:
Ubuntu Linux - Jammy Jellyfish (22.04)
Debian packages (recommended)
βfatβ archive
RHEL 8
RPM packages (recommended)
βfatβ archive
Windows (VS 2019)
</code></pre>
<p>Or you could try Source Install
<a href="https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html" rel="nofollow noreferrer">https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html</a>
<a href="https://i.stack.imgur.com/11U0I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/11U0I.png" alt="enter image description here" /></a></p>
<pre><code>Ubuntu (source)
Table of Contents
System requirements
System setup
Set locale
Add the ROS 2 apt repository
Install development tools and ROS tools
Get ROS 2 code
Install dependencies using rosdep
Install additional DDS implementations (optional)
Build the code in the workspace
Environment setup
Source the setup script
Try some examples
Next steps after installing
Using the ROS 1 bridge
Additional RMW implementations (optional)
Alternate compilers
Clang
Stay up to date
Troubleshooting
Uninstall
System requirementsο
The current Debian-based target platforms for Humble Hawksbill are:
Tier 1: Ubuntu Linux - Jammy (22.04) 64-bit
Tier 3: Ubuntu Linux - Focal (20.04) 64-bit
Tier 3: Debian Linux - Bullseye (11) 64-bit
</code></pre>
| 108287 | 2024-02-14T07:41:51.543 | |ros2|ros-humble|installation|troubleshooting| | <p>I've been encountering an issue while attempting to install ROS 2 Humble on my Ubuntu 20.04 system. My machine supports both arm64 and x86_64 architectures. Despite following the official installation instructions closely, I run into the "unable to locate package ros-humble-desktop" error every time I try to execute the installation command.</p>
<p>Here are the steps I've followed based on the instructions from the ROS.org page for Humble:</p>
<p><strong>1. Added the ROS 2 repository and keyring as follows:</strong></p>
<pre><code>sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=<span class="math-container">$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $</span>(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
</code></pre>
<p><strong>2. Updated and upgraded my package lists:</strong></p>
<pre><code> sudo apt update
sudo apt upgrade
</code></pre>
<p><strong>3. Attempted to install ROS 2 Humble packages:</strong></p>
<pre><code> sudo apt install ros-humble-desktop
</code></pre>
<p>However, this results in the "unable to locate package ros-humble-desktop" error.</p>
<p>Interestingly, I came across a similar issue on ROS Answers where a user encountered package location errors due to their system running on an ARMhf platform. However, after checking my system using <code>dpkg --print-architecture</code> and <code>lscpu</code>, I confirmed that my system is on <code>arm64</code> and <code>x86_64</code>, which should be compatible with ROS 2 Humble according to REP 2000.</p>
<p>I'm reaching out to see if anyone has faced a similar issue or could offer guidance on resolving this error. Could this problem be related to my prior attempts to uninstall ROS 2 Foxy and clean my system? Or is there something else I'm missing in the setup process for ROS 2 Humble on Ubuntu 20.04?</p>
<p>Any advice or suggestions would be greatly appreciated. Thank you in advance for your help!</p>
| Trouble Installing ROS 2 Humble on Ubuntu 20.04 with arm64/x86_64 Architecture |
<p>Your map's orientation is not used and should be aligned with the generated map (or reorient you SLAM map). Rotations are not used by the map server since grid-based mapping techniques cannot have their maps arbitrarily rotated without aliasing the pixels. Though, you can do this yourself easily with any kind of graphics editing tools and is very commonplace.</p>
| 108298 | 2024-02-14T13:31:42.690 | |costmap|nav2| | <p>I have been trying to use the static layer plugin in Nav2. My custom map_topic has a different orientation of its origin as compared to the /map topic published by slam toolbox. But the processMap function in the static layer plugin only changes the costmap origin's position. How do I change the origin's orientation wrt to my custom map_topic? Is there a parameter for this that I might have missed?? And what is the default orientation and position of the origin??? Any response in this matter would be highly appreciated.</p>
| How do I update the costmap origin's orientation with the help of static layer plugin in Nav2? |
<p>Assume the space <span class="math-container">$\mathbb{R}^3$</span> is equipped with two frames <span class="math-container">$F_0$</span> with <span class="math-container">$O_0$</span> as origin and <span class="math-container">$F_1$</span> with <span class="math-container">$O_1$</span> as origin. The orthonormal basis of the first frame is <span class="math-container">$(\mathbf{e_1^0}, \mathbf{e_2^0}, \mathbf{e_3^0})$</span>, and <span class="math-container">$(\mathbf{e_1^1}, \mathbf{e_2^1}, \mathbf{e_3^1})$</span> for the second one.</p>
<p>Now, the question is what is the relative position and orientation of <span class="math-container">$F_1$</span> with respect to <span class="math-container">$F_0$</span>? For the position, this is quite easy, it is simply the vector that goes from <span class="math-container">$O_0$</span> to <span class="math-container">$O_1$</span> (called the translation vector) that is <span class="math-container">$\mathbf{\overrightarrow{O_0O_1}}$</span>, if the coordinates of this vector in <span class="math-container">$F_0$</span> are <span class="math-container">$(t_1^0, t_2^0, t_3^0)$</span>, (that is <span class="math-container">$\mathbf{\overrightarrow{O_0O_1}} = t_1^0\mathbf{e_1^0}+t_2^0\mathbf{e_2^0}+t_3^0\mathbf{e_3^0}$</span>) then <span class="math-container">$a_1 = [t_1^0 \quad t_2^0 \quad t_3^0]^T$</span> represents the position of <span class="math-container">$F_1$</span> with respect to <span class="math-container">$F_0$</span>.</p>
<p>For the orientation, the question is how are the basis vectors of <span class="math-container">$F_1$</span> with respect to those of <span class="math-container">$F_0$</span>? A natural answer is simply to express <span class="math-container">$(\mathbf{e_1^1},\mathbf{e_2^1}, \mathbf{e_3^1})$</span> in <span class="math-container">$(\mathbf{e_1^0}, \mathbf{e_2^0}, \mathbf{e_3^0})$</span>. If <span class="math-container">$\mathbf{e_1^1} = r_{11}\mathbf{e_1^0}+r_{21}\mathbf{e_2^0}+r_{31}\mathbf{e_3^0}$</span>, <span class="math-container">$\mathbf{e_2^1} = r_{12}\mathbf{e_1^0}+r_{22}\mathbf{e_2^0}+r_{32}\mathbf{e_3^0}$</span> and <span class="math-container">$\mathbf{e_3^1} = r_{13}\mathbf{e_1^0}+r_{23}\mathbf{e_2^0}+r_{33}\mathbf{e_3^0}$</span>, then we define <span class="math-container">$R_1$</span> (called the rotation matrix) to be the <span class="math-container">$3 \times 3$</span> matrix whose coefficients are the <span class="math-container">$r_{ij}$</span>.</p>
<p><span class="math-container">$a_1$</span> and <span class="math-container">$R_1$</span> contain the information about the position and orientation of <span class="math-container">$F_1$</span> with respect to <span class="math-container">$F_0$</span>. We can stake them in a <span class="math-container">$4 \times 4$</span> matrix <span class="math-container">$A_1$</span> (called the homogeneous transformation matrix) in the following way:
<span class="math-container">\begin{equation}A_1 = \begin{bmatrix}
R_1 & a_1\\
0_{1 \times 3} & 1
\end{bmatrix}\end{equation}</span></p>
<p>Assume now that there is a third frame <span class="math-container">$F_2$</span>, let <span class="math-container">$A_2$</span> be the homogeneous transformation matrix representing the position and orientation of <span class="math-container">$F_2$</span> with respect to <span class="math-container">$F_1$</span> (using the same process as before but with <span class="math-container">$F_2$</span> and <span class="math-container">$F_1$</span> instead of <span class="math-container">$F_1$</span> and <span class="math-container">$F_0$</span>).</p>
<p>Now, the interesting thing is that the homogenous transformation matrix has the property that <span class="math-container">$A_1A_2$</span> (matrix product) represents the position and orientation of <span class="math-container">$F_2$</span> with respect to <span class="math-container">$F_0$</span>.</p>
<p>Here I illustrated how the homogenous matrix can represent a frame in another frame, but it can be shown that this matrix also allows to change the reference frame of a point, a vector or even a frame. It also allows to displace a point, a vector or a frame. (for more information I recommend you the third chapter of the book "Modern Robotics: Mechanics, Planning, and Control" by Lynch and Park.) So this is the answer to your question, these matrices have multiple uses, they represent frames but also transformations.</p>
<p>In the context of robotics the frame <span class="math-container">$F_0$</span> is the robot base frame, while <span class="math-container">$F_1$</span> is attached to the first link, <span class="math-container">$F_2$</span> to the second link, etc. There are multiple ways of attaching a frame to a link but usually we use conventions like Denavit-Hartenberg or Khalil-Kleinfinger.</p>
| 108320 | 2024-02-15T13:01:09.667 | |transform|frame|coordinate-system|transformation| | <p>Could somebody explain to me the mixing of coordinate frames and transformations with each other in <em>Robot Manipulators: Mathematics, Programming and Control</em> by Richard Paul?</p>
<p>On page 102 it says:</p>
<blockquote>
<p>The <span class="math-container">$A$</span> transformations were set up in such a manner (...)</p>
</blockquote>
<p>while a little later in the same paragraph</p>
<blockquote>
<p>For example, joint 3 of the Stanford manipulator translates along the <span class="math-container">$z$</span> axis of coordinate frame <span class="math-container">$A_2$</span></p>
</blockquote>
<p>So what are they, frames or translations between them?</p>
<p>It's a new information for me and this lack of specificity is very confusing and in my opinion unfitting for an engineer.</p>
| Mixing coordinate frames and transformations |
<p>What you are asking is quite an interesting topic, and think there are multiple solutions.</p>
<p>When it comes to defining the base_footprint, I position it at ground level directly beneath the pivot point. Following a child link in the pivot point and then two childs to front and rear.</p>
<p>Nav2 have one reference frame when navigating, but does not mean u need two path planners or controllers. Essentially, one should design a controller capable of changing the reference frame between the front and rear based on the direction of the path(forward/reverse). At least that worked for me.</p>
<p>For the footprint, you'll only need 1 big polygon footprint, that uses the articulated angle feedback to dynamically change its footprint. What Marcus suggested works, but will introduce challenges in small spaces. Keep in mind that articulated vehicle such as tractors with equipment are very large, so the robot radius could results in 10-20m.</p>
| 108338 | 2024-02-16T04:18:04.950 | |ros2|nav2|base-footprint| | <p>I have a conceptual doubt. The base_footprint for a vehicle is given with respect to the base_link (projected on the 2D plane). I am unable to comprehend what happens when we have an articulated vehicle. How is the base_footprint then defined. Is it that we define to big polygon defined with respect to the front vehicle base_link or about the coupling point or is it two independent polygons for the two parts of the vehicle (which would make more sense considering a farming vehicle and an attached implement, but then will there be two paths and two controller), I am unable to understand.</p>
<p>Any help is much appreciated.</p>
| base_footprint of articulated vehicle |
<p>There's a paper for that: <a href="https://arxiv.org/pdf/2307.15236.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/2307.15236.pdf</a></p>
<blockquote>
<p>S. Macenski, T. Moore, DV Lu, A. Merzlyakov, M. Ferguson, From the
desks of ROS maintainers: A survey of modern & capable mobile robotics
algorithms in the robot operating system 2, Robotics and Autonomous
Systems, 2023</p>
</blockquote>
| 108348 | 2024-02-16T14:09:25.757 | |nav2|base-local-planner|global-planner| | <p>I am new to Nav2 stack and currently there are a bunch of navigation plugins to choose from (<a href="https://navigation.ros.org/plugins/index.html" rel="nofollow noreferrer">https://navigation.ros.org/plugins/index.html</a>). I am interested in how to choose available algorithms from those in "<strong>Planners</strong>" and "<strong>Controllers</strong>" sections. For example, how to know pros & cons of <em>NavFn</em> planner compared with <em>SmacPlanner</em>. How to know pros & cons of <em>DWB</em> controller against <em>TEB</em> controller. Is there any site clarify something like this?</p>
<p>Thank you,</p>
<p>Peera</p>
| Comparing navigation algorithms |
<blockquote>
<p>as mentioned before the steering receives the twist.angular.z commands</p>
</blockquote>
<p><code>angular.z</code> are body-fixed frame angular velocity. You need to convert them to your steering angle / rates as you would for any other type of vehicle (ie legged, omni, diff drive) using your robot's kinematics.</p>
| 108350 | 2024-02-16T16:40:16.677 | |navigation|ros2|nav2|autonomous-car| | <p>I'm trying to use nav2 with a real self-driving golf cart.
The architecture of the cart is not complex:
The rear wheels respond to twist.linear.x commands
The steering instead with the twist.angular.z command moves the front wheels
(dimensions are those of a standard golf cart)</p>
<p>The cart receives cmd_vel commands correctly. Trying with a joystick I can move the cart and I can see from rviz2 that everything works correctly.</p>
<p>The problem arises when with nav2 I give a goal to follow to the cart.</p>
<p>Sometimes nav2 turns the steering to the maximum right/left.
as mentioned before the steering receives the twist.angular.z commands</p>
<p>As long as I tell it to move forward 2 meters there are no problems, but if the distance increases every time the controller updates the local path to follow the steering commands seem to go crazy.
I'm carrying out these tests with nav2 with the cart raised on stands,</p>
<p>Would anyone know how to setup or choose a simple controller and planner in my case? I'm definitely configuring something wrong, I'm new to this.
for now I was trying to use the Regulated Pure Pursuit as a planner, and the Smac Hybrid-A* Planner as a controller</p>
<p>If anyone has any example configurations to start from it would help me a lot
Many thanks in advance</p>
| Nav2 Planner/Controller params for Ackermann Vehicle |
<p>Angular velocities are strongly related to angle-axis description of a 3D rotation.</p>
<p>Instead of using RPY, just use the angle-axis vector (as in angle times unit axis) of the rotation error (R1.R2^T). Then the angular velocity to drive this vector to 0 is just proportional to the vector (e.g. this is a proportional velocity control in SO(3)).</p>
| 108376 | 2024-02-18T15:36:54.250 | |rotation|frames| | <p>I want to implement the J+RRT algorithm for which I need to use the Twist command to navigate the robot in Euclidean space.</p>
<p>First I calculate the difference in rotation matrices from the end-effector frame <code>T1</code> to the goal frame <code>T2</code> like so:</p>
<pre><code>Tdiff * T1 = T2 // * T1^-1
Tdiff * T1 * T1^-1 = T2 * T1^-1
Tdiff = T2 * T1^-1
</code></pre>
<p>I am using the Frame separated as a rotation and translation.
Effectively this means that</p>
<pre><code>T1^-1 = [R1^T -t1; 0 0 0 1]
</code></pre>
<p>RPY seems to be given in extrinsic x, y, z angles, which means that I need to convert it to intrinsic angles for the Twist command. This means that the RPY angles that I get from the <code>Tdiff</code> I would need to convert to my <code>R1</code> rotation frame. Is my thinking correct?</p>
<p>The code I'm using is this:</p>
<pre><code>KDL::Rotation inv_src_rot = src.M.Inverse();
double x, y, z;
KDL::Rotation diff_rot = tgt.M * inv_src_rot;
diff_rot.GetRPY(x, y, z);
twist.rot = src.M * KDL::Vector(x, y, z);
</code></pre>
<p>This is the code for the RPY calculation:
<a href="https://github.com/orocos/orocos_kinematics_dynamics/blob/master/orocos_kdl/src/frames.cpp#L237-L260" rel="nofollow noreferrer">https://github.com/orocos/orocos_kinematics_dynamics/blob/master/orocos_kdl/src/frames.cpp#L237-L260</a></p>
<p>EDIT: Right as I posted this I had another idea, which seems to me more correct.</p>
<p>If my goal is to go towards the goal rotation <code>tgt.M</code> in the end-effector reference frame <code>src.M</code>, it would make sense to calculate the RPY angles from the rotation</p>
<p><code>src.M * tgt.M</code>,</p>
<p>since in this case the extrinsic frame has now become <code>src.M</code>. Now when I calculate RPY it will be the rotation <code>tgt.M</code> given in the <code>src.M</code> frame, if I'm not mistaken?</p>
<pre><code>KDL::Rotation diff_rot = src.M * tgt.M;
diff_rot.GetRPY(x, y, z);
twist.rot = KDL::Vector(x, y, z);
</code></pre>
| Rotation matrix to Twist command |
<p>Jetson Nano doesn't have a Real Time Clock so you can't get right date and time when you shutdown and restart it.
Here are some solutions :</p>
<ul>
<li>Add a RTC to your jetson nano</li>
<li>Use GPS time as source of truth and set time on your device using "date" CLI</li>
</ul>
| 108392 | 2024-02-19T14:18:12.083 | |ros2|ubuntu|gps| | <p>I'm using an ardusimple board, it has an ublox f9p receiver. I'm using <a href="https://github.com/KumarRobotics/ublox" rel="nofollow noreferrer">kumar driver</a> t get /fix topic
I fuse GPS data with IMU and wheel encoders using two instance of robot_localization package and navsat_node.
The robot runs ubuntu 22.04 and ros iron on a Jetson Nano without internet connections. I spend some time to debug a problem, EKF was not consuming GPS data. If I set the current date and time on the ubuntu OS everything start to work ok.
So I would like to know possible solutions for that. Right now I'm setting date and time manually looking at my cell phone to get current data, but I would like to automate this process.</p>
| GPS timestamp vs ROS2 time |
<p>That looks like - to my eye - one of two things:</p>
<ol>
<li><p>You have two publishers publishing to the same topic containing different data. So the most recent one is being shown and you're seeing the race condition of which was published last</p>
</li>
<li><p>In your software, you have a bug resulting in the publication of two different states.</p>
</li>
</ol>
<p>If you stop your nodes, does it stop flickering? Then its your nodes :-)</p>
| 108397 | 2024-02-19T15:48:55.667 | |rviz|python|mapping|rclpy| | <p>I'm implementing my own custom message of type nav_msgs/msg/OccupancyGrid to visualize grid-based quantities in a local map (namely virtual pheromones).</p>
<p>Back in ROS Noetic, my implementation worked very smoothly in RViz. Now that the QoS policy has replaced some TCP-based topic logic, I had to make some changes to be able to view my map. Before you redirect me to other links regarding QoS, I have made sure myself to read the recent proposal <a href="https://discourse.ros.org/t/new-rep-2003-sensor-data-and-map-qos-settings/35758" rel="nofollow noreferrer">REP 2003</a>, the <a href="https://ros.org/reps/rep-2003.html" rel="nofollow noreferrer">REP 2003 page</a> and this <a href="https://github.com/ros-visualization/rqt/issues/187" rel="nofollow noreferrer">RQt issue</a>.</p>
<p>I can currently see the map in RViz, even though it has a flickering problem with some delays. I've made sure to call QoSProfile in my map publisher, as below, per Steve Macenski's TL;DR instructions:</p>
<pre class="lang-py prettyprint-override"><code>from rclpy.qos import QoSProfile, DurabilityPolicy, HistoryPolicy, ReliabilityPolicy
from nav_msgs.msg import OccupancyGrid
...
qos_policy = QoSProfile(reliability= ReliabilityPolicy.RELIABLE,
history= HistoryPolicy.KEEP_LAST,
durability= DurabilityPolicy.TRANSIENT_LOCAL,
depth= 3)
pheromone_grid_pub = self.create_publisher(
topic="/pheromone/grid",
msg_type= OccupancyGrid,
qos_profile= qos_policy)
</code></pre>
<p><a href="https://i.stack.imgur.com/RDM6V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RDM6V.png" alt="Pheromone grid data" /></a></p>
<p>The problem is mitigated with these settings, but not completely solved. There is still some delaying, and major flickering issues persist.</p>
<p><a href="https://i.stack.imgur.com/ci01H.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ci01H.gif" alt="enter image description here" /></a></p>
<p>What would be the best course of action in this case to improve RViz2 performance? Do I need to raise the topic depth? There also is a new "update topic" field that doesn't make a lot of sense to me, and I couldn't find any documentation related to it. Or, is there a better alternative message type altogether to publish this information?</p>
| Flickering OccupancyGrid data in RViz2 |
<p>If a node already does the transform between base_link to odom, then you do not need to have two instances of robot_localization. You just configure one instance of EKF to provide the transform between map and odom.</p>
| 108408 | 2024-02-19T21:35:50.697 | |ros2|robot-localization|gps|ekf|ekf-localization| | <p>I have a doubt regarding the use of Robot_localization.</p>
<p>I was watching this tutorial: <a href="https://navigation.ros.org/tutorials/docs/navigation2_with_gps.html" rel="nofollow noreferrer">https://navigation.ros.org/tutorials/docs/navigation2_with_gps.html</a></p>
<p>in my case I have a real robot (equipped with imu, gps, and wheel encoders) with which I already publish a transformation between the base_link frame of my robot and the odom frame.</p>
<p>I've seen that the many examples around (like the tutorial above) use 2 ekf nodes, the first to compute the local odom--base_link transformation, and a second to compute the global map-odom transformation.</p>
<p>But if I already have the odom--base_link transformation existing and therefore the odom frame already exists, is it always necessary for me to create the two ekf nodes?</p>
<p>or can I just create the global node ekf?</p>
<p>Thanks everyone in advance</p>
| Robot_Localization Local/Global ekf nodes |
<p>Order of the plugins matters. I believe that to be the problem here. In your params you have</p>
<p><code>plugins: ["static_layer", "inflation_layer", "obstacle_layer", "voxel_layer"]</code></p>
<p>Which means that nav2 will first check <code>static_layer</code>, then run inflation on that, and after that run the costmap generation for <code>obstacle_layer</code>. In the Rviz screenshot there are small grey pixels under the laser scan markings which means the <code>obstacle_layer</code> is doing things.</p>
<p>To inflate the <code>obstacle_layer</code> detections (and <code>voxel_layer</code> which you might want to do as well) you have to move the <code>inflation_layer</code> to be the last plugin.</p>
<p><code>plugins: ["static_layer", "obstacle_layer", "voxel_layer", "inflation_layer"]</code></p>
| 108412 | 2024-02-20T03:10:35.530 | |nav2|global-costmap| | <p>Greeting,</p>
<p>I would like to ask about setting the global costmap parameters especially the plugins. Currently in my system I enabled the following plugins- static, inflation, obstacle and voxel layers. I am wondering that the obstacle layer did not work as expected.</p>
<p><a href="https://i.stack.imgur.com/x9xeN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x9xeN.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/VLhLA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VLhLA.png" alt="enter image description here" /></a></p>
<p>In the pictures, you see that there is a cart in front of the robot that is detected by laser scanner as an obstacle. However, there is no black, inflated circle around it, so I assume it did not work.</p>
<p>Here is the parameters. Does anyone spot any mistake here?</p>
<pre><code> global_costmap:
ros__parameters:
footprint_padding: 0.03
update_frequency: 4.0
publish_frequency: 2.0
global_frame: map
robot_base_frame: robot_base_footprint
use_sim_time: False
robot_radius: 0.3 # radius set and used, so no footprint points
resolution: 0.05
plugins: ["static_layer", "inflation_layer", "obstacle_layer", "voxel_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
footprint_clearing_enabled: true
max_obstacle_height: 2.0
combination_method: 1
scan:
topic: /scan
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
max_obstacle_height: 2.0
min_obstacle_height: 0.0
clearing: True
marking: True
data_type: "LaserScan"
inf_is_valid: true
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
footprint_clearing_enabled: true
max_obstacle_height: 2.0
publish_voxel_map: True
origin_z: 0.0
z_resolution: 0.05
z_voxels: 16
max_obstacle_height: 2.0
unknown_threshold: 15
mark_threshold: 0
observation_sources: pointcloud
combination_method: 1
pointcloud: # no frame set, uses frame from message
topic: /intel_realsense_r200_depth/points
max_obstacle_height: 2.0
min_obstacle_height: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
clearing: True
marking: True
data_type: "PointCloud2"
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: True
enabled: True
subscribe_to_updates: true
transform_tolerance: 0.1
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
enabled: True
inflation_radius: 0.3
cost_scaling_factor: 2.7
inflate_unknown: false
inflate_around_unknown: true
always_send_full_costmap: True
</code></pre>
| Obstacle layer in global costmap not set |
<p>I have also found another approach on <a href="https://roboticsbackend.com/ros2-global-parameters/" rel="nofollow noreferrer">Robotics Back-End</a> that can be interesting to have a look at as well.
You can also checkout functions for Python <a href="https://gist.github.com/aarsht7/05056a5e5c8b942d9f25a4a1e39f5b83" rel="nofollow noreferrer">from here</a> that you can use to play with param server in ROS 2</p>
| 108420 | 2024-02-20T12:08:20.647 | |ros2|parameters| | <p>As far as I know, it is not possible to set parameters in the '<code>/</code>' namespace from a ROS 2 node, unlike ROS 1. All the parameter set from the ROS 2 node falls in the <code>/node_name</code>. I just wanted to confirm whether that is correct or not.</p>
<p>I have some parameters that I want to set as global parameters that can be accessible by all the other nodes, even if the name of the node declaring those parameters changes. Is it possible with ROS 2?</p>
| rclpy set parameters in global namespace? |
<p>I found an old answer on answers.gazebosim <a href="https://answers.gazebosim.org/question/15897/how-to-open-several-gazebos-in-a-linux-operating-system/" rel="nofollow noreferrer">How to open several gazebos in a linux operating system?</a> answered by a user named @chapulina.</p>
<p>I am pasting the answer below:</p>
<blockquote>
<p>To run various Gazebo instances, you must make sure each of them is using a different port. You can set this with the <code>GAZEBO_MASTER_URI</code> environment variable.</p>
<p>It's also convenient to run Gazebo in verbose mode so you can read error messages.</p>
<p>For example, on one terminal, start <code>gzserver</code> on the default port (11345):</p>
<pre><code>gzserver --verbose
</code></pre>
<p>You'll see the port printed in green:</p>
<pre><code>[Msg] Connected to gazebo master @ http://127.0.0.1:11345
</code></pre>
<p>Then on a new terminal, open <code>gzclient</code>:</p>
<pre><code>gzclient --verbose
</code></pre>
<p>You'll see the same port printed in green:</p>
<pre><code>[Msg] Connected to gazebo master @ http://127.0.0.1:11345
</code></pre>
<p>If you try to start another gzserver on a new terminal, without changing the URI, you'll get an error:</p>
<pre><code>[Err] [Master.cc:96] EXCEPTION: Unable to start server[bind: Address already in use]. There is probably another Gazebo process running.
</code></pre>
<p>The correct way is to open a new terminal and start another instance with a new URI:</p>
<pre><code>export GAZEBO_MASTER_URI=http://localhost:11346; gzserver --verbose
</code></pre>
<p>This time the URI is different:</p>
<pre><code>[Msg] Connected to gazebo master @ http://127.0.0.1:11346
</code></pre>
<p>And then on a new terminal, the respective gzclient:</p>
<pre><code>export GAZEBO_MASTER_URI=http://localhost:11346; gzclient --verbose
</code></pre>
<p>And you should also see the same URI:</p>
<pre><code>[Msg] Connected to gazebo master @ http://127.0.0.1:11346
</code></pre>
</blockquote>
<p>Hope it helps someone else with same issue.</p>
| 108423 | 2024-02-20T13:53:19.127 | |ros2|gazebo-11|gazebo-ros| | <p>I need to run multiple instances of gazebo on same PC (ROS version foxy) and want to interact with them individually like spawning a robot in one of them.
I tried using different ROS_DOMAIN_ID in different terminal and run</p>
<pre><code>ros2 launch gazebo_ros gazebo.launch.py
</code></pre>
<p>But when i launch the command in second terminal its gzserver is automatically killed.
My main aim is to run navigation stack by using one of the gazebo world and make the robot in other gazebo world to mimic the same by publishing the same /cmd_vel values to it. Both robots are identical but with different namespaced topics and nodes.
Thanks in advance :)</p>
| Multiple isolated gazebo on same PC(ROS2) |
<p>This seems like a configuration problem. I don't have enough info since we do not see your launch files and config files where you do the remapping, but I'd say you probably forgot to remap the odometry topic according to the namespace.
At least that's what I see from your ROS graph</p>
| 108429 | 2024-02-20T15:12:55.177 | |ros2|turtlebot|ros-humble|tf2|multi-robot| | <p>I am trying to spawn two robots with the goal of controlling them independently. I have made changes to the empty world launch file in turtlebot3_gazebo package to try and spawn two robots, for now I can spawn two robots with their own topics as seen in the picture below, but I can't get the robots to publish their own odom. <a href="https://i.stack.imgur.com/2j5JJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2j5JJ.png" alt="tf" /></a></p>
<p>Do someone know what should I do to correct this problem?</p>
| Multi-robots control in ROS2 Humble |
null | 108438 | 2024-02-20T20:44:51.637 | |ros2|ros-humble|network| | <p>I am trying to communicate to a Turtlebot 4 from my laptop. I set up the Discovery server as the documentation says and usually I can drive the robot around. However, every time I start anything with ROS2, my laptop loses connection to the WLAN I'm using. I can no longer ping the RPi on the Turtlebot. Sometimes the connection comes back within a few seconds, but sometimes it never does and I have to restart NetworkManager.</p>
<p>Separate from the Turtlebot 4, if I start one of the nav2 launch files, such as <code>ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False</code> I immediately lose connection and cannot ping any other devices on the network (including the gateway).</p>
<p>It seems like any time I start something ROS2 related, I lose connection. Sometimes it comes back, sometimes it doesn't.</p>
<p>I found this thread on the Discourse that I think is related, but I don't know enough about networking and the discovery process to know if this is my issue: <a href="https://discourse.ros.org/t/unconfigured-dds-considered-harmful-to-networks/25689/24" rel="nofollow noreferrer">https://discourse.ros.org/t/unconfigured-dds-considered-harmful-to-networks/25689/24</a></p>
<p>I'm at a university where we can only run 5GHz band networks, but my network is not connected to the Internet and it's only a couple devices on it so I'm not sure if it's the same use case as that Discourse thread.</p>
<p>Has anyone else experienced this, and did anything work to fix it?</p>
<p>Edit: If I unset the <code>ROS_DISCOVER_SERVER</code> variable and set <code>ROS_LOCALHOST_ONLY</code> to 1, then I have no issues with connectivity when starting ROS nodes. If I set <code>ROS_LOCALHOST_ONLY</code> to 0, then I see a very tiny gap in connectivity before it comes back. So it seems the issue is with the Discovery server config.</p>
<p>Edit 2: Just wanted to note that all devices on the network lose connectivity, not just the one starting the ROS2 node. This is on a run-of-the-mill retail router with only 5 devices connected to it.</p>
<p>Edit 3: It appears that this is only happening when the Turtlebot's Pi is on the network. If I remove it from the network and change the discovery server URI to another device, then I don't lose connection. As soon as the TB4 comes back onto the network though (regardless of the <code>ROS_DISCOVERY_URI</code> value, all devices seem to lose connection to each other when I start ROS2 nodes.</p>
| Losing connectivity on starting nodes in ROS Humble |
<p>I was able to address the problem through remapping the topic names when the offending nodes are initialized. robot_state_publisher itself publishes to /tf and /tf_static, and diff_drive_controller (initialized by turtlebot3_node) publishes to /tf. To allow the namespace to be prefixed on those channels, I had to remap '/tf' to 'tf' and '/tf_static' to 'tf_static'.</p>
<p>Where robot_state_publisher is initialized (turtlebot3_state_publisher.launch.py in the base bringup package):</p>
<pre><code>Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
namespace='tb3_0',
output='screen',
parameters=[rsp_params, {'use_sim_time': use_sim_time}],
remappings=[('/tf','tf'),('/tf_static','tf_static')]
)
</code></pre>
<p>And where turtlebot3_node is initialized (robot.launch.py in the base bringup package):</p>
<pre><code>Node(
package='turtlebot3_node',
executable='turtlebot3_ros',
namespace='tb3_0', # <------------------- ADD THIS!
parameters=[tb3_param_dir],
arguments=['-i', usb_port],
remappings=[('/tf','tf'),('/tf_static','tf_static')],
output='screen'
)
</code></pre>
<p>And voila!</p>
<pre><code>ubuntu@ubuntu:~$ ros2 topic list
/parameter_events
/rosout
/tb3_0/battery_state
...
/tb3_0/sensor_state
/tb3_0/tf
/tb3_0/tf_static
</code></pre>
<p>It'd be nice to be able to set this as an automated launch argument, rather than having to manually configure every bot. But for now, this is good enough.</p>
| 108469 | 2024-02-21T17:03:41.007 | |ros-humble|turtlebot3|robot-state-publisher| | <p>I am working on a project involving multiple TurtleBots, using Ubuntu 22.04 and ROS2 Humble. I would like to control them individually by running a separate navigation stack (with unique namespace) for each robot. I have been able to set up individual stacks for Gazebo-simulated bots, but when trying to run the stack on physical robots (following the guide <a href="https://discourse.ros.org/t/giving-a-turtlebot3-a-namespace-for-multi-robot-experiments/10756" rel="nofollow noreferrer">here</a>), I cannot get /tf and /tf_static to conform to the specified namespaces. All other topics publish as expected:</p>
<pre><code>ubuntu@ubuntu:~$ ros2 topic list
/parameter_events
/rosout
/tb3_0/battery_state
...
/tb3_0/scan
/tb3_0/sensor_state
/tf
/tf_static
</code></pre>
<p>I suspect it is an issue with the robot_state_publisher node, which is launched in the tb3_0 namespace, but still publishes to /tf and /tf_static.</p>
<pre><code>ubuntu@ubuntu:~$ ros2 node info /tb3_0/robot_state_publisher
/tb3_0/robot_state_publisher
Subscribers:
/parameter_events: rcl_interfaces/msg/ParameterEvent
/tb3_0/joint_states: sensor_msgs/msg/JointState
Publishers:
/parameter_events: rcl_interfaces/msg/ParameterEvent
/rosout: rcl_interfaces/msg/Log
/tb3_0/robot_description: std_msgs/msg/String
/tf: tf2_msgs/msg/TFMessage
/tf_static: tf2_msgs/msg/TFMessage
Service Servers:
...
</code></pre>
<p>What might be the reason for this, and how could I go about fixing it?</p>
| /tf topic is not published with specified namespace |
<p>Turns out there's no direct solution to this. Overall I have to transform (using the <code>tf</code> library) my desired orientation from a local frame, into a world frame.</p>
<p>There are various mathematical ways to do it, the route I took is this:</p>
<ol>
<li>Define the goal orientation around Y-axis, relative to X-axis (my eef at neutral angle).</li>
<li>Get the expected Y-axis angle of the goal position by using tan(y/x).</li>
<li>Rotate the goal orientation by the expected Y-axis angle.</li>
</ol>
| 108470 | 2024-02-21T17:09:41.453 | |moveit|transform|robotic-arm|quaternion|tf| | <p>As the title says, how to give a local orientation to my end effector, but global position?</p>
<p>Basically this would mimic the goal orb in RVIZ, where you can drag it around to give global position, but the orientation is still relative to the end effector itself.</p>
<p>For example here is a simple command to set pose target:</p>
<pre class="lang-py prettyprint-override"><code>ref_frame = "base"
self.arm_move_group.set_pose_reference_frame(ref_frame)
# Arm in front of robot
pose_goal.position.x = 0.5
pose_goal.position.y = 0
pose_goal.position.z = 0
# Pitched 45 degree
quat_local.quaternion.x = 0
quat_local.quaternion.y = 0.707
quat_local.quaternion.z = 0
quat_local.quaternion.w = 0.707
self.arm_move_group.set_pose_target(pose_goal)
</code></pre>
<p>Where I can set the reference frame to the base for global pos & quat goals with 45degree pitch to the end effector when the goal position is in front of the robot.</p>
<p>But as you'd expect, if I the goal position is not directly in front, or even 90degree to the side, then the end effector goal orientation is no longer 45degree to itself, but 45 degree roll.</p>
<p>So is there a way to give it global position while using local orientation? Is it using the tf library to transform an <code>OrientationStamped</code> from local to the global?</p>
| How to give Moveit! local orientation goal to my end effector, but global position? |
<p>I was looking into this recently and came across <a href="https://github.com/kiwicampus/ros2_graph" rel="nofollow noreferrer">https://github.com/kiwicampus/ros2_graph</a>. This allows you to generate a ROS graph in Mermaid (a markdown language) on the CLI which can then be converted to an image either on another machine or on the CLI and then <code>scp</code>'d to another machine. Hope this helps.</p>
| 108479 | 2024-02-22T05:08:29.843 | |ros2|rqt-graph| | <p>my <code>ros2</code> env does not have a display or visualization config, is there a method only by <code>cli</code> to get the <code>node graph</code>? (e.g. save in <code>*.png</code>)</p>
| how to get node graph like rqt_graph with command line? |
<p>If you can share the full error that will help more.
Second, you have</p>
<blockquote>
<p>bus.yml</p>
</blockquote>
<pre><code>position_mode: 1 # Profile Position Mode
</code></pre>
<p>it would help if you changed it to</p>
<pre><code>velocity_mode: 1 # Profile velocity Mode
</code></pre>
<p>the same with the command interface should be velocity not position in</p>
<blockquote>
<p>diffbot_controllers.yaml</p>
</blockquote>
<pre><code>command_interfaces:
- velocity
</code></pre>
<p>these changes may not fix your error but these are the correct settings for the diffbot.</p>
| 108481 | 2024-02-22T09:10:16.403 | |ros2|ros2-control| | <p>I am willing to implement ros2_canopen with ros2_control. I am new to ros2_canopen.</p>
<p>I have four wheels robot (in simulation) and using diff_drive as ros2_control. Everthing is working fine but when I am trying to use ros2_canopen with ros2_control, I am getting error: "Waiting for '/controller_manager' node to exist".</p>
<p>Can someone guide me? ros2_canopen documentation is not friendly to understand things properly.</p>
<p>May be I am doing something wrong with the bus.yml, ros2_control.yaml and ros2_control.xacro.</p>
<blockquote>
<p>bus.yml</p>
</blockquote>
<pre><code>options:
dcf_path: "@BUS_CONFIG_PATH@"
master:
node_id: 1
driver: "ros2_canopen::MasterDriver"
package: "canopen_master_driver"
sync_period: 10000
defaults:
dcf: "cia402_slave.eds"
driver: "ros2_canopen::Cia402Driver"
package: "canopen_402_driver"
period: 10 # 1 ms
heartbeat_producer: 1000 # Heartbeat every 1000 ms
position_mode: 1 # Profile Position Mode
sdo: # SDO executed during config
- {index: 0x6081, sub_index: 0, value: 1000} # Set Profile Velocity
- {index: 0x6083, sub_index: 0, value: 10000} # Set Profile Acceleration
- {index: 0x6084, sub_index: 0, value: 10000} # Set Profile Deceleration
- {index: 0x6085, sub_index: 0, value: 10000} # Set Quickstop Deceleration
- {index: 0x6098, sub_index: 0, value: 0} # Set default Homing Method to 0 (No homing operation required)
- {index: 0x60C2, sub_index: 1, value: 50} # Set Interpolation Time Period Value to 50 ms
- {index: 0x60C2, sub_index: 2, value: -3} # Set Interpolation Time Index to 10-3s
tpdo:
1:
enabled: true
cob_id: "auto"
transmission: 0x01
mapping:
- {index: 0x6041, sub_index: 0} # Statusword
- {index: 0x6061, sub_index: 0} # Modes of Operation Display
2:
enabled: true
cob_id: "auto"
transmission: 0x01
mapping:
- {index: 0x6064, sub_index: 0} # Position Actual Value
- {index: 0x606C, sub_index: 0} # Velocity Actual Value
3:
enabled: false
4:
enabled: false
rpdo:
1:
enabled: true
cob_id: "auto"
mapping:
- {index: 0x6040, sub_index: 0} # Controlword
- {index: 0x6060, sub_index: 0} # Modes of Operation
2:
enabled: true
cob_id: "auto"
mapping:
- {index: 0x607A, sub_index: 0} # Target Position
- {index: 0x60FF, sub_index: 0} # Target Velocity
3:
enabled: false
4:
enabled: false
nodes:
first_left_wheel_joint:
node_id: 2
first_right_wheel_joint:
node_id: 3
second_left_wheel_joint:
node_id: 4
second_right_wheel_joint:
node_id: 5
</code></pre>
<blockquote>
<p>diffbot_controllers.yaml</p>
</blockquote>
<pre><code>controller_manager:
ros__parameters:
update_rate: 10 # Hz
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
diffbot_base_controller:
type: diff_drive_controller/DiffDriveController
diffbot_base_controller:
ros__parameters:
joints:
left_wheel_names: ["first_left_wheel_joint", "second_left_wheel_joint"]
right_wheel_names: ["first_right_wheel_joint", "second_right_wheel_joint"]
command_interfaces:
- position
state_interfaces:
- position
- velocity
wheel_separation: 0.4
#wheels_per_side: 1 # actually 2, but both are controlled by 1 signal
wheel_radius: 0.1
wheel_separation_multiplier: 1.0
left_wheel_radius_multiplier: 1.0
right_wheel_radius_multiplier: 1.0
publish_rate: 50.0
odom_frame_id: odom
base_frame_id: base_link
pose_covariance_diagonal : [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
open_loop: true
enable_odom_tf: true
cmd_vel_timeout: 0.5
#publish_limited_velocity: true
#velocity_rolling_window_size: 10
# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
linear.x.has_velocity_limits: true
linear.x.has_acceleration_limits: true
linear.x.has_jerk_limits: false
linear.x.max_velocity: 1.0
linear.x.min_velocity: -1.0
linear.x.max_acceleration: 1.0
linear.x.max_jerk: 0.0
linear.x.min_jerk: 0.0
angular.z.has_velocity_limits: true
angular.z.has_acceleration_limits: true
angular.z.has_jerk_limits: false
angular.z.max_velocity: 1.0
angular.z.min_velocity: -1.0
angular.z.max_acceleration: 1.0
angular.z.min_acceleration: -1.0
angular.z.max_jerk: 0.0
angular.z.min_jerk: 0.0
</code></pre>
<blockquote>
<p>diffbot.ros2_control.xacro</p>
</blockquote>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="diffbot_ros2_control" params="name
use_mock_hardware
prefix
bus_config
master_config
can_interface_name
master_bin
">
<ros2_control name="<span class="math-container">${name}" type="system">
<xacro:unless value="$</span>{use_mock_hardware}">
<hardware>
<plugin>canopen_ros2_control/RobotSystem</plugin>
<param name="bus_config"><span class="math-container">${bus_config}</param>
<param name="master_config">$</span>{master_config}</param>
<param name="can_interface_name"><span class="math-container">${can_interface_name}</param>
<param name="master_bin">"$</span>{master_bin}"</param>
<param name="example_param_hw_start_duration_sec">0</param>
<param name="example_param_hw_stop_duration_sec">3.0</param>
</hardware>
</xacro:unless>
<xacro:if value="<span class="math-container">${use_mock_hardware}">
<hardware>
<plugin>mock_components/GenericSystem</plugin>
<param name="calculate_dynamics">true</param>
</hardware>
</xacro:if>
<joint name="$</span>{prefix}first_left_wheel_joint">
<param name="device_name">first_left_wheel_joint</param>
<command_interface name="velocity"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
<joint name="<span class="math-container">${prefix}first_right_wheel_joint">
<param name="device_name">first_right_wheel_joint</param>
<command_interface name="velocity"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
<joint name="$</span>{prefix}second_left_wheel_joint">
<param name="device_name">second_left_wheel_joint</param>
<command_interface name="velocity"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
<joint name="${prefix}second_right_wheel_joint">
<param name="device_name">second_right_wheel_joint</param>
<command_interface name="velocity"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
</ros2_control>
</xacro:macro>
</robot>
</code></pre>
<blockquote>
<p>diffbot.urdf</p>
</blockquote>
<pre><code><?xml version="1.0"?>
<!-- Basic differential drive mobile base -->
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="diffdrive_robot">
<xacro:arg name="prefix" default="" />
<xacro:arg name="use_mock_hardware" default="false" />
<xacro:include filename="diffbot_description.urdf.xacro" />
<!-- Import Rviz colors -->
<xacro:include filename="diffbot.materials.xacro" />
<xacro:arg name="can_interface_name" default="vcan0" />
<!-- Import diffbot ros2_control description -->
<xacro:include filename="diffbot.ros2_control.xacro" />
<xacro:diffbot prefix="$(arg prefix)" />
<xacro:diffbot_ros2_control
name="DiffBot" prefix="<span class="math-container">$(arg prefix)" use_mock_hardware="$</span>(arg use_mock_hardware)"
bus_config="<span class="math-container">$(find panda_canopen)/config/cia402/bus.yml"
master_config="$</span>(find panda_canopen)/config/cia402/master.dcf"
can_interface_name="$(arg can_interface_name)"
master_bin=""
/>
</robot>
</code></pre>
<blockquote>
<p>launch</p>
</blockquote>
<pre><code>from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, RegisterEventHandler, OpaqueFunction, IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.event_handlers import OnProcessExit
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution, LaunchConfiguration
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from launch.launch_description_sources import PythonLaunchDescriptionSource
import yaml
def launch_setup(context, *args, **kwargs):
can_interface_name = LaunchConfiguration("can_interface_name")
nodes_to_start = []
# Launch slaves nodes
slave_launch = PathJoinSubstitution(
[FindPackageShare("canopen_fake_slaves"), "launch", "cia402_slave.launch.py"]
)
bus_config = PathJoinSubstitution(
[FindPackageShare("my_robot"), "config", "cia402", "bus.yml"]
)
with open(bus_config.perform(context), 'r') as f:
bus_config_dict = yaml.safe_load(f)
joints = []
for key in bus_config_dict.keys():
if "joint" in key:
joints.append(key)
for joint in joints:
nodes_to_start.append(
IncludeLaunchDescription(
PythonLaunchDescriptionSource(slave_launch),
launch_arguments={
"node_id": str(bus_config_dict[joint]["node_id"]),
"node_name": f"slave_node_{joint}",
"slave_config": PathJoinSubstitution([
FindPackageShare("my_robot"), "config", "cia402", str(bus_config_dict[joint]["dcf"])
]),
"can_interface_name": can_interface_name,
}.items(),
)
)
# Launch master node
master_launch = PathJoinSubstitution(
[FindPackageShare("canopen_core"), "launch", "canopen.launch.py"]
)
master_config = PathJoinSubstitution(
[FindPackageShare("my_robot"), "config", "cia402", "master.dcf"]
)
bus_config = PathJoinSubstitution(
[FindPackageShare("my_robot"), "config", "cia402", "bus.yml"]
)
nodes_to_start.append(
IncludeLaunchDescription(
PythonLaunchDescriptionSource(master_launch),
launch_arguments={
"master_config": master_config,
"master_bin": "",
"bus_config": bus_config,
"can_interface_name": can_interface_name,
}.items(),
)
)
return nodes_to_start
def generate_launch_description():
# Declare arguments
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"gui",
default_value="true",
description="Start RViz2 automatically with this launch file.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"use_mock_hardware",
default_value="false",
description="Start robot with mock hardware mirroring command to its states.",
)
)
# Initialize Arguments
gui = LaunchConfiguration("gui")
use_mock_hardware = LaunchConfiguration("use_mock_hardware")
# Get URDF via xacro
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[FindPackageShare("my_robot"), "urdf", "diff_robot.urdf"]
),
" ",
"use_mock_hardware:=",
use_mock_hardware,
]
)
robot_description = {"robot_description": robot_description_content}
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("my_robot"),
"config",
"diffbot_controllers.yaml",
]
)
rviz_config_file = PathJoinSubstitution(
[FindPackageShare("my_robot"), "diffbot/rviz", "diffbot.rviz"]
)
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
output="both",
)
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
remappings=[
("/diff_drive_controller/cmd_vel_unstamped", "/cmd_vel"),
],
)
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
arguments=["-d", rviz_config_file],
condition=IfCondition(gui),
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
)
robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["diffbot_base_controller", "--controller-manager", "/controller_manager"],
)
# Delay rviz start after `joint_state_broadcaster`
delay_rviz_after_joint_state_broadcaster_spawner = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=joint_state_broadcaster_spawner,
on_exit=[rviz_node],
)
)
# Delay start of robot_controller after `joint_state_broadcaster`
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=joint_state_broadcaster_spawner,
on_exit=[robot_controller_spawner],
)
)
nodes = [
control_node,
robot_state_pub_node,
joint_state_broadcaster_spawner,
delay_rviz_after_joint_state_broadcaster_spawner,
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner,
]
declared_arguments.append(
DeclareLaunchArgument(
"can_interface_name",
default_value="vcan0",
description="CAN interface name to run the master and, when in simulation, the fake slaves.",
)
)
return LaunchDescription(declared_arguments + nodes + [OpaqueFunction(function=launch_setup)])
</code></pre>
| I am willing to implement ros2_canopen with ros2_control |
<p>Finally I was able to copy the odometer example and run it in my gazebo instance. So this is what I did:</p>
<ul>
<li>Created the classes MyOdometerSystem and MyOdometer according to the given examples OdometerSystem (gz-sim repo) and Odometer (gz-sensors repo)</li>
<li>Both classes are flat in one directory for simplification</li>
<li>Added my build directory to the GZ_SIM_SYSTEM_PLUGIN_PATH environment variable: export GZ_SIM_SYSTEM_PLUGIN_PATH=/[mydirectory]/build/MyOdometer/</li>
</ul>
<p>Following code worked for me:</p>
<p><strong>MyOdometer.hh</strong></p>
<pre><code>#ifndef MYODOMETER_HH_
#define MYODOMETER_HH_
#include <gz/sensors/Sensor.hh>
#include <gz/sensors/SensorTypes.hh>
#include <gz/transport/Node.hh>
namespace custom
{
/// \brief Example sensor that publishes the total distance travelled by a
/// robot, with noise.
class MyOdometer : public gz::sensors::Sensor
{
/// \brief Load the sensor with SDF parameters.
/// \param[in] _sdf SDF Sensor parameters.
/// \return True if loading was successful
public: virtual bool Load(const sdf::Sensor &_sdf) override;
/// \brief Update the sensor and generate data
/// \param[in] _now The current time
/// \return True if the update was successfull
public: virtual bool Update(
const std::chrono::steady_clock::duration &_now) override;
/// \brief Set the current postiion of the robot, so the odometer can
/// calculate the distance travelled.
/// \param[in] _pos Current position in world coordinates.
public: void NewPosition(const gz::math::Vector3d &_pos);
/// \brief Get the latest world postiion of the robot.
/// \return The latest position given to the odometer.
public: const gz::math::Vector3d &Position() const;
/// \brief Previous position of the robot.
private: gz::math::Vector3d prevPos{std::nan(""), std::nan(""),
std::nan("")};
/// \brief Latest total distance.
private: double totalDistance{0.0};
/// \brief Noise that will be applied to the sensor data
private: gz::sensors::NoisePtr noise{nullptr};
/// \brief Node for communication
private: gz::transport::Node node;
/// \brief Publishes sensor data
private: gz::transport::Node::Publisher pub;
};
}
#endif
</code></pre>
<p><strong>MyOdometer.cc</strong></p>
<pre><code>#include <math.h>
#include <gz/msgs/double.pb.h>
#include <gz/common/Console.hh>
#include <gz/msgs/Utility.hh>
#include <gz/sensors/Noise.hh>
#include <gz/sensors/Util.hh>
#include "MyOdometer.hh"
using namespace custom;
//////////////////////////////////////////////////
bool MyOdometer::Load(const sdf::Sensor &_sdf)
{
auto type = gz::sensors::customType(_sdf);
if ("myodometer" != type)
{
gzerr << "Trying to load [myodometer] sensor, but got type ["
<< type << "] instead." << std::endl;
return false;
}
// Load common sensor params
gz::sensors::Sensor::Load(_sdf);
// Advertise topic where data will be published
this->pub = this->node.Advertise<gz::msgs::Double>(this->Topic());
if (!_sdf.Element()->HasElement("gz:myodometer"))
{
gzdbg << "No custom configuration for [" << this->Topic() << "]"
<< std::endl;
return true;
}
// Load custom sensor params
auto customElem = _sdf.Element()->GetElement("gz:myodometer");
if (!customElem->HasElement("noise"))
{
gzdbg << "No noise for [" << this->Topic() << "]" << std::endl;
return true;
}
sdf::Noise noiseSdf;
noiseSdf.Load(customElem->GetElement("noise"));
this->noise = gz::sensors::NoiseFactory::NewNoiseModel(noiseSdf);
if (nullptr == this->noise)
{
gzerr << "Failed to load noise." << std::endl;
return false;
}
return true;
}
//////////////////////////////////////////////////
bool MyOdometer::Update(const std::chrono::steady_clock::duration &_now)
{
gz::msgs::Double msg;
*msg.mutable_header()->mutable_stamp() = gz::msgs::Convert(_now);
auto frame = msg.mutable_header()->add_data();
frame->set_key("frame_id");
frame->add_value(this->Name());
this->totalDistance = this->noise->Apply(this->totalDistance);
msg.set_data(this->totalDistance);
this->AddSequence(msg.mutable_header());
this->pub.Publish(msg);
return true;
}
//////////////////////////////////////////////////
void MyOdometer::NewPosition(const gz::math::Vector3d &_pos)
{
if (!isnan(this->prevPos.X()))
{
this->totalDistance += this->prevPos.Distance(_pos);
}
this->prevPos = _pos;
}
//////////////////////////////////////////////////
const gz::math::Vector3d &MyOdometer::Position() const
{
return this->prevPos;
}
</code></pre>
<p><strong>MyOdometerSystem.hh</strong></p>
<pre><code>#ifndef MYODOMETERSYSTEM_HH_
#define MYODOMETERSYSTEM_HH_
#include <gz/sim/System.hh>
#include <gz/sensors/Sensor.hh>
#include <gz/transport/Node.hh>
namespace custom
{
/// \brief Example showing how to tie a custom sensor, in this case an
/// odometer, into simulation
class MyOdometerSystem:
public gz::sim::System,
public gz::sim::ISystemPreUpdate,
public gz::sim::ISystemPostUpdate
{
// Documentation inherited.
// During PreUpdate, check for new sensors that were inserted
// into simulation and create more components as needed.
public: void PreUpdate(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm) final;
// Documentation inherited.
// During PostUpdate, update the known sensors and publish their data.
// Also remove sensors that have been deleted.
public: void PostUpdate(const gz::sim::UpdateInfo &_info,
const gz::sim::EntityComponentManager &_ecm) final;
/// \brief Remove custom sensors if their entities have been removed from
/// simulation.
/// \param[in] _ecm Immutable reference to ECM.
private: void RemoveSensorEntities(
const gz::sim::EntityComponentManager &_ecm);
/// \brief A map of custom entities to their sensors
private: std::unordered_map<gz::sim::Entity,
std::shared_ptr<MyOdometer>> entitySensorMap;
};
}
#endif
</code></pre>
<p><strong>MyOdometerSystem.cc</strong></p>
<pre><code>#include <gz/msgs/double.pb.h>
#include <string>
#include <unordered_map>
#include <utility>
#include <gz/common/Profiler.hh>
#include <gz/plugin/Register.hh>
#include <gz/sensors/Noise.hh>
#include <gz/sensors/SensorFactory.hh>
#include <sdf/Sensor.hh>
#include <gz/sim/components/CustomSensor.hh>
#include <gz/sim/components/Name.hh>
#include <gz/sim/components/ParentEntity.hh>
#include <gz/sim/components/Sensor.hh>
#include <gz/sim/components/World.hh>
#include <gz/sim/EntityComponentManager.hh>
#include <gz/sim/Util.hh>
#include "MyOdometer.hh"
#include "MyOdometerSystem.hh"
using namespace custom;
//////////////////////////////////////////////////
void MyOdometerSystem::PreUpdate(const gz::sim::UpdateInfo &,
gz::sim::EntityComponentManager &_ecm)
{
_ecm.EachNew<gz::sim::components::CustomSensor,
gz::sim::components::ParentEntity>(
[&](const gz::sim::Entity &_entity,
const gz::sim::components::CustomSensor *_custom,
const gz::sim::components::ParentEntity *_parent)->bool
{
// Get sensor's scoped name without the world
auto sensorScopedName = gz::sim::removeParentScope(
gz::sim::scopedName(_entity, _ecm, "::", false), "::");
sdf::Sensor data = _custom->Data();
data.SetName(sensorScopedName);
// Default to scoped name as topic
if (data.Topic().empty())
{
std::string topic = scopedName(_entity, _ecm) + "/myodometer";
data.SetTopic(topic);
}
gz::sensors::SensorFactory sensorFactory;
auto sensor = sensorFactory.CreateSensor<custom::MyOdometer>(data);
if (nullptr == sensor)
{
gzerr << "Failed to create myodometer [" << sensorScopedName << "]"
<< std::endl;
return false;
}
// Set sensor parent
auto parentName = _ecm.Component<gz::sim::components::Name>(
_parent->Data())->Data();
sensor->SetParent(parentName);
// Set topic on Gazebo
_ecm.CreateComponent(_entity,
gz::sim::components::SensorTopic(sensor->Topic()));
// Keep track of this sensor
this->entitySensorMap.insert(std::make_pair(_entity,
std::move(sensor)));
return true;
});
}
//////////////////////////////////////////////////
void MyOdometerSystem::PostUpdate(const gz::sim::UpdateInfo &_info,
const gz::sim::EntityComponentManager &_ecm)
{
// Only update and publish if not paused.
if (!_info.paused)
{
for (auto &[entity, sensor] : this->entitySensorMap)
{
sensor->NewPosition(gz::sim::worldPose(entity, _ecm).Pos());
sensor->Update(_info.simTime);
}
}
this->RemoveSensorEntities(_ecm);
}
//////////////////////////////////////////////////
void MyOdometerSystem::RemoveSensorEntities(
const gz::sim::EntityComponentManager &_ecm)
{
_ecm.EachRemoved<gz::sim::components::CustomSensor>(
[&](const gz::sim::Entity &_entity,
const gz::sim::components::CustomSensor *)->bool
{
if (this->entitySensorMap.erase(_entity) == 0)
{
gzerr << "Internal error, missing myodometer for entity ["
<< _entity << "]" << std::endl;
}
return true;
});
}
GZ_ADD_PLUGIN(MyOdometerSystem, gz::sim::System,
MyOdometerSystem::ISystemPreUpdate,
MyOdometerSystem::ISystemPostUpdate
)
GZ_ADD_PLUGIN_ALIAS(MyOdometerSystem, "custom::MyOdometerSystem")
</code></pre>
<p><strong>CMakeLists.txt</strong></p>
<pre><code>find_package(gz-cmake3 REQUIRED)
project(MyOdometerSystem)
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})
find_package(gz-sensors8 REQUIRED)
set(GZ_SENSORS_VER ${gz-sensors8_VERSION_MAJOR})
add_library(MyOdometerSystem SHARED MyOdometer.cc MyOdometerSystem.cc)
target_link_libraries(MyOdometerSystem
PRIVATE gz-plugin<span class="math-container">${GZ_PLUGIN_VER}::gz-plugin$</span>{GZ_PLUGIN_VER}
PRIVATE gz-sim<span class="math-container">${GZ_SIM_VER}::gz-sim$</span>{GZ_SIM_VER}
PRIVATE gz-sensors<span class="math-container">${GZ_SENSORS_VER}::gz-sensors$</span>{GZ_SENSORS_VER})
</code></pre>
<p><strong>MyOdometer.sdf</strong></p>
<pre><code><?xml version="1.0" ?>
<sdf version="1.6">
<world name="myodometer_world">
<plugin
filename="gz-sim-physics-system"
name="gz::sim::systems::Physics">
</plugin>
<plugin
filename="gz-sim-user-commands-system"
name="gz::sim::systems::UserCommands">
</plugin>
<plugin
filename="gz-sim-scene-broadcaster-system"
name="gz::sim::systems::SceneBroadcaster">
</plugin>
<!-- The system is added to the world, so it handles all odometers in the world-->
<plugin
filename="MyOdometerSystem"
name="custom::MyOdometerSystem">
</plugin>
<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 0 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>
<model name="ground_plane">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
</collision>
<visual name="visual">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<material>
<ambient>0.8 0.8 0.8 1</ambient>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.8 0.8 0.8 1</specular>
</material>
</visual>
</link>
</model>
<model name="model_with_sensor">
<pose>0 0 0.05 0 0 0</pose>
<link name="link">
<inertial>
<mass>0.1</mass>
<inertia>
<ixx>0.000166667</ixx>
<iyy>0.000166667</iyy>
<izz>0.000166667</izz>
</inertia>
</inertial>
<collision name="collision">
<geometry>
<box>
<size>0.1 0.1 0.1</size>
</box>
</geometry>
</collision>
<visual name="visual">
<geometry>
<box>
<size>0.1 0.1 0.1</size>
</box>
</geometry>
</visual>
<!-- Here's our custom sensor -->
<sensor name="an_odometer" type="custom" gz:type="myodometer">
<always_on>1</always_on>
<update_rate>30</update_rate>
<visualize>true</visualize>
<gz:myodometer>
<noise type="gaussian">
<mean>0.00001</mean>
<stddev>0.00001</stddev>
</noise>
</gz:myodometer>
</sensor>
</link>
<!-- Use the velocity control plugin to give it some initial velocity -->
<plugin
filename="gz-sim-velocity-control-system"
name="gz::sim::systems::VelocityControl">
<initial_linear>0.2 0 0</initial_linear>
</plugin>
</model>
</world>
</sdf>
</code></pre>
<p>How to run:</p>
<ul>
<li>Run gz sim with myodometer.sdf: <code>gz sim myodometer.sdf -v 3</code></li>
<li>Hit play to let the vehicle run</li>
<li>Listen to the topic myodometer in a different shell: <code>gz topic -e -t /world/myodometer_world/model/model_with_sensor/link/link/sensor/an_odometer/myodometer</code></li>
</ul>
<p>This example just integrates the system plugin and sensor plugin in one directory and can be used for your custom sensor plugins as a template.</p>
<p>At the end I don't know why it was causing me so much trouble to create this example, but special thanks to the user bcn for helping me to figure out severeal problems during this task.</p>
| 108482 | 2024-02-22T09:55:07.553 | |gazebo|c++| | <p>Currently I'm trying to write my own sensor plugin, based on the examples odometer and odometersystem from the git repository, but am failing to add the plugins to gazebo.
The system plugin OdometerSystem seems to be ok, but as soon as I add an instance of the sensor plugin Odometer, I get an undefined symbol error.</p>
<p>To make it very simple, I have written this basic code without doing anything but deriving from the sensor class:</p>
<p><strong>MyClass.hh</strong></p>
<pre><code>#ifndef MYCLASS_HH_
#define MYCLASS_HH_
#include <gz/sensors/Sensor.hh>
#include <gz/sensors/SensorTypes.hh>
#include <gz/transport/Node.hh>
namespace myclass
{
class MyClass : public gz::sensors::Sensor
{
/// \brief Load the sensor with SDF parameters.
/// \param[in] _sdf SDF Sensor parameters.
/// \return True if loading was successful
public: virtual bool Load(const sdf::Sensor &_sdf) override;
/// \brief Update the sensor and generate data
/// \param[in] _now The current time
/// \return True if the update was successfull
public: virtual bool Update(const std::chrono::steady_clock::duration &_now) override;
};
}
#endif
</code></pre>
<p><strong>MyClass.cc</strong></p>
<pre><code>#include "MyClass.hh"
using namespace myclass;
bool MyClass::Load(const sdf::Sensor &_sdf)
{
return true;
}
bool MyClass::Update(const std::chrono::steady_clock::duration &_now)
{
return true;
}
</code></pre>
<p>Adding an object of MyClass to my system plugin <em>MyClassSystem</em>:</p>
<pre><code>void MyClassSystem::PreUpdate(const gz::sim::UpdateInfo &,
gz::sim::EntityComponentManager &_ecm)
{
...
myclass::MyClass myClass;
return true;
}
</code></pre>
<p>Doing this results in this error while starting gazebo:<br />
<em>undefined symbol: _ZTVN7myclass7MyClassE</em></p>
<p>When I don't derive from gz::sensor::Sensor everything is fine.</p>
<p>This might be a very basic question, but what am I missing out here?</p>
<p><strong>### Edit for additional information: ###</strong><br />
I registered the plugin MyClassSystem to gazebo like this:</p>
<pre><code>GZ_ADD_PLUGIN(myclass::MyClassSystem, gz::sim::System,
myclass::ISystemPreUpdate,
myclass::ISystemPostUpdate
)
</code></pre>
<p>Modifying MyClass like following code is actually working:</p>
<p><strong>MyClass.hh</strong></p>
<pre><code>#ifndef MYCLASS_HH_
#define MYCLASS_HH_
#include <gz/sensors/Sensor.hh>
#include <gz/sensors/SensorTypes.hh>
#include <gz/transport/Node.hh>
namespace myclass
{
class MyClass
{
// Nothing done here
};
}
#endif
</code></pre>
<p><strong>MyClass.cc</strong></p>
<pre><code>#include "MyClass.hh"
using namespace myclass;
// Nothing to see here
</code></pre>
<p><strong>### Edit2: CMake Test ###</strong></p>
<p>I assume it's a problem with my CMakeLists.txt and simplified my code to test this theory. This is my code for now:</p>
<p><strong>CMakeLists.txt</strong></p>
<pre><code>project(MyClassSystem)
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})
find_package(gz-sensors8 REQUIRED)
set(GZ_SENSORS_VER ${gz-sensors8_VERSION_MAJOR})
add_library(MyClassSystem SHARED MySuperClass.cc MyClass.cc MyClassSystem.cc )
set_property(TARGET MyClassSystem PROPERTY CXX_STANDARD 17)
target_link_libraries(MyClassSystem
PRIVATE gz-plugin<span class="math-container">${GZ_PLUGIN_VER}::gz-plugin$</span>{GZ_PLUGIN_VER}
PRIVATE gz-sim<span class="math-container">${GZ_SIM_VER}::gz-sim$</span>{GZ_SIM_VER}
PRIVATE gz-sensors<span class="math-container">${GZ_SENSORS_VER}::gz-sensors$</span>{GZ_SENSORS_VER})
</code></pre>
<p><strong>MyClassSystem.cc</strong></p>
<pre><code>#include <gz/msgs/double.pb.h>
#include <string>
#include <unordered_map>
#include <utility>
#include <gz/common/Profiler.hh>
#include <gz/plugin/Register.hh>
#include <gz/sensors/Noise.hh>
#include <gz/sensors/SensorFactory.hh>
#include <sdf/Sensor.hh>
#include <gz/sim/components/CustomSensor.hh>
#include <gz/sim/components/Name.hh>
#include <gz/sim/components/ParentEntity.hh>
#include <gz/sim/components/Sensor.hh>
#include <gz/sim/components/World.hh>
#include <gz/sim/EntityComponentManager.hh>
#include <gz/sim/Util.hh>
#include "MyClassSystem.hh"
#include "MyClass.hh"
GZ_ADD_PLUGIN(myclasssystem::MyClassSystem, gz::sim::System,
myclasssystem::MyClassSystem::ISystemPreUpdate,
myclasssystem::MyClassSystem::ISystemPostUpdate
)
using namespace myclasssystem;
//////////////////////////////////////////////////
void MyClassSystem::PreUpdate(const gz::sim::UpdateInfo &,
gz::sim::EntityComponentManager &_ecm)
{
myclass::MyClass myClass;
myClass.Test(true);
}
//////////////////////////////////////////////////
void MyClassSystem::PostUpdate(const gz::sim::UpdateInfo &_info,
const gz::sim::EntityComponentManager &_ecm)
{
}
</code></pre>
<p><strong>MyClassSystem.hh</strong></p>
<pre><code>#ifndef MYCLASSSYSTEM_HH_
#define MYCLASSSYSTEM_HH_
#include <gz/sim/System.hh>
#include <gz/sensors/Sensor.hh>
#include <gz/transport/Node.hh>
namespace myclasssystem
{
/// \brief Example showing how to tie a custom sensor, in this case an
/// odometer, into simulation
class MyClassSystem:
public gz::sim::System,
public gz::sim::ISystemPreUpdate,
public gz::sim::ISystemPostUpdate
{
// Documentation inherited.
// During PreUpdate, check for new sensors that were inserted
// into simulation and create more components as needed.
public: void PreUpdate(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm) final;
// Documentation inherited.
// During PostUpdate, update the known sensors and publish their data.
// Also remove sensors that have been deleted.
public: void PostUpdate(const gz::sim::UpdateInfo &_info,
const gz::sim::EntityComponentManager &_ecm) final;
};
}
#endif
</code></pre>
<p><strong>MySuperClass.cc</strong></p>
<pre><code>#include "MySuperClass.hh"
using namespace mysuperclass;
bool Test(bool param)
{
return param;
}
</code></pre>
<p><strong>MySuperClass.hh</strong></p>
<pre><code>#ifndef MYSUPERCLASS_HH_
#define MYSUPERCLASS_HH_
namespace mysuperclass
{
class MySuperClass
{
public: MySuperClass() = default;
public: virtual ~MySuperClass() = default;
public: bool Test(bool param);
};
}
#endif
</code></pre>
<p><strong>MyClass.cc</strong></p>
<pre><code>#include "MyClass.hh"
using namespace myclass;
</code></pre>
<p><strong>MyClass.hh</strong></p>
<pre><code>#ifndef MYCLASS_HH_
#define MYCLASS_HH_
#include <gz/sensors/Sensor.hh>
#include <gz/sensors/SensorTypes.hh>
#include <gz/transport/Node.hh>
#include "MySuperClass.hh"
namespace myclass
{
class MyClass : public mysuperclass::MySuperClass
{
};
}
#endif
</code></pre>
<p>For simplification all files are flat in one and the same directory.</p>
<p>Error message is like this:</p>
<blockquote>
<p>gz sim sensor_tutorial.sdf -v 3 -s: symbol lookup error: .../build/MyClassSystem/libMyClassSystem.so: undefined symbol: _ZN12mysuperclass12MySuperClass4TestEb</p>
</blockquote>
<p>So i try to call the function Test(bool param) from the object myclass, while the function Test is only defined and implemented in the superclass MySuperClass. According to the error message here seems to be a misconfiguration that causes a problem within the linking process.</p>
<p>At this point it seems to be pretty obvious that it has nothing to do with gazebo itself. It's just my lack of understanding and experience how to include files and libs correctly with cmake.</p>
| How to add a custom sensor plugin? |
<p>You can look at the <a href="https://wiki.ros.org/laser_filters" rel="nofollow noreferrer">laser filter package</a>.
There is also a ROS2 implementation.</p>
| 108532 | 2024-02-24T13:47:15.990 | |ros2|lidar|nav2| | <p>I'm using nav2 on a real robot. It has a 360ΒΊ Lidar and right behind it it has magnetometer mounting pole. Lidar driver has not angle range limit parameter. So I'm wondering how to ignore an object that is inside the robot to be considered as an obstacle in the local costmap.</p>
| nav2: how to ignore part of the robot on the lidar scan plane |
<p>I did this before, and indeed we need to be careful with linking. I will assume that, for example, we have a ROS 2 package that uses a third-party C++ library called <em><strong>libcustom</strong></em> that is included in the package as a subdirectory. This third-party library needs to be compiled with our package. Then, in the package's CMakeLists.txt, we should add the following line.</p>
<pre><code>add_subdirectory(libcustom)
</code></pre>
<p>Notice that the third-party library must have its own CMakeLists.txt file, which CMake will process during the build configuration. This subdirectory is named <code>libcustom</code> in the previous command.</p>
<p>Let's see <strong>how to link</strong> our targets (executables or libraries) against this library. It is done as follows.</p>
<pre><code>target_link_libraries(executable_name libcustom)
</code></pre>
<p><strong>Why would we use <code>target_link_libraries</code> instead of <code>ament_target_dependencies</code>?</strong></p>
<p>The command <code>ament_target_dependencies</code> is specific to the ROS 2 build system, provided by the ament_cmake package. It is used to specify that a target depends on certain ROS 2 packages or libraries. When we use <code>ament_target_dependencies</code>, it automatically handles include directories, and compilation and linking dependencies. It ensures all necessary components are properly included and linked.</p>
<p>However, in our case, when using a third-party library, we need to link explicitly with <code>target_link_libraries.</code> This standard CMake command links a target against any library (not necessarily ROS 2 packages), including system libraries and third-party libraries.</p>
<p><strong>How to be sure about the library name in the command <code>target_link_libraries</code>?</strong></p>
<p>This is the last piece we need to get right. It is simple. Look into the third-party library's CMakeLists.txt file for the command <code>add_library</code>, which defines the library as its first argument.</p>
<p>I hope this helps. Feel free to let me know if you need more help with that.</p>
| 109534 | 2024-02-24T23:53:31.947 | |ros2|colcon|library|submodule| | <p>I added a CMake-based library as a submodule of a package of mine.</p>
<p>With <code>colcon</code> I can correctly build and install the library file and the include files in the <code>install</code> folder of my workspace.</p>
<p>My problem is that the linker cannot find the library when building my package.</p>
<p>I know it's a problem of path, but I have not understood how to correctly set the path to find it.</p>
<p>Thank you in advance
Walter</p>
| C++ library as submodule not found by linker |
<p>I have now found the issue to be with Pluginlib and not not MoveIt specific. In CMakeLists.txt the line</p>
<pre><code>pluginlib_export_plugin_description_file(unity_controller plugins.xml)
</code></pre>
<p>should be replaced with</p>
<pre><code>pluginlib_export_plugin_description_file(moveit_core plugins.xml)
</code></pre>
<p>as this should contain the package the plugin is for and not the plugin's own.
With this change the plugin is now discovered and used correctly.</p>
| 109535 | 2024-02-25T12:06:00.910 | |ros2|moveit|ros-humble|pluginlib| | <p>For a project using ROS2 as a planning back-end for a robot simulation in Unity I am trying to make a custom MoveIt controller-manager and -handle that send trajectories planned by MoveIt to Unity based on this Project for ROS1: <a href="https://github.com/szandara/unity_moveit_manager/tree/master/src/unity_moveit_manager" rel="nofollow noreferrer">https://github.com/szandara/unity_moveit_manager/tree/master/src/unity_moveit_manager</a>. I am however very much a beginner at using ROS and as such this is my first time making a plugin for MoveIt. While I have searched for official documentation on this, what I could find was either too basic or still for ROS1.</p>
<p>The plugin itself builds without warnings or errors, however when I try to get MoveIt to use this plugin by editing the moveit_controllers.yaml file of a Setup-Assistant generated MoveIt-config like so:</p>
<pre class="lang-yaml prettyprint-override"><code># MoveIt uses this configuration for controller management
# moveit_controller_manager: moveit_simple_controller_manager/MoveItSimpleControllerManager
moveit_controller_manager: unity_controller/UnityControllerManager
# moveit_simple_controller_manager:
unity_controller:
controller_names:
- robot_arm_controller
robot_arm_controller:
type: FollowJointTrajectory
action_ns: follow_joint_trajectory
default: true
joints:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
</code></pre>
<p>And launch MoveIt, for example with demo.launch.py, I will get the following Error messages and a robot that can plan but not execute trajectories:</p>
<pre><code>[move_group-3] [FATAL] [1708859046.029615231] [moveit_ros.trajectory_execution_manager]: Exception while loading controller manager 'unity_controller/UnityControllerManager': According to the loaded plugin descriptions the class unity_controller/UnityControllerManager with base class type moveit_controller_manager::MoveItControllerManager does not exist. Declared types are moveit_simple_controller_manager/MoveItSimpleControllerManager
[move_group-3] [ERROR] [1708859046.029670616] [moveit_ros.trajectory_execution_manager]: Failed to reload controllers: `controller_manager_` does not exist.
</code></pre>
<p>Apparently MoveIt can't find the unity_controller plugin. I've tried a number of ways to fix this issue or just to discover what exactly goes wrong. Among these I have build a demo-plugin following the pluginlib tutorial for Humble (Which worked) and then trying to load my controller-plugin the same way (Which didn't). Here is the Testbench I wrote and the resulting error message:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <cstdio>
#include <pluginlib/class_loader.hpp>
#include <polygon_base/regular_polygon.hpp>
#include <moveit/controller_manager/controller_manager.h>
int main(int argc, char ** argv)
{
(void) argc;
(void) argv;
pluginlib::ClassLoader<polygon_base::RegularPolygon> poly_loader("polygon_base", "polygon_base::RegularPolygon");
pluginlib::ClassLoader<moveit_controller_manager::MoveItControllerManager> controller_loader("moveit", "moveit_controller_manager::MoveItControllerManager");
try {
std::shared_ptr<polygon_base::RegularPolygon> triangle = poly_loader.createSharedInstance("polygon_plugins::Triangle");
std::shared_ptr<moveit_controller_manager::MoveItControllerManager> unity_controller_manager = controller_loader.createSharedInstance("moveit_simple_controller_manager::MoveItSimpleControllerManager");
triangle->initialize(10.0);
printf("Triangle area: %.2f\n", triangle->area());
printf("Instance made successfully\n");
} catch(pluginlib::LibraryLoadException& ex) {
printf("Library load exception : %s\n", ex.what());
} catch(pluginlib::ClassLoaderException& ex) {
printf("Class load exception : %s\n", ex.what());
} catch(pluginlib::PluginlibException& ex) {
printf("Some other exception: %s\n", ex.what());
}
return 0;
}
</code></pre>
<pre><code>run plugin_test plugin_tester
Library load exception : According to the loaded plugin descriptions the class moveit_simple_controller_manager::MoveItSimpleControllerManager with base class type moveit_controller_manager::MoveItControllerManager does not exist. Declared types are
</code></pre>
<p>I've noticed that this time the standart moveit_simple_controller_manager/MoveItSimpleControllerManager doesn't seem to be found either as seen in the different messages. Right now my guess is that for loading MoveIt plugins some extra step is required that I have been unable to discover.</p>
<p>I would be thankful if somebody could point me to the issue that is preventing MoveIt from finding and using my plugin.</p>
<p>In case the issue lies with my plugin itself, here is that:</p>
<blockquote>
<p>Since I have discovered the issue to be with CMakeLists.txt I have shortened this part to the offending file</p>
</blockquote>
<p>CMakeLists.txt:</p>
<pre><code>cmake_minimum_required(VERSION 3.8)
project(unity_controller)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(rclcpp REQUIRED)
find_package(moveit_core REQUIRED)
find_package(trajectory_msgs REQUIRED)
find_package(pluginlib REQUIRED)
pluginlib_export_plugin_description_file(unity_controller plugins.xml)
add_library(unity_controller src/unity_controller.cpp)
target_compile_features(unity_controller PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
target_include_directories(unity_controller PUBLIC
<span class="math-container">$<BUILD_INTERFACE:$</span>{CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
unity_controller
"trajectory_msgs"
"rclcpp"
"moveit_core"
"pluginlib"
)
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(unity_controller PRIVATE "UNITY_CONTROLLER_BUILDING_LIBRARY")
install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS unity_controller
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_export_include_directories(
include
)
ament_export_libraries(
unity_controller
)
ament_export_targets(
export_${PROJECT_NAME}
)
ament_package()
<span class="math-container">```</span>
</code></pre>
| MoveIt can't find custom moveit_controller_manager plugin in ROS2 Humble |
<ol>
<li>Source you environment <code>source /opt/ros/melodic/setup.bash</code></li>
<li>Try running without .py <code>rosrun teleop_twist_keyboard teleop_twist_keyboard</code></li>
</ol>
<p>It should work most probably else try running this:
<code>rospack list | grep teleop_twist_keyboard</code>
if you don't see anything its probably not installed properly.</p>
<p>UPDATE:
The issue is with this command <code>sudo ln -s /usr/bin/python3 /usr/bin/python</code>, it creates a symlink between python and python3. But ROS melodic requires python2 not python 3. so you need to remove the symlink then install python 2 and create a symlink with python 2 and then run it again. I'll write the commands you need to follow.</p>
<ul>
<li><code>sudo rm /usr/bin/python</code> to remove the symlink from python to python 3</li>
<li><code>sudo apt install python2.7</code> check your <code>/usr/bin/</code>directory if python2 present skip to next step.</li>
<li><code>sudo ln -s /usr/bin/python2 /usr/bin/python</code> creates symlink with python2</li>
<li><code>source /opt/ros/melodic/setup.bash</code> source your ros env.</li>
<li><code>rosrun teleop_twist_keyboard teleop_twist_keyboard.py</code></li>
</ul>
<p>EXTRA:</p>
<pre><code>user:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Waiting for subscriber to connect to /cmd_vel
^CGot shutdown request before subscribers connected
user:~$ sudo ln -s /usr/bin/python3 /usr/bin/python
ln: failed to create symbolic link '/usr/bin/python': File exists
user:~$ sudo rm /usr/bin/python
user:~$ sudo ln -s /usr/bin/python3 /usr/bin/python
user:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
[rosrun] Couldn't find executable named teleop_twist_keyboard.py below /opt/ros/melodic/share/teleop_
twist_keyboard
user:~$ rospack list | grep teleop_twist_keyboard
teleop_twist_keyboard /opt/ros/melodic/share/teleop_twist_keyboard
user:~$ sudo rm /usr/bin/python
user:~$ sudo ln -s /usr/bin/python2 /usr/bin/python
user:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel
</code></pre>
| 109536 | 2024-02-25T15:23:32.670 | |ros|gazebo| | <p>I tried to control my bot using teleop_twist_keyboard.But I just cannot run teleop_twist_keyboard.py.Having examed the package,I thought I install the package correctly.I just cannot find out the reason.I have tried to edit the CMakeLists.txt file ,but the file is read only.Can anyone help me
<a href="https://i.stack.imgur.com/50H0Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/50H0Z.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/VBcon.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VBcon.png" alt="enter image description here" /></a></p>
| Couldn't find executable named teleop_twist_keyboard.py |
<p>In Gazebo Ignition, they have moved from <code>gazebo_ros</code> to <code>ros_gz</code>. Inside this <code>ros_gz</code> metapackage, you'd find the <code>ros_gz_sim</code> package, which provides the functionality that you want.</p>
<p>I'll point you to the source of the <a href="https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_sim" rel="nofollow noreferrer">package</a>, you can use this to check what types of inputs the launch file expects, and also to read more about the package. In case you are looking to use it in the ROS 2 CLI, it's</p>
<pre><code>ros2 launch ros_gz_sim gz_sim.launch.py gz_args:="shapes.sdf"
</code></pre>
<p>I'd also point you to <a href="https://gazebosim.org/docs/harmonic/migrating_gazebo_classic_ros2_packages" rel="nofollow noreferrer">this</a> Migration Guide, where you have a a very nicely written document on how to migrate your project from Gazebo Classic to Gazebo Ignition. The section of interest for you would be the <a href="https://gazebosim.org/docs/harmonic/migrating_gazebo_classic_ros2_packages#spawn-model" rel="nofollow noreferrer">spawn model</a> section.</p>
| 109541 | 2024-02-25T21:30:14.640 | |gazebo|ros2|gazebo-ignition|spawn-model|ros2-launch| | <p>When designing simulations in Gazebo Classic it was possible to spawn robots in the simulation with the launch file spawn_entity from the gazebo_ros pkg. Is there any equivalent in to that in Gazebo Ignition?</p>
| Gazebo ignition spawn_entity equivalent |
<p>So I did some further investigation.</p>
<ol>
<li><p>The marginalization arguments hinge on linearizing the control and and observation functions, once linearized you can factor the joint PDF into a joint gaussian. Once in gaussian form you can do marginalization as you would any distribution.</p>
</li>
<li><p>I believe basically doing a ridge maximum likelihood by optimizing the "nuisance variables" in terms of the variables of interest as I talked about in the OP will produce the same result.</p>
</li>
</ol>
<p>Anyway the key point behind any discussion of marginalization comes down to linearization and converting to joint gaussian. If you can't do that you won't be marginalizing anything, not in closed form at least.</p>
| 109544 | 2024-02-25T22:51:09.150 | |slam|robot-localization|vio| | <p>I was re-reading a prior answer about marginalization along with some documents,</p>
<p><a href="https://robotics.stackexchange.com/questions/24681/marginalization-vs-dropping-states-for-sliding-window-vo">Marginalization vs Dropping states for sliding window VO</a></p>
<p>My understanding is as follows:</p>
<ol>
<li><p>After convergence of the objective function(say which includes marginalization prior), you do a first order expansion of the objective function.</p>
</li>
<li><p>You select the nodes you want to remove from the factor graph.</p>
</li>
<li><p>You can write the optimal value of those nodes you want to remove parameterized by the remaining nodes you keep in the expansion.</p>
</li>
</ol>
<p>The confusion I have is that the schur-complement examples I have seen only shows the dependency when solving for the normal equations for all nodes currently in the factor graph. When writing the dependencies don't you want to show the optimal values for the removed nodes depending upon the remaining nodes which are the ones to be optimized again in the future?</p>
| Further clarification on marginalization |
<p>This is documented very well at robot_localiztion <a href="https://docs.ros.org/en/melodic/api/robot_localization/html/configuring_robot_localization.html" rel="nofollow noreferrer">documentation page</a></p>
| 109551 | 2024-02-26T08:18:57.357 | |ros2|odometry|imu|robot-localization|ekf-localization| | <p>I have a differential drive robot, it is a 4wd robot, 2 motors, 2 encoders,s it behaves like a differential robot actually. Odometry from encoders is working well. I'm using ROS2 Humble on ubuntu 22.04.</p>
<p>I want to fuse odom, with an IMU to get a nice 2d pose (lokalisation)</p>
<p>So, I have done all the transform and got the odom and IMU topics. Which are the followings ODOM topic:</p>
<blockquote>
<p>header: stamp: sec: 1708934625 nanosec: 68893329 frame_id: odom
child_frame_id: laser_link pose: pose: position: x: 0.9908038973808289
y: -3.18342661857605 z: 0.0 orientation: x: 0.0 y: 0.0 z:
0.808424464005272 w: 0.5885999371370919 covariance:</p>
<p>8.632683822477702e-05
0.0
0.0
0.0
0.0
0.0
0.0
8.632683822477702e-05
0.0
0.0
0.0
0.0
0.0
0.0
8.632683822477702e-05
0.0
0.0
0.0
0.0
0.0
0.0
8.632683822477702e-06
0.0
0.0
0.0
0.0
0.0
0.0
8.632683822477702e-06
0.0
0.0
0.0
0.0
0.0
0.0
8.632683822477702e-06 twist: twist: linear: x: 0.05744318664073944 y: -0.010725230909883976 z: 0.0 angular: x: 0.0 y: -0.0 z:
0.046282440423965454 covariance:
4.316341911238851e-05
0.0
0.0
0.0
0.0
0.0
0.0
4.316341911238851e-05
0.0
0.0
0.0
0.0
0.0
0.0
4.316341911238851e-05
0.0
0.0
0.0
0.0
0.0
0.0
4.316341911238851e-06
0.0
0.0
0.0
0.0
0.0
0.0
4.316341911238851e-06
0.0
0.0
0.0
0.0
0.0
0.0
4.316341911238851e-06</p>
</blockquote>
<p>AND IMU topic</p>
<blockquote>
<p>header: stamp: sec: 1708934700 nanosec: 58079488 frame_id:
camera_imu_optical_frame orientation: x: -0.564959732796857 y:
-0.32758730601200314 z: 0.3634408670297931 w: 0.664392800555917 orientation_covariance:</p>
<p>0.0004
0.0
0.0
0.0
0.0004
0.0
0.0
0.0
0.0004</p>
<p>angular_velocity: x: 0.0 y: -0.006981316953897476 z: 0.0
angular_velocity_covariance:
0.01
0.0
0.0
0.0
0.01
0.0
0.0
0.0
0.01 linear_acceleration: x: 0.22555294632911682 y: -9.728196144104004 z: 1.4808040857315063 linear_acceleration_covariance:
1.0
0.0
0.0
0.0
1.0
0.0
0.0
0.0
1.0</p>
</blockquote>
<p>So Im not sure about the correct EKF yamil config file.</p>
<p>My suggestion was this config</p>
<blockquote>
<p>odom0: /odom/icp
odom0_config: [true, true, true, # pose position (x, y, z)
true, true, true, true, # pose orientation (quaternion x, y, z, w)
false, false, false, false, false, false, # pose covariance
true, true, false]</p>
<pre><code>imu0: /imu/data
imu0_config: [false, false, false,
true, true, false,
false, false, false,
false, true, false,
true, true, false]
</code></pre>
</blockquote>
<p>But not sure if the correct one. Any help?</p>
| How to set up 2D pose with IMU and odometry using robot localization ekf? |
<p>Apparantly this had something to do with the topic QoS. When I specified the QoS for all topics with the <code>qos</code> argument, it worked:</p>
<pre><code>ros2 launch rtabmap_launch rtabmap.launch.py \
frame_id:=base_link \
rgb_topic:=/camera/color/image_raw \
depth_topic:=/camera/depth/image_rect_raw \
camera_info_topic:=/camera/color/camera_info \
approx_sync:=true \
subscribe_rgb:=true \
subscribe_depth:=true \
rtabmap_viz:=false \
rtabmap_args:="-d" \
qos:=2
</code></pre>
| 109558 | 2024-02-26T12:18:27.107 | |rtabmap|ros-foxy| | <p>I am trying to run this rtabmap config on my Jetson Orin:</p>
<pre><code>ros2 launch rtabmap_launch rtabmap.launch.py \
frame_id:=base_link \
rgb_topic:=/camera/color/image_raw \
depth_topic:=/camera/depth/image_rect_raw \
camera_info_topic:=/camera/color/camera_info \
approx_sync:=true \
subscribe_rgb:=true \
subscribe_depth:=true \
rtabmap_viz:=false \
rtabmap_args:="-d" \
qos_image:=2 \
qos_imu:=2 \
qos_camera_info:=2
</code></pre>
<p>The odometry seems good (visualizations seems stable and updated promptly), but the mapper doesn't do anything but report it doesn't receive data:</p>
<pre><code>[rtabmap-2] [WARN] [1708949110.123611636] [rtabmap.rtabmap]: rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=10).
[rtabmap-2] rtabmap subscribed to (approx sync):
[rtabmap-2] /rtabmap/odom \
[rtabmap-2] /camera/color/image_raw \
[rtabmap-2] /camera/depth/image_rect_raw \
[rtabmap-2] /camera/color/camera_info \
[rtabmap-2] /rtabmap/odom_info
</code></pre>
<p>I run this here with the apt-installed version, but I get the same error on another computer with the source-install.</p>
<p>Is anything wrong with the data?</p>
<pre><code>$ ros2 topic hz /rtabmap/odom
average rate: 19.134
min: 0.051s max: 0.055s std dev: 0.00104s window: 21
average rate: 19.097
min: 0.051s max: 0.055s std dev: 0.00094s window: 41
$ ros2 topic delay /rtabmap/odom
average delay: 0.107
min: 0.093s max: 0.122s std dev: 0.00964s window: 18
average delay: 0.106
min: 0.089s max: 0.123s std dev: 0.00966s window: 37
$ ros2 topic hz /camera/color/image_raw
average rate: 30.010
min: 0.032s max: 0.039s std dev: 0.00148s window: 31
average rate: 29.480
min: 0.032s max: 0.072s std dev: 0.00508s window: 60
$ ros2 topic delay /camera/color/image_raw
average delay: 0.037
min: 0.034s max: 0.039s std dev: 0.00137s window: 29
average delay: 0.037
min: 0.034s max: 0.040s std dev: 0.00138s window: 57
$ ros2 topic hz /camera/depth/image_rect_raw
average rate: 28.994
min: 0.024s max: 0.065s std dev: 0.00627s window: 31
average rate: 29.545
min: 0.024s max: 0.065s std dev: 0.00467s window: 62
$ ros2 topic delay /camera/depth/image_rect_raw
average delay: 0.040
min: 0.035s max: 0.045s std dev: 0.00207s window: 29
average delay: 0.040
min: 0.035s max: 0.045s std dev: 0.00204s window: 59
$ ros2 topic hz /rtabmap/odom_info
average rate: 17.805
min: 0.048s max: 0.078s std dev: 0.00835s window: 19
average rate: 18.363
min: 0.019s max: 0.084s std dev: 0.00965s window: 38
$ ros2 topic delay /rtabmap/odom_info
average delay: 0.122
min: 0.107s max: 0.136s std dev: 0.00913s window: 18
</code></pre>
<p>The delays look high, but is it too bad?</p>
<p>Is there a parameter that I can adjust to make the mapper still try to work with the data it gets?</p>
<p>How can I fix this?</p>
| Why does my rtabmap mapper not receive data? |
<p>I do not see anything wrong in your approach.</p>
<p>I'd probably suggest you to write a dedicated node which subscribes to the trajectory as well as the TF tree, then you can use this information to perform the same computation you have done above, and maybe get a pointwise deviation metric in case you want to find out to what level the robot smooths out the provided trajectory. This saves you from having to <code>ros2 run . .</code> it every time.</p>
| 109562 | 2024-02-26T20:05:26.940 | |ros2|moveit|path|trajectory| | <p>I would like to compare/visualize the planned path and actual path of an industrial robot. I am using Moveit2 and I can access planned trajectory via <strong><strong>/display_planned_path</strong></strong> topic which is <a href="https://docs.ros.org/en/noetic/api/moveit_msgs/html/msg/DisplayTrajectory.html" rel="nofollow noreferrer">moveit_msgs/DisplayTrajectory</a>. I can also read the joint position of the robot via <strong>/joint_states</strong> topic which is <a href="https://docs.ros.org/en/melodic/api/sensor_msgs/html/msg/JointState.html" rel="nofollow noreferrer">sensor_msgs/JointState</a>.</p>
<p>I found a manual way of visualizing actual path by writing the transformation between base_frame and gripper_frame to a file with <code>ros2 run tf2_ros tf2_echo base_frame gripper_frame > tf2.txt</code>. Then extracting the Translation [X, Y, Z] data and plot by using Matplotlib. However, I don't think that it is the proper way of doing it.</p>
<p><strong>Output</strong>:<a href="https://i.stack.imgur.com/tmApN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tmApN.png" alt="Output" /></a></p>
<p>I am open to your suggestions.</p>
<p>Thank you for your time.</p>
<p><strong>UPDATE</strong>:
I used the code from <a href="https://i.stack.imgur.com/tmApN.png" rel="nofollow noreferrer">robotics-toolbox</a> to import <em>URDF</em> and their <em>Kinematic</em> function to calculate the planned path from joint positions inside trajectory(available in .yaml file). Matplotlib is used for 3D data visualization.</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
"""
@author: Jesse Haviland
"""
import re
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy.testing as nt
import numpy as np
import unittest
from roboticstoolbox import Robot
from spatialmath import SE3
from roboticstoolbox.tools.data import rtb_path_to_datafile
from distutils.dir_util import copy_tree
from os import mkdir, path
import tempfile as tf
import yaml
def fetch_positions(data):
positions_list = []
for trajectory in data['trajectory']:
for point in trajectory['joint_trajectory']['points']:
positions_list.append(point['positions'][:6])
return positions_list
class TestCustomXacro(unittest.TestCase):
def test_custom(self):
class CustomPanda(Robot):
def __init__(self, xacro_path):
links, name, urdf_string, urdf_filepath = self.URDF_read(
"<urdf_path>",
tld=xacro_path,
)
super().__init__(
links,
name="Super Robot",
manufacturer="Super Manufacturer",
urdf_string=urdf_string,
urdf_filepath=urdf_filepath,
)
temp_dir = tf.mkdtemp()
xacro_dir = path.join(temp_dir, "custom_xacro_folder")
robot = CustomPanda(xacro_dir)
print(robot)
for link in robot.links:
print(link.name)
with open('<trajectory_yaml_file>', 'r') as file:
yaml_data = list(yaml.safe_load_all(file))
positions = fetch_positions(yaml_data[0]) # Assuming the data is in the first document
# Convert positions_list to NumPy array
positions_array = np.array(positions)
translationList = []
print("Joint Positions for all trajectory points:")
for i, pos in enumerate(positions_array, start=1):
print(f"Trajectory Point {i}: {pos}")
T = robot.fkine(pos, end='end_point_link')
translationList.append(T.t)
x = [translation[0] for translation in translationList]
y = [translation[1] for translation in translationList]
z = [translation[2] for translation in translationList]
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x, y, z, label='Translation Points')
#ax.plot(x, y, z, label='Connected Trajectory', color='red')
# Add start and end labels
ax.text(x[0], y[0], z[0], 'Start', fontsize=12, color='green')
ax.text(x[-1], y[-1], z[-1], 'End', fontsize=12, color='red')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Planned Path Visualization')
ax.legend()
plt.show()
if __name__ == "__main__":
unittest.main()
</code></pre>
<p><a href="https://i.stack.imgur.com/Vjwja.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vjwja.png" alt="Planned Path" /></a></p>
| Planned Path vs Actual Path for Real Robot |
<p>In most applications the length of the tf2 Buffer cache timeout will not effect the lookup speed. From testing the best performance was shown to come from searching a vector starting at the latest data and iterating backwards in time. So in general the length of the list doesn't effect lookup times because you never iterate there. What does is how frequent the data arrives and how far back into the history you want to look.</p>
<p>If you were to shorten the cache timeout, you would reduce the length of the lookup at the cost of incurring LookupExceptions. The one case that would be slower would be failed lookups that have to iterate the whole cache. A shortcut could be added to check if the end of the cache is beyond the query window and skip the iteration through every element.</p>
<p>The main result of increasing the cache timeout is increasing the memory usage. The memory usage will be proportional to the frequency with which data is being published times the length of the cache timeout.</p>
<p>For long term queries far into the past the storage format is sub optimal, I would recommend using an alternative storage mechanism built for that case. The buffer lookup is optimized for dealing with the inherent latencies in distributed system. It generally doesn't need much adjustment. Performance would decrease with much higher transformation publish frequency and that is somewhat naturally limited by available network bandwidth for the publishing too.</p>
| 109566 | 2024-02-26T20:38:54.417 | |tf2| | <p>I'm curious if/how much a shorter tf2 buffer length improves performance. Does it increase the tf lookup speed? How much does it decrease the memory footprint of the program?</p>
<p>This is an optional constructor argument of tf2_ros::Buffer.</p>
<p><code>Buffer (ros::Duration cache_time=ros::Duration(BufferCore::DEFAULT_CACHE_TIME), bool debug=false)</code></p>
| Does a shorter tf2 buffer lead to faster lookup times? |
<p>As you mentioned, most people typically use Pixhawk or ArduPilot when using drones with ROS. While I'm not sure exactly why you want to use SpeedyBee, such flight controllers usually do not officially support ROS.
However, if you still wish to use them, you might be able to gain limited control by intercepting and mocking serial signals on their internal buses. This approach requires a deep understanding of the field, extensive experience, and a highly controlled environment for safety, making it not recommended for drone beginners like yourself.</p>
<p>If gaining control over a flight controller that doesn't officially support ROS isn't the primary goal of your project, it's highly recommended to avoid it.</p>
<p>Although Pixhawk or ArduPilot controllers may seem expensive compared to controllers like SpeedyBee, the cost is unlikely to outweigh the trials, errors, time wastage, and risks associated with not using them.</p>
<p>Below are the official ROS integration links for both controllers for your reference.</p>
<p><a href="https://docs.px4.io/main/en/ros/ros2_comm.html" rel="nofollow noreferrer">https://docs.px4.io/main/en/ros/ros2_comm.html</a></p>
<p><a href="https://ardupilot.org/dev/docs/ros.html" rel="nofollow noreferrer">https://ardupilot.org/dev/docs/ros.html</a></p>
| 109574 | 2024-02-27T10:31:16.557 | |ros|ros2|drone|ardupilot|pixhawk| | <p>I am a newbie to Drones, I looked into many articles over the internet to find out which flight controller should I use, but not fully able to understand as the cheap flight controllers like speedybee's one does not have any hint that I can use ROS with that and some people are suggesting they have seen people using ROS with only ardupiolot and pixhawk. Any suggestion or link will be much appreciated for clarification.</p>
<p>Thank You</p>
| Drone Flight Controller and Firmware that supports ROS2 |
<p>The torus doesn't represent the actual motion of joints in space it is used to represent the C-space only.</p>
<p>You need a C-space that can represent all the combinations of two different angles i.e., all pairs (<span class="math-container">$\theta_1, \theta_2$</span>) so that by picking a point on the C-space you can uniquely determine the location of both the joints.</p>
<p>If you use the annular ring and you pick any point on the annular ring so you can find out the angle of the first joint but how do you represent the angle of second joint.</p>
<p>But if you take a torus the point from the centre will represent the angle of the first joint and the angle around the peripheral ring of the torus will represent angle of the second joint as i tried to show in the image.</p>
<p><a href="https://i.stack.imgur.com/E5CYD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E5CYD.png" alt="enter image description here" /></a></p>
<p>I tried to draw so that it is easier to visualise(pretty bad actually but hope it helps)</p>
<p>So if you take a disc it wouldn't be possible to uniquely describe the location of <span class="math-container">$\theta_2$</span> and if you try you will get overlapping circles.</p>
<p>Again, don't confuse C-space with the actual motion of the joints. it is a space which is used to map each possible position of the 2 joints to a unique point on some region(here the torus).</p>
| 109598 | 2024-02-28T12:20:29.857 | |motion-planning|path-planning| | <p>Currently doing a course on robotics - skip to 1:12 in the video below where Kevin Lynch describes the C-Space topology of a 2R robot to be a torus. Why did he rotate the circle for joint 1 to be perpendicular to that of joint 2?</p>
<p><a href="https://youtu.be/z29hYlagOYM?list=PLggLP4f-rq01z8VLqhDC94W2nWpWpZoMj&t=72" rel="nofollow noreferrer">https://youtu.be/z29hYlagOYM?list=PLggLP4f-rq01z8VLqhDC94W2nWpWpZoMj&t=72</a></p>
<p>Also shouldn't the C-Space for such a contraption be a annular disc? notice the difference between the fig1 and fig2 in the illustration I drew.
<a href="https://i.stack.imgur.com/U5H4k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U5H4k.png" alt="joints on the xy plane vs yz plane" /></a></p>
<p>I get that the range being [0,2Ο] wrap around to form a torus, but I am confused about how Kevin Lynch approached this problem, aren't both joints operating on the xy plane?</p>
| Why is the C- Space topology for a 2R robot a torus? |
<p>Since I have 18.04 machine with Melodic I thought I'd help you (got greedy for bounty )</p>
<p>Seems main problem is that they removed the <a href="https://github.com/pal-robotics/realsense_simulation" rel="nofollow noreferrer">this package</a> from melodic rosinstall:</p>
<pre><code>- git: {local-name: realsense_simulation, uri: 'https://github.com/pal-robotics/realsense_simulation.git', version: 'noetic-devel'}
</code></pre>
<p>the rosdep also didn't install multiple packages:</p>
<pre><code>
rosdep install --from-paths src --ignore-src --rosdistro melodic --skip-keys="opencv2 opencv2-nonfree pal_laser_filters speed_limit_node sensor_to_cloud hokuyo_node libdw-dev python-graphitesend-pip python-statsd pal_filters pal_vo_server pal_usb_utils pal_pcl pal_pcl_points_throttle_and_filter pal_karto pal_local_joint_control camera_calibration_files pal_startup_msgs pal-orbbec-openni2 dummy_actuators_manager pal_local_planner gravity_compensation_controller current_limit_controller dynamic_footprint dynamixel_cpp tf_lookup opencv3 librealsense2-dev librealsense2-dkms hey5_transmissions ydlidar_ros_driver" -y
Error:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
ari_bringup: Cannot locate rosdep definition for [twist_mux]
pal_navigation_cfg_pmb2: Cannot locate rosdep definition for [range_sensor_layer]
pal_navigation_cfg_pmb3: Cannot locate rosdep definition for [teb_local_planner]
pal_navigation_cfg_ari: Cannot locate rosdep definition for [teb_local_planner]
pal_gripper_description: Cannot locate rosdep definition for [urdf_test]
ari_moveit_tutorial: Cannot locate rosdep definition for [moveit_ros_planning_interface]
pal_navigation_cfg_tiago: Cannot locate rosdep definition for [range_sensor_layer]
ari_description: Cannot locate rosdep definition for [urdf_test]
realsense2_camera: Cannot locate rosdep definition for [librealsense2]
play_motion: Cannot locate rosdep definition for [moveit_ros_planning_interface]
ari_moveit_config: Cannot locate rosdep definition for [moveit_setup_assistant]
pal_navigation_cfg_omni_base: Cannot locate rosdep definition for [teb_local_planner]
realsense2_description: Cannot locate rosdep definition for [realsense_simulation]
pal_navigation_cfg_tiago_dual: Cannot locate rosdep definition for [range_sensor_layer]
four_wheel_steering_controller: Cannot locate rosdep definition for [urdf_geometry_parser]
</code></pre>
<p>So I installed them by hand:</p>
<pre><code>sudo apt install ros-melodic-twist-mux
sudo apt install ros-melodic-range-sensor-layer
sudo apt install ros-melodic-teb-local-planner
sudo apt install ros-melodic-urdf-test
sudo apt install ros-melodic-moveit-ros-planning-interface
sudo apt install ros-melodic-moveit-setup-assistant
sudo apt install ros-melodic-urdf-geometry-parser
sudo apt install ros-melodic-aruco-ros
sudo apt install ros-melodic-zbar-ros
sudo apt install ros-melodic-four-wheel-steering-msgs
</code></pre>
<p>Proof that I got it working:</p>
<p><a href="https://i.stack.imgur.com/NUXTU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NUXTU.png" alt="enter image description here" /></a></p>
<p>I spent more time on this that I care to admit, but it was fun to play with old pakcages, maybe I would try to put this into Docker if I could, I doubt there are many people willing to tinker with EOL'ed sources/packages.
(Give me the bounty now! )</p>
| 109608 | 2024-02-28T17:52:18.573 | |gazebo|ros-melodic|ros-noetic|realsense| | <p>I am going through the installation steps for using the ARI simulation as seen <a href="http://wiki.ros.org/Robots/ARI/Tutorials/Installation/ARISimulation" rel="nofollow noreferrer">here</a>, and have successfully done so in the past without any issues. However, now I am experiencing the following errors after inserting the final <code>roslaunch ari_gazebo ari_gazebo.launch public_sim:=true</code> command for running the simulation:</p>
<pre><code>xacro: in-order processing became default in ROS Melodic. You can drop the option.
resource not found: realsense_simulation
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/cs/ari_public_ws/src/ari_navigation/ari_2dnav
ROS path [2]=/home/cs/ari_public_ws/src/ari_simulation/ari_2dnav_gazebo
ROS path [3]=/home/cs/ari_public_ws/src/ari_robot/ari_bringup
ROS path [4]=/home/cs/ari_public_ws/src/ari_robot/ari_controller_configuration
ROS path [5]=/home/cs/ari_public_ws/src/ari_simulation/ari_controller_configuration_gazebo
ROS path [6]=/home/cs/ari_public_ws/src/ari_simulation/ari_gazebo
ROS path [7]=/home/cs/ari_public_ws/src/ari_navigation/ari_laser_sensors
ROS path [8]=/home/cs/ari_public_ws/src/ari_tutorials/ari_look_to_point
ROS path [9]=/home/cs/ari_public_ws/src/ari_navigation/ari_maps
ROS path [10]=/home/cs/ari_public_ws/src/ari_moveit_config
ROS path [11]=/home/cs/ari_public_ws/src/ari_tutorials/ari_moveit_tutorial
ROS path [12]=/home/cs/ari_public_ws/src/ari_navigation/ari_navigation
ROS path [13]=/home/cs/ari_public_ws/src/ari_navigation/ari_rgbd_sensors
ROS path [14]=/home/cs/ari_public_ws/src/ari_robot/ari_robot
ROS path [15]=/home/cs/ari_public_ws/src/ari_simulation/ari_simulation
ROS path [16]=/home/cs/ari_public_ws/src/ari_tutorials/ari_trajectory_controller
ROS path [17]=/home/cs/ari_public_ws/src/aruco_ros/aruco
ROS path [18]=/home/cs/ari_public_ws/src/aruco_ros/aruco_msgs
ROS path [19]=/home/cs/ari_public_ws/src/aruco_ros/aruco_ros
ROS path [20]=/home/cs/ari_public_ws/src/ari_tutorials/ari_aruco_demo
ROS path [21]=/home/cs/ari_public_ws/src/backward_ros
ROS path [22]=/home/cs/ari_public_ws/src/ros_control/controller_manager_msgs
ROS path [23]=/home/cs/ari_public_ws/src/ddynamic_reconfigure_python
ROS path [24]=/home/cs/ari_public_ws/src/eband_local_planner
ROS path [25]=/home/cs/ari_public_ws/src/gazebo_ros_pkgs/gazebo_dev
ROS path [26]=/home/cs/ari_public_ws/src/gazebo_ros_pkgs/gazebo_msgs
ROS path [27]=/home/cs/ari_public_ws/src/gazebo_ros_pkgs/gazebo_plugins
ROS path [28]=/home/cs/ari_public_ws/src/gazebo_ros_pkgs/gazebo_ros
ROS path [29]=/home/cs/ari_public_ws/src/gazebo_ros_pkgs/gazebo_ros_pkgs
ROS path [30]=/home/cs/ari_public_ws/src/ros_control/hardware_interface
ROS path [31]=/home/cs/ari_public_ws/src/ros_control/combined_robot_hw
ROS path [32]=/home/cs/ari_public_ws/src/ros_control/controller_interface
ROS path [33]=/home/cs/ari_public_ws/src/ros_controllers/actuator_state_controller
ROS path [34]=/home/cs/ari_public_ws/src/ros_control/controller_manager
ROS path [35]=/home/cs/ari_public_ws/src/ros_control/controller_manager_tests
ROS path [36]=/home/cs/ari_public_ws/src/ros_control/combined_robot_hw_tests
ROS path [37]=/home/cs/ari_public_ws/src/ros_controllers/diff_drive_controller
ROS path [38]=/home/cs/ari_public_ws/src/ros_controllers/force_torque_sensor_controller
ROS path [39]=/home/cs/ari_public_ws/src/ros_controllers/forward_command_controller
ROS path [40]=/home/cs/ari_public_ws/src/ros_controllers/effort_controllers
ROS path [41]=/home/cs/ari_public_ws/src/ros_controllers/four_wheel_steering_controller
ROS path [42]=/home/cs/ari_public_ws/src/ros_controllers/gripper_action_controller
ROS path [43]=/home/cs/ari_public_ws/src/head_action
ROS path [44]=/home/cs/ari_public_ws/src/hey5_description
ROS path [45]=/home/cs/ari_public_ws/src/humanoid_msgs/humanoid_msgs
ROS path [46]=/home/cs/ari_public_ws/src/humanoid_msgs/humanoid_nav_msgs
ROS path [47]=/home/cs/ari_public_ws/src/ros_controllers/imu_sensor_controller
ROS path [48]=/home/cs/ari_public_ws/src/ros_control/joint_limits_interface
ROS path [49]=/home/cs/ari_public_ws/src/ros_controllers/joint_state_controller
ROS path [50]=/home/cs/ari_public_ws/src/ros_controllers/joint_torque_sensor_state_controller
ROS path [51]=/home/cs/ari_public_ws/src/ros_controllers/joint_trajectory_controller
ROS path [52]=/home/cs/ari_public_ws/src/teleop_tools/joy_teleop
ROS path [53]=/home/cs/ari_public_ws/src/teleop_tools/key_teleop
ROS path [54]=/home/cs/ari_public_ws/src/teleop_tools/mouse_teleop
ROS path [55]=/home/cs/ari_public_ws/src/range_sensor_layer/navigation_layers
ROS path [56]=/home/cs/ari_public_ws/src/openslam_gmapping
ROS path [57]=/home/cs/ari_public_ws/src/slam_gmapping/gmapping
ROS path [58]=/home/cs/ari_public_ws/src/pal_msgs/pal_behaviour_msgs
ROS path [59]=/home/cs/ari_public_ws/src/pal_statistics/pal_carbon_collector
ROS path [60]=/home/cs/ari_public_ws/src/pal_msgs/pal_common_msgs
ROS path [61]=/home/cs/ari_public_ws/src/pal_msgs/pal_control_msgs
ROS path [62]=/home/cs/ari_public_ws/src/pal_msgs/pal_detection_msgs
ROS path [63]=/home/cs/ari_public_ws/src/ari_tutorials/ari_opencv_tutorial
ROS path [64]=/home/cs/ari_public_ws/src/pal_msgs/pal_device_msgs
ROS path [65]=/home/cs/ari_public_ws/src/pal_gazebo_worlds
ROS path [66]=/home/cs/ari_public_ws/src/pal_gripper/pal_gripper
ROS path [67]=/home/cs/ari_public_ws/src/pal_gripper/pal_gripper_controller_configuration
ROS path [68]=/home/cs/ari_public_ws/src/pal_gripper/pal_gripper_controller_configuration_gazebo
ROS path [69]=/home/cs/ari_public_ws/src/pal_gripper/pal_gripper_gazebo
ROS path [70]=/home/cs/ari_public_ws/src/pal_hardware_interfaces
ROS path [71]=/home/cs/ari_public_ws/src/ros_controllers/mode_state_controller
ROS path [72]=/home/cs/ari_public_ws/src/pal_msgs/pal_interaction_msgs
ROS path [73]=/home/cs/ari_public_ws/src/ari_tutorials/ari_say_something
ROS path [74]=/home/cs/ari_public_ws/src/pal_msgs/pal_motion_model_msgs
ROS path [75]=/home/cs/ari_public_ws/src/pal_msgs/pal_msgs
ROS path [76]=/home/cs/ari_public_ws/src/pal_msgs/pal_multirobot_msgs
ROS path [77]=/home/cs/ari_public_ws/src/pal_gazebo_plugins
ROS path [78]=/home/cs/ari_public_ws/src/pal_navigation_cfg_public/pal_navigation_cfg_ari
ROS path [79]=/home/cs/ari_public_ws/src/pal_navigation_cfg_public/pal_navigation_cfg_omni_base
ROS path [80]=/home/cs/ari_public_ws/src/pal_navigation_cfg_public/pal_navigation_cfg_pmb2
ROS path [81]=/home/cs/ari_public_ws/src/pal_navigation_cfg_public/pal_navigation_cfg_pmb3
ROS path [82]=/home/cs/ari_public_ws/src/pal_navigation_cfg_public/pal_navigation_cfg_tiago
ROS path [83]=/home/cs/ari_public_ws/src/pal_navigation_cfg_public/pal_navigation_cfg_tiago_dual
ROS path [84]=/home/cs/ari_public_ws/src/pal_msgs/pal_navigation_msgs
ROS path [85]=/home/cs/ari_public_ws/src/pal_navigation_sm
ROS path [86]=/home/cs/ari_public_ws/src/pal_gripper/pal_parallel_gripper_wrapper
ROS path [87]=/home/cs/ari_public_ws/src/pal_python
ROS path [88]=/home/cs/ari_public_ws/src/pal_msgs/pal_simulation_msgs
ROS path [89]=/home/cs/ari_public_ws/src/pal_statistics/pal_statistics_msgs
ROS path [90]=/home/cs/ari_public_ws/src/pal_statistics/pal_statistics
ROS path [91]=/home/cs/ari_public_ws/src/dynamic_introspection
ROS path [92]=/home/cs/ari_public_ws/src/pal_msgs/pal_tablet_msgs
ROS path [93]=/home/cs/ari_public_ws/src/pal_msgs/pal_video_recording_msgs
ROS path [94]=/home/cs/ari_public_ws/src/pal_msgs/pal_vision_msgs
ROS path [95]=/home/cs/ari_public_ws/src/pal_msgs/pal_visual_localization_msgs
ROS path [96]=/home/cs/ari_public_ws/src/pal_msgs/pal_walking_msgs
ROS path [97]=/home/cs/ari_public_ws/src/pal_msgs/pal_web_msgs
ROS path [98]=/home/cs/ari_public_ws/src/pal_msgs/pal_wifi_localization_msgs
ROS path [99]=/home/cs/ari_public_ws/src/pal_wsg_gripper/pal_wsg_gripper
ROS path [100]=/home/cs/ari_public_ws/src/pal_wsg_gripper/pal_wsg_gripper_controller_configuration
ROS path [101]=/home/cs/ari_public_ws/src/pal_wsg_gripper/pal_wsg_gripper_controller_configuration_gazebo
ROS path [102]=/home/cs/ari_public_ws/src/pal_wsg_gripper/pal_wsg_gripper_description
ROS path [103]=/home/cs/ari_public_ws/src/pal_wsg_gripper/pal_wsg_gripper_gazebo
ROS path [104]=/home/cs/ari_public_ws/src/play_motion/play_motion_msgs
ROS path [105]=/home/cs/ari_public_ws/src/ros_controllers/position_controllers
ROS path [106]=/home/cs/ari_public_ws/src/play_motion/play_motion
ROS path [107]=/home/cs/ari_public_ws/src/range_sensor_layer/range_sensor_layer
ROS path [108]=/home/cs/ari_public_ws/src/realsense/realsense2_camera
ROS path [109]=/home/cs/ari_public_ws/src/realsense/realsense2_description
ROS path [110]=/home/cs/ari_public_ws/src/realsense_gazebo_plugin
ROS path [111]=/home/cs/ari_public_ws/src/robot_pose
ROS path [112]=/home/cs/ari_public_ws/src/roboticsgroup_gazebo_plugins
ROS path [113]=/home/cs/ari_public_ws/src/ros_control/ros_control
ROS path [114]=/home/cs/ari_public_ws/src/ros_controllers/ros_controllers
ROS path [115]=/home/cs/ari_public_ws/src/ros_control/rqt_controller_manager
ROS path [116]=/home/cs/ari_public_ws/src/ros_controllers/rqt_joint_trajectory_controller
ROS path [117]=/home/cs/ari_public_ws/src/rviz_plugin_covariance
ROS path [118]=/home/cs/ari_public_ws/src/simple_grasping_action
ROS path [119]=/home/cs/ari_public_ws/src/slam_gmapping/slam_gmapping
ROS path [120]=/home/cs/ari_public_ws/src/range_sensor_layer/social_navigation_layers
ROS path [121]=/home/cs/ari_public_ws/src/teleop_tools/teleop_tools
ROS path [122]=/home/cs/ari_public_ws/src/teleop_tools/teleop_tools_msgs
ROS path [123]=/home/cs/ari_public_ws/src/ros_controllers/temperature_sensor_controller
ROS path [124]=/home/cs/ari_public_ws/src/tf_lookup
ROS path [125]=/home/cs/ari_public_ws/src/ros_control/transmission_interface
ROS path [126]=/home/cs/ari_public_ws/src/gazebo_ros_pkgs/gazebo_ros_control
ROS path [127]=/home/cs/ari_public_ws/src/pal_hardware_gazebo
ROS path [128]=/home/cs/ari_public_ws/src/urdf_test
ROS path [129]=/home/cs/ari_public_ws/src/ari_robot/ari_description
ROS path [130]=/home/cs/ari_public_ws/src/pal_gripper/pal_gripper_description
ROS path [131]=/home/cs/ari_public_ws/src/ros_controllers/velocity_controllers
ROS path [132]=/home/cs/ari_public_ws/src/zbar_ros
ROS path [133]=/opt/ros/noetic/share
when processing file: /home/cs/ari_public_ws/src/realsense/realsense2_description/urdf/_d435.urdf.xacro
included from: /home/cs/ari_public_ws/src/ari_robot/ari_description/urdf/head/head.urdf.xacro
included from: /home/cs/ari_public_ws/src/ari_robot/ari_description/robots/ari.urdf.xacro
RLException: while processing /home/cs/ari_public_ws/src/ari_simulation/ari_gazebo/launch/ari_gazebo.launch:
while processing /home/cs/ari_public_ws/src/ari_simulation/ari_gazebo/launch/ari_spawn.launch:
while processing /home/cs/ari_public_ws/src/ari_robot/ari_description/robots/upload.launch:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [['rosrun', 'xacro', 'xacro', '--inorder', '/home/cs/ari_public_ws/src/ari_robot/ari_description/robots/ari.urdf.xacro', 'robot_model:=v1', 'end_effector_right:=ari-hand', 'end_effector_left:=ari-hand', 'laser_model:=sick-571', 'camera_model_head:=raspi', 'front_fisheye_camera:=false', 'back_fisheye_camera:=false', 'has_thermal:=false', 'simulation:=true']] returned with code [2].
Param xml is <param name="robot_description" command="rosrun xacro xacro --inorder '<span class="math-container">$(find ari_description)/robots/ari.urdf.xacro' robot_model:=$</span>(arg robot_model) end_effector_right:=<span class="math-container">$(arg end_effector_right) end_effector_left:=$</span>(arg end_effector_left) laser_model:=<span class="math-container">$(arg laser_model) camera_model_head:=$</span>(arg camera_model_head) front_fisheye_camera:=<span class="math-container">$(arg front_fisheye_camera) back_fisheye_camera:=$</span>(arg back_fisheye_camera) has_thermal:=<span class="math-container">$(arg has_thermal) simulation:=$</span>(arg simulation) $(arg multi)"/>
The traceback for the exception was written to the log file
</code></pre>
<p>I have tried running the simulation in both combinations of <strong>Ubuntu 18 with melodic</strong> and <strong>Ubuntu 20 with noetic</strong> in two different computers and both replicate the same issue. I have also tried to obtain additional information by running individual commands such as:</p>
<p><code>rosrun xacro xacro /home/cs/ari_public_ws/src/ari_robot/ari_description/urdf/head/head.urdf.xacro</code></p>
<p>but they produce the same error messages. I also focused on the installation of the <code>realsense</code> package as I am assuming the error is related to that, but without any success.</p>
<p>Has anyone experienced something similar or can replicate the installation and run the simulation without any problems?</p>
| Help with installing and running ARI simulation |
<p>I have been working on a robot which is running fastrtps while all stuff on my side is running cyclonedds. From my experience I can say that with default configs on the cyclone (not certain if the fastrtps is running with defaults...) topics seem to work quite ok. Services were something I was not able to make work properly (cyclone -> fastrtps).</p>
<p>A while back I had problems (and again having some, not sure yet what it is this time...). Last time my problems were somehow related to a cyclonedds config that I was setting. As soon as I removed the config the connection began to work again. In the configs we were mainly setting the <a href="https://github.com/eclipse-cyclonedds/cyclonedds/blob/master/docs/manual/options.md#cycloneddsdomaingeneralallowmulticast" rel="nofollow noreferrer">multicast to spdp</a></p>
<p>So it can work but it can be quite finicky. As disclaimer I would say that I am not a dds wizard. Maybe there is some configs which can be tweaked to make those work better together. This has been my experience on the topic so far.</p>
| 109612 | 2024-02-28T19:40:26.130 | |ros2|dds| | <p>Looking to understand the limits of ROS2 right now so I can architect my system better. Is it possible to run different DDS implementations on different nodes (e.g. fast-dds and cyclone-dds) or will this cause issues with topics and services? My main reason for asking is the use-case where I am communicating with an existing system that is running a different DDS than the one I have configured.</p>
| ROS2 Mixing DDS / Middleware Between Nodes |
<p>The solution seems to have been to uninstall the humble version of moveit from <code>/opt</code>. I am then able to run MoveIt 2.9.0 or main (as of the time of writing this) and run it without major errors.</p>
<pre><code>sudo apt remove ros-humble-moveit-*
</code></pre>
| 109657 | 2024-03-01T16:30:23.490 | |ros-humble|moveit2| | <p>I'm trying to load my robot model with the moveit2 python API:</p>
<pre class="lang-py prettyprint-override"><code> moveit_package_name = f"{robot_name}_moveit_config"
moveit_config = (
MoveItConfigsBuilder(robot_name=robot_name, package_name=moveit_package_name)
# .robot_description(file_path=f"config/.urdf.xacro")
# .trajectory_execution(file_path="config/gripper_moveit_controllers.yaml")
.moveit_cpp(
file_path=os.path.join(
get_package_share_directory(moveit_package_name),
"config",
"moveit_cpp.yaml",
)
)
.to_moveit_configs()
).to_dict()
self.moveitpy_robot = MoveItPy(node_name=f"{robot_name}_moveitpy", config_dict=moveit_config)
</code></pre>
<p>This is the STDOUT:</p>
<pre class="lang-bash prettyprint-override"><code>warning: Using load_yaml() directly is deprecated. Use xacro.load_yaml() instead.
[INFO] [1709309724.830857728] [moveit_4259393191.moveit_cpp_initializer]: Initialize rclcpp
[INFO] [1709309724.830881584] [moveit_4259393191.moveit_cpp_initializer]: Initialize node parameters
[INFO] [1709309724.830890450] [moveit_4259393191.moveit_cpp_initializer]: Initialize node and executor
[INFO] [1709309724.854189675] [moveit_4259393191.moveit_cpp_initializer]: Spin separate thread
[INFO] [1709309724.860997104] [moveit_4259393191.RDFLoader]: Loaded robot model in 0.00669455 seconds
[INFO] [1709309724.861426677] [moveit_4259393191.robot_model]: Loading robot model 'victor'...
[INFO] [1709309724.861446216] [moveit_4259393191.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed joint
[INFO] [1709309725.202013665] [moveit_4259393191.kdl_kinematics_plugin]: Joint weights for group 'left_arm': 1 1 1 1 1 1 1
[INFO] [1709309725.202645616] [moveit_4259393191.dynamics_solver]: cache file /home/peter/ros2_ws/src/kuka_iiwa_interface/victor_hardware/scripts/victorleft_arm_victor_left_arm_link_0victor_left_tool0_5000_1.000000_1.000000.ikcache initialized!
malloc(): invalid size (unsorted)
</code></pre>
<p>I strongly suspect there is some issue with my build, because I'm building from source on Humble. I am currently on <code>5887eb0e2eb</code>. Even when I try with the <a href="https://github.com/peterdavidfagan/moveit2_tutorials/blob/moveit_py_notebook_tutorial/doc/examples/jupyter_notebook_prototyping/jupyter_notebook_prototyping_tutorial.rst" rel="nofollow noreferrer">example config</a> it crashes in the same way.</p>
<hr />
<p>Here's where it's crashing</p>
<pre><code>void PlanningScene::initialize()
{
name_ = DEFAULT_SCENE_NAME;
scene_transforms_ = std::make_shared<SceneTransforms>(this); // CRASHES HERE
robot_state_ = std::make_shared<moveit::core::RobotState>(robot_model_);
robot_state_->setToDefaultValues();
robot_state_->update();
</code></pre>
<p>And here's the stack track from GDB, with a little cleanup from me:</p>
<pre class="lang-bash prettyprint-override"><code>Thread 1 "python" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352398656) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
(gdb) where
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352398656) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=140737352398656) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=140737352398656, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff7c42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff7c287f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff7c89676 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7ddbb77 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#6 0x00007ffff7ca0cfc in malloc_printerr (str=str@entry=0x7ffff7ddebc0 "malloc(): invalid size (unsorted)") at ./malloc/malloc.c:5664
#7 0x00007ffff7ca40dc in _int_malloc (av=av@entry=0x7ffff7e1ac80 <main_arena>, bytes=bytes@entry=7424) at ./malloc/malloc.c:4002
#8 0x00007ffff7ca5139 in __GI___libc_malloc (bytes=7424) at ./malloc/malloc.c:3329
#9 0x00007fffd74ae98c in operator new(unsigned long) ()
from /lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00007fffd6baadf6 in std::vector<Eigen::Transform<double, 3, 1, 0>, std::allocator<Eigen::Transform<double, 3, 1, 0> > >::_M_fill_insert() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_robot_state.so.2.9.0
#11 0x00007fffd6b8e837 in moveit::core::RobotState::init() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_robot_state.so.2.9.0
#12 0x00007fffd6b8e9ef in moveit::core::RobotState::RobotState(std::shared_ptr<moveit::core::RobotModel const> const&) ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_robot_state.so.2.9.0
#13 0x00007fffd6cd54c1 in planning_scene::PlanningScene::initialize() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_planning_scene.so.2.9.0
#14 0x00007fffd6cd5f92 in planning_scene::PlanningScene::PlanningScene() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_planning_scene.so.2.9.0
#15 0x00007fffd457dd45 in planning_scene_monitor::PlanningSceneMonitor::initialize(std::shared_ptr<planning_scene::PlanningScene> const&) ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_planning_scene_monitor.so.2.9.0
#16 0x00007fffd457f035 in planning_scene_monitor::PlanningSceneMonitor::PlanningSceneMonitor() ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_planning_scene_monitor.so.2.9.0
#17 0x00007fffd457f467 in planning_scene_monitor::PlanningSceneMonitor::PlanningSceneMonitor() ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_planning_scene_monitor.so.2.9.0
#18 0x00007fffd457f4f2 in planning_scene_monitor::PlanningSceneMonitor::PlanningSceneMonitor() ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_planning_scene_monitor.so.2.9.0
#19 0x00007fffd487c70c in moveit_cpp::MoveItCpp::loadPlanningSceneMonitor(moveit_cpp::MoveItCpp::PlanningSceneMonitorOptions const&) ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_cpp.so.2.9.0
#20 0x00007fffd487cd18 in moveit_cpp::MoveItCpp::MoveItCpp(std::shared_ptr<rclcpp::Node> const&, moveit_cpp::MoveItCpp::Options const&) ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_cpp.so.2.9.0
#21 0x00007fffd487e91b in moveit_cpp::MoveItCpp::MoveItCpp(std::shared_ptr<rclcpp::Node> const&) ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_cpp.so.2.9.0
#22 0x00007fffd48e6bb7 in moveit_py::bind_moveit_cpp::initMoveitPy(pybind11::module_&)
from /home/peter/ros2_ws/install/moveit_py/local/lib/python3.10/dist-packages/moveit/planning.cpython-310-x86_64-linux-gnu.so
#23 0x00007fffd48ee347 in pybind11::detail::initimpl::factory<moveit_py::bind_moveit_cpp::initMoveitPy(pybind11::module_&)
</code></pre>
<p>Short of recompiling all of moveit in debug mode and slogging through this, I don't see what the problem is. Thanks!</p>
| MoveitPy segfaults loading robot model |
<p>You should try <a href="https://github.com/facontidavide/PlotJuggler" rel="nofollow noreferrer">Plotjuggler</a>. Its a nice tool for plotting and investigating data. You can directly import rosbags into it. Another good thing about plotjuggler is that you can plot X-Y plots which really helps in case of plotting odometry data. I have been using it for years now, It might take some time to setup and get started but it will be worth it.</p>
<p>Tip: you can plot goal (X-Y position) and over it your odometry(X-Y position) for each case and you'll see how deviated each one of them is from reference path (goal path).</p>
<p>Check out <a href="https://vimeo.com/351160225" rel="nofollow noreferrer">this</a> video by the author of plotjuggler and you'll understand more.</p>
<p>Hope this helps</p>
| 109662 | 2024-03-01T20:46:56.707 | |ros2|odometry|robot-localization|trajectory| | <p>Is there a way in ROS2 to compare trajectories from odometry data? I'm using robot_localization to calculate various odometry outputs by incorporating GPS and IMU data. I have a bag file where I recorded odometry topics, and I would like to compare the paths taken in the following configurations:</p>
<ul>
<li>/odom_local (odometry + IMU)</li>
<li>/odom_global (odometry + IMU + GPS)</li>
<li>/odom_ackermann (only my odometry data)</li>
</ul>
<p>I can visualize the trajectories in rviz2, but I also want to compare them in terms of distance error, etc.</p>
<p>If someone has already done this, I hope they can assist me.</p>
<p>Thanks in advance.</p>
| Comparison of trajectories from odometries |
<p>Ok, not sure what was the reason for the error, but after some other things on focus it all seems to work fine even with comments.</p>
<p>Thanks for the help anyways.
And thanks @reason_rock for your comment.</p>
| 109663 | 2024-03-01T21:35:40.120 | |rosparam|rclcpp|yaml-cpp| | <p>Does anyone know, if there are available comments in the yaml files containing parameters?
I tried to comment some information to keep it for later, but then I got rcl parsing exception.
But maybe I did something incorrectly (I used '#' characted at the beginning of the line).
(I am using launch file if that changes anything)</p>
<pre class="lang-bash prettyprint-override"><code>[ERROR] [1709328529.037018382] [rcl]: Failed to parse global arguments
[node-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLInvalidROSArgsError'
[node-1] what(): failed to initialize rcl: Couldn't parse params file: '--params-file (PATH)/config/default_params.yam
l'. Error: Error parsing a event near line 3, at ./src/parse.c:769, at ./src/rcl/arguments.c:406
[ERROR] [node-1]: process has died [pid 1110086, exit code -6, cmd '/(PATH)/test_ws/install/package/lib/package/node --ros-args --params-file /home
/a_tirma/git_projects/test_ws/install/at_xb_dev_ros/share/at_xb_dev_ros/config/default_params.yaml --ros-args -r __node:=node -r __ns:=/a_tirma'].
</code></pre>
<p>EDIT (added yaml file, as @Wilhelm suggested):</p>
<h3>VALID</h3>
<pre class="lang-yaml prettyprint-override"><code>/a_tirma/xbee_device_node:
ros__parameters:
baud_rate: 115200
telemetry_period: 100
xb_local_period: 10
xb_device_path: /dev/ttyACM3
due_address: '00 13 a2 00 41 5c 61 86 '
wasp_address: '00 13 a2 00 40 79 58 98 '
qos_overrides:
/parameter_events:
publisher:
depth: 1000
durability: volatile
history: keep_last
reliability: reliable
use_sim_time: false
</code></pre>
<h3>INVALID</h3>
<pre class="lang-yaml prettyprint-override"><code>/a_tirma/xbee_device_node:
ros__parameters:
baud_rate: 115200
telemetry_period: 100
xb_local_period: 10
xb_device_path: /dev/ttyACM3
# comment
due_address: '00 13 a2 00 41 5c 61 86 '
wasp_address: '00 13 a2 00 40 79 58 98 '
qos_overrides:
/parameter_events:
publisher:
depth: 1000
durability: volatile
history: keep_last
reliability: reliable
use_sim_time: false
</code></pre>
<p><em>Note that the names are different from the error output, as I changed them to be more generic there.</em></p>
| rclcpp ROS2 params yaml file comments |
<p>First of all, welcome to Roboticks Stack Exchange! <code>osm_cartography</code> only publishes the OSRM information for visualization purposes. In that case, you would have to create some software that could translate the VisualMarkers into other message such as Lines, or RoadLines and follow them, or either use the OSRM API to ask a destination, and again, create some piece of software that splits the information from the response you received. If you want <code>move_base</code> to work with OSRM map, I don't think there's no way to create a map directly using the information from the osm_cartography</p>
| 109664 | 2024-03-01T23:06:52.967 | |navigation|mapping|move-base|ros-noetic| | <p>After I publish osm_cartography and can see the map in rviz, what do I do next to make the robot navigate through the map? Do I use move_base or some other package? If I use move_base, how can I load this map to move_base? Or if there's another package, what package would it be?</p>
<p><a href="https://i.stack.imgur.com/Y8vrr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y8vrr.png" alt="osm_cartograthy map" /></a></p>
| How can Navigation with openStreetMap osm |
<p>You can use the <code>--symlink-install</code> flag while building your code. This will create symlinks in the install directory which points to actual source files rather then creating copies. So whenever you make change in your source files it will automatically be reflected in install and you won't be required to build again. You can also check this link, <a href="https://answers.ros.org/question/371822/what-is-the-use-of-symlink-install-in-ros2-colcon-build/" rel="nofollow noreferrer">what is the use of --symlink-install in ROS2 colcon build?</a>, for further help.</p>
| 109672 | 2024-03-02T21:11:18.793 | |ros2|build|colcon|launch-file| | <p>In ROS1 we could modify XML launchfile and roslaunch them directly without catkin_make rebuilding, in ROS2 it seems if I modify python launchfile, I need to rebuild the package otherwise</p>
<pre><code>ros2 launch <package_name> <launchfile_name>
</code></pre>
<p>runs the old launchfile. Do I need to rebuild the package after each modification or am I missing something?</p>
| ROS2 - modify py launchfile without rebuilding package |
<p>My guess is that the paper you try to implement relies on a velocity-based MPC, which is perfectly fine if the dynamics are not too important (small velocities, good low-level controllers).</p>
<p>If your hardware only accepts velocity control you have two choices:</p>
<ul>
<li>use velocity at the MPC control inputs, as in the paper</li>
<li>or use dynamic MPC and integrate the control <code>u</code> to produce a velocity. This is what we have done <a href="https://hal.archives-ouvertes.fr/hal-02877155" rel="nofollow noreferrer">in this paper</a>:</li>
</ul>
<blockquote>
<p>Since our hardware does not yet allow to directly control the robot in
acceleration, in order to test M2 we numerically integrated the
acceleration signal produced by the VPC and sent the resulting signal
to the low-level velocity controller running on our robot.</p>
</blockquote>
<p>The same can be done for pure position control, you need to integrate <code>u</code> twice as you have mentioned. You may also simply track the MPC state output <code>x</code> if you have a good position controller, but then this is more moving horizon planning and less MPC.</p>
| 109686 | 2024-03-03T20:23:50.973 | |robotic-arm|control|mobile-robot|kinematics|mpc| | <p>Good day, I hope you are all well :) It's been 7 years since I've last been here haha.</p>
<p>I am currently trying to implement this paper: <a href="https://www.mdpi.com/2077-0472/12/3/381" rel="nofollow noreferrer">https://www.mdpi.com/2077-0472/12/3/381</a></p>
<p>Their mobile manipulator uses MPC to control the end effector of the arm to efficiently spray plants in the vineyard with respect to a reference trajectory. The arm operates in the x-z plane. The distance of the robot's base and end-effector is assumed to be in a constant distance away from the vines in the y-axis.</p>
<p><a href="https://i.stack.imgur.com/tOhbU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tOhbU.jpg" alt="This is the x-z view of their coordinate frame" /></a></p>
<p>The spray frame is defined at a fixed distance from the spray nozzle, and its position is computed using a single static transformation from the last link of the robot manipulator. The goal is to control the global position of the frame, which depends on the position of the frame with respect to , and the pose of the robot arm.</p>
<p>,=,+,
where , is the x coordinate of the position of the frame with respect to , controlled by the robot arm, and , is the x coordinate of the position of with respect to , controlled by the mobile base.</p>
<p><a href="https://i.stack.imgur.com/NS3Uj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NS3Uj.jpg" alt="This is the y-axis view" /></a></p>
<p>This is their discrete state space model
<a href="https://i.stack.imgur.com/YZCGI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YZCGI.jpg" alt="State Space Model" /></a>
<a href="https://i.stack.imgur.com/mIPEe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mIPEe.png" alt="Author's version of the variables" /></a></p>
<p>The output is basically the target x and z coordinates of the end effector.</p>
<p>What confuses me is where the velocity outputs from the MPC controller came from as shown in their diagram. I'm assuming their mobile robot base might be ros based an may need to accept velocity commands as inputs and so does their arm but where did they get the velocity values in their system diagram?</p>
<p><a href="https://i.stack.imgur.com/Ybwfv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ybwfv.png" alt="Author's system control diagram" /></a></p>
<p>I also plan on doing something similar:</p>
<p><a href="https://i.stack.imgur.com/YLW7B.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YLW7B.jpg" alt="My system control diagram" /></a>
[There's an error in the picture, Forward Kinematics should be Inverse Kinematics]</p>
<p>But what's different with mine is that I have already have a controller for the robot arm that accepts x and z target positions and my partner also already made a controller that takes x positions for the base.</p>
<p>My question is if it is possible for me to directly use the output of the MPC (y matrix) for this or do I have to use the optimize control inputs (u matrix or accelerations). If I have to use the control inputs, can I just integrate them or can I use this equation to get the position inputs needed for my other controllers?</p>
<p>x(k) = 1/2 x_dot_dot(k-1)^2*T + x_dot(k-1)*T+ x(k-1)</p>
<p>My colleague, also said that it was possible the velocities were taken from the optimized state matrix x(k)?</p>
<p>Thank you.</p>
| Mobile Manipulator: Is it possible to use the output state of an MPC position controller instead of the optimized control inputs (acceleration)? |
<p>The short answer here is to remove the source workspace as well as any build only dependencies and intermediate artifacts.</p>
<p>The bigger picture is that you should be looking at using the generated install directory from your build and installing that instead of just using the development workspace which is not optimized for execution/deployment and still had all the artifacts necessary to build again.</p>
<p>There are many techniques for this. You can see examples in cross compilation toolchains, or the debian packages.</p>
| 109687 | 2024-03-03T20:31:31.563 | |ros2|docker| | <p>I'm building ros2 humble from source on a Docker image. The target is an arm32v7 computer (Odroid XU4)
I'm using rosinstall_generator to get ros_core packages. Using docker buildx I managed to build the image on my laptop PC, so far, so good.
What should I do to reduce the size of the image?</p>
<pre><code># ARG is overridable by --build-arg
ARG UBUNTU_CODENAME=jammy
ARG ROS_DISTRO=humble
FROM arm32v7/ubuntu:${UBUNTU_CODENAME}
# NOTE: An ARG declared before a FROM is outside of a build stage, so it canβt be used in any instruction after a FROM.
# To use the default value of an ARG declared before the first FROM use an ARG instruction without a value inside of a build stage
ARG UBUNTU_CODENAME
ARG ROS_DISTRO
# Set locale
RUN apt-get update && apt-get install -y locales \
&& locale-gen en_US en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ENV LANG en_US.utf8
# ENV DEBIAN_FRONTEND=noninteractive
# Add the ROS 2 apt repository
RUN apt-get update && apt-get install -y software-properties-common \
&& add-apt-repository universe \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y curl \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& rm -rf /var/lib/apt/lists/*
RUN echo "deb [arch=<span class="math-container">$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $</span>{UBUNTU_CODENAME} main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# Por defecto se utiliza la timezone de Buenos Aires
ENV TZ=America/Argentina/Buenos_Aires
RUN ln -snf /usr/share/zoneinfo/<span class="math-container">${TZ} /etc/localtime && echo $</span>{TZ} > /etc/timezone
# Install development tools and ROS tools
RUN apt-get update && apt-get install -y \
python3-flake8-docstrings \
python3-pip \
python3-pytest-cov \
ros-dev-tools \
&& rm -rf /var/lib/apt/lists/*
# install some pip packages needed for testing
RUN apt-get update && apt-get install -y \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pytest-repeat \
python3-pytest-rerunfailures \
&& rm -rf /var/lib/apt/lists/*
# Install latest cmake
RUN apt-get update && apt-get install -y gpg wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${UBUNTU_CODENAME} main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \
&& apt-get update \
&& apt-get install -y cmake \
&& rm -rf /var/lib/apt/lists/*
COPY core.repos /ros2.repos
# Get ROS 2 code
RUN update-ca-certificates --fresh \
&& mkdir -p /root/ros2_ws/src \
# && wget https://raw.githubusercontent.com/ros2/ros2/${ROS_DISTRO}/ros2.repos \
&& vcs import --input ros2.repos /root/ros2_ws/src
# Install dependencies using rosdep
RUN apt-get update && apt-get upgrade -y \
&& update-ca-certificates --fresh \
&& rosdep init \
&& rosdep update \
&& rosdep install --from-paths /root/ros2_ws/src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers" \
&& rm -rf /var/lib/apt/lists/*
RUN cd /root/ros2_ws && colcon build && rm -rf build log src
</code></pre>
<p>Doing a docker history I get:</p>
<pre><code>IMAGE CREATED CREATED BY SIZE COMMENT
12b7ac1e8625 4 minutes ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠138MB buildkit.dockerfile.v0
<missing> 2 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠337MB buildkit.dockerfile.v0
<missing> 2 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠2.28GB buildkit.dockerfile.v0
<missing> 2 hours ago COPY core.repos /ros2.repos # buildkit 26.8kB buildkit.dockerfile.v0
<missing> 2 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠39.2MB buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠2.76MB buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠412MB buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠31B buildkit.dockerfile.v0
<missing> 20 hours ago ENV TZ=America/Argentina/Buenos_Aires 0B buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠118B buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠2.05MB buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠110MB buildkit.dockerfile.v0
<missing> 20 hours ago ENV LANG=en_US.utf8 0B buildkit.dockerfile.v0
<missing> 20 hours ago RUN |2 UBUNTU_CODENAME=jammy ROS_DISTRO=humb⦠20.8MB buildkit.dockerfile.v0
<missing> 20 hours ago ARG ROS_DISTRO 0B buildkit.dockerfile.v0
<missing> 20 hours ago ARG UBUNTU_CODENAME 0B buildkit.dockerfile.v0
<missing> 2 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
<missing> 2 weeks ago /bin/sh -c #(nop) ADD file:6767efafdb51cef2a⦠56.4MB
<missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.β¦ 0B
<missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.β¦ 0B
<missing> 2 weeks ago /bin/sh -c #(nop) ARG LAUNCHPAD_BUILD_ARCH 0B
<missing> 2 weeks ago /bin/sh -c #(nop) ARG RELEASE 0B
</code></pre>
<p>If I understand right # Get ROS 2 code takes 2.28GB??
and rosdep takes 337 MB?</p>
<p>Is there a way to reduce that?</p>
| reducing size of a ros2 build from source in docker |
<p>ROS Noetic changed to python 3 as the default version of python.</p>
<p>That error looks like the code that you're running is expecting python 2 style exceptions.</p>
<p>Looking at the tutorial it was written in 2015 for Ubuntu 12.04 or 14.04. at which time python 2 was the default.</p>
<p>To use software that old on a newer platform and version of ROS you will need to do a bunch of code migrations to upgrade the compatibility.</p>
| 109761 | 2024-03-06T21:54:41.793 | |catkin-make|ros-noetic|baxter| | <p>Currently following this tutorial (<a href="http://wiki.lofarolabs.com/index.php/Baxter_Research_sdk_installation" rel="nofollow noreferrer">http://wiki.lofarolabs.com/index.php/Baxter_Research_sdk_installation</a>) to download Baxter SDK, when I reach the catkin_make section, i get this error:</p>
<p>Traceback (most recent call last):
File "/home/rawnaa/ros_ws/src/baxter_interface/cfg/HeadActionServer.cfg", line 35, in
from baxter_interface import settings
File "/home/rawnaa/ros_ws/devel/lib/python3/dist-packages/baxter_interface/<strong>init</strong>.py", line 34, in
exec(__fh.read())
File "", line 35, in
File "/home/rawnaa/ros_ws/src/baxter_interface/src/baxter_interface/robot_enable.py", line 167
except OSError, e:
^
SyntaxError: invalid syntax
make[2]: *** [baxter_interface/CMakeFiles/baxter_interface_gencfg.dir/build.make:144: /home/rawnaa/ros_ws/devel/include/baxter_interface/HeadActionServerConfig.h] Error 1
make[1]: *** [CMakeFiles/Makefile2:2876: baxter_interface/CMakeFiles/baxter_interface_gencfg.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j2 -l2" failed</p>
<p>Im using ubuntu 20.04, ROS Noetic.</p>
<p>Not sure how to fix it, please help.</p>
<p>Many thanks</p>
| Catkin_make error when downloading Baxter SDK |
<p>the write() method will be called with the update rate of your controller manager, if you need a different rate we added some <a href="https://control.ros.org/master/doc/ros2_control/hardware_interface/doc/different_update_rates_userdoc.html" rel="nofollow noreferrer">docs here</a>. Which sampling time has your joint_trajectory, and which one the controller_manager? It sounds strange that it would be called 5 times only.</p>
<p>You cannot access the trajectory from your hardware_component, because the joint_trajectory_controller is sampling the trajectory at the current time instance and sends only the current command to the hardware component.</p>
<p>I'm not sure if I understand your problem right, but you simply can add a buffer to save the old commands for the next call to write()?</p>
| 109781 | 2024-03-07T14:08:40.510 | |ros2-control|hardware-interface|joint-trajectory-controller|fanuc|moveit2| | <p>By using ROS Humble, Moveit2, and ros2_control, I am trying to accomplish manipulation tasks with the <a href="https://www.fanuc.eu/de/en/robots/robot-filter-page/collaborative-robots/crx-10ia" rel="nofollow noreferrer">CRX-10iA/L Fanuc</a> robot. Currently, I am implementing ros2_control <a href="https://control.ros.org/master/doc/ros2_control/hardware_interface/doc/hardware_components_userdoc.html" rel="nofollow noreferrer">hardware_interface</a> part. Inside the default <strong>write</strong> function I am sending motion commands to robot.</p>
<p>I have two motion command options from the provided robot interface. One of them should be sent except the last write command and the other one must be sent lastly. Otherwise, communication can't go further.</p>
<p>I was wondering whether I can access to the total number of write commands that will be sent by hardware_interface? Then I can set a simple <em>if-else</em> logic.</p>
<p>I thought about accessing total number of joint trajectory commands but I realized that when moveit generated a <a href="https://docs.ros.org/en/noetic/api/trajectory_msgs/html/msg/JointTrajectoryPoint.html" rel="nofollow noreferrer">joint trajectory</a> point with 22 positions, write() function was called 5 times in <strong>hardware_interface</strong>. Less than ideal as expected due to real hardware constraints.</p>
<p>Any suggestion is appreciated. Thank you for your time.</p>
| ros2_control - Hardware Interface - Write() & Moveit2 Joint Trajectory |
<p>Convert your urdf to SDF. Gazebo can read SDF formats:</p>
<pre><code>gz sdf -p /path/to/your/robot.urdf > /path/to/your/robot.sdf
</code></pre>
| 109791 | 2024-03-07T20:17:17.450 | |gazebo|urdf|sdf|ignition-fortress| | <p>I have problem with reading my robot URDF file with gazebo. In my worlds.sdf, I put</p>
<pre><code><include>
<name>hexapod</name>
<uri>file://home/uchi/hexapod_ws/src/hexapod_description/urdf/hexapod_description.urdf</uri>
<pose>0.1 0.1 0.1 0 0 0</pose>
<static>false</static>
</include>
</code></pre>
<p>when I run my launch file, I get this error:</p>
<pre><code>[ruby $(which ign) gazebo-4] [Err] [Server.cc:139] Error Code 1: [/sdf/world[@name="example_world"]/include[0]/uri:/home/uchi/hexapod_ws/install/hexapod_description/share/hexapod_description/worlds/example_world.sdf:L212]: Msg: Unable to read file[/home/uchi/hexapod_ws/src/hexapod_description/urdf/hexapod_description.urdf]
</code></pre>
<p>I also set my export IGN_GAZEBO_RESOURCE_PATH="$HOME/uchi/hexapod_ws/src/hexapod_description/urdf" as well</p>
<p>Why can't uri read my URDF file? Based on my knowledge, SDF would be able to read URDF file with and </p>
<p>UPDATE: I tried to directly read my urdf file with</p>
<pre><code>ign gazebo src/hexapod_description/urdf/hexapod_description.urdf
</code></pre>
<p>but still cannot read it. Now I wonder if Fortress can read URDF or if my URDF file is missing something that make Gazebo not be able to read it.</p>
<p>UPDATE 2: I followed <a href="https://gazebosim.org/docs/fortress/spawn_urdf" rel="nofollow noreferrer">Gazebo tutorial</a> to see if I can spawn my robot on Fortress. I got the same error and I also cannot read their <a href="https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro" rel="nofollow noreferrer">robot</a> used in the example either. Anyone reason for this? It is totally fine when I load sdf model instead.</p>
<p>SOLVED: What causes my problem is that in my URDF file, while declaring my links, I only had visual and collision declared,ignored inertial. It was fine on RVIZ but not in Gazebo. Also, I used xacro::property for fast declaration, which prevent gazebo from successfully reading it.</p>
| Question about uri reading urdf in fortress |
<p>About your first problem:<br />
I think you just have to delete <code>model://</code> to be able to find your stl file:</p>
<pre><code><mesh>
<scale>1 1 1</scale>
<uri>hexapod_description/mesh/link1.STL</uri>
</mesh>
</code></pre>
<p>About your second problem with the invisibility:<br />
Are your sure your model is invisible? Maybe it's a scaling problem and your imported model is just very small or very large. I faced the same problem while converting some meshes and it turned out there was a problem between US and EU decimal sepearation, so that my model was scaled up about 1000x and I had to zoom out very far to see it.</p>
| 109797 | 2024-03-08T04:43:33.687 | |gazebo|sdf|ignition-fortress|stl| | <p>I try to load my robot sdf file. But Gazebo cannot load my stl mesh and give these errors</p>
<pre><code>[Err] [SystemPaths.cc:378] Unable to find file with URI [model://hexapod_description/mesh/link1.STL]
[Err] [SystemPaths.cc:473] Could not resolve file [model://hexapod_description/mesh/link1.STL]
[Err] [MeshManager.cc:173] Unable to find file[model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [SystemPaths.cc:378] Unable to find file with URI [model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [SystemPaths.cc:473] Could not resolve file [model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [MeshManager.cc:173] Unable to find file[model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [MeshDescriptor.cc:56] Mesh manager can't find mesh named [model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [Ogre2MeshFactory.cc:562] Cannot load null mesh [model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [Ogre2MeshFactory.cc:125] Failed to get Ogre item for [model://hexapod_description/mesh/link1.STL]
[GUI] [Err] [SceneManager.cc:404] Failed to load geometry for visual: link1_visual
</code></pre>
<p>I can load it up on Gazebo Fortress, but it cannot be visually seen. Here is my sdf file:</p>
<pre><code><sdf version='1.7'>
<model name='hexapod'>
<link name='link1'>
<inertial>
<pose>0 0 1 0 -0 0</pose>
<mass>1</mass>
<inertia>
<ixx>0.334167</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.334167</iyy>
<iyz>0</iyz>
<izz>0.00166667</izz>
</inertia>
</inertial>
<collision name='link1_collision'>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>model://hexapod_description/mesh/link1.STL</uri>
</mesh>
</geometry>
</collision>
<visual name='link1_visual'>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>model://hexapod_description/mesh/link1.STL</uri>
</mesh>
</geometry>
</visual>
</link>
</model>
</sdf>
</code></pre>
<p>Does anyone know why gazebo cannot load my STL file? I export it from Solidwork file and it works fine in RVIZ</p>
<p>UPDATE: I moved my STL file into the same folder with my SDF file. I now load without any error but still being invisible. Does anyone know what cause it?
Here is my new sdf file:</p>
<pre><code><sdf version='1.7'>
<model name='hexapod'>
<link name='link1'>
<inertial>
<pose>0 0 1 0 -0 0</pose>
<mass>1</mass>
<inertia>
<ixx>0.334167</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.334167</iyy>
<iyz>0</iyz>
<izz>0.00166667</izz>
</inertia>
</inertial>
<collision name='link1_collision'>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>link1.STL</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode/>
</friction>
</surface>
</collision>
<visual name='link1_visual'>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>link1.STL</uri>
</mesh>
</geometry>
<material>
<script>
<name>Gazebo/Orange</name>
<uri>file://media/materials/scripts/gazebo.material</uri>
</script>
</material>
</visual>
</link>
</model>
</sdf>
</code></pre>
<p>SOLVED: I made a mistake in my IGN_GAZEBO_RESOURCE_PATH. Here is my correct one:
export IGN_GAZEBO_RESOURCE_PATH="$HOME/uchi/hexapod_ws/"
If you think your path is correct, make sure to source your workspace before running</p>
| Fail to load Mesh with STL on Gazebo |
<p>You can find a specific example in the ros2 examples repo:
<a href="https://github.com/ros2/examples/blob/rolling/rclcpp/topics/minimal_subscriber/lambda.cpp" rel="nofollow noreferrer">https://github.com/ros2/examples/blob/rolling/rclcpp/topics/minimal_subscriber/lambda.cpp</a></p>
<p>It can be done even shorter:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <memory>
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
class MinimalSubscriber : public rclcpp::Node {
public:
MinimalSubscriber()
: Node("minimal_subscriber"),
subscription_1_(this->create_subscription<std_msgs::msg::String>(
"chatter_1", 10,
[this](const std_msgs::msg::String &msg) -> void {
callback(msg, 1);
})),
subscription_2_(this->create_subscription<std_msgs::msg::String>(
"chatter_2", 10, [this](const std_msgs::msg::String &msg) -> void {
callback(msg, 2);
})) {}
private:
void callback(const std_msgs::msg::String &msg, int source) {
RCLCPP_INFO(this->get_logger(), "I heard: '%s' from %d", msg.data.c_str(),
source);
}
rclcpp::Subscription<std_msgs::msg::String>::SharedPtr subscription_1_;
rclcpp::Subscription<std_msgs::msg::String>::SharedPtr subscription_2_;
};
int main(int argc, char *argv[]) {
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<MinimalSubscriber>());
rclcpp::shutdown();
return 0;
}
<span class="math-container">```</span>
</code></pre>
| 109801 | 2024-03-08T07:42:43.090 | |ros2|ros-humble|callback|rostopic|rclcpp| | <p>I want to add an additional argument in a callback function for <code>rclcpp</code>, e.g. <code>callback(msg, additional_argument)</code>.</p>
<p>I can do it in python. There the solution would be:</p>
<pre><code>import rclpy
from std_msgs.msg import String
def callback(data, source):
rospy.loginfo(f"I heard '{data.data}' from {source}")
def listener():
rclpy.init()
node = rclpy.create_node('listener')
node.create_subscription(String, 'chatter_1', lambda msg: callback(msg, 1), 10)
node.create_subscription(String, 'chatter_2', lambda msg: callback(msg, 2), 10)
rclpy.spin(node)
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
listener()
</code></pre>
<p>I also did it in ROS1 with boost::bind. I tried to do it in ROS2 with std::bind, but it did not work.</p>
<p>Does someone know the exact syntax?</p>
<p>Thanks</p>
| How to add an additional argument in a ROS2 cpp callback |
<p>It works when I use <code>--network</code> host in the command.</p>
<pre><code>docker container run --rm --name jakal-ros-sub -e ROS_MASTER_URI=http://0.0.0.0:11311 --network host jakal_sub:1.0.0
</code></pre>
| 109816 | 2024-03-08T15:04:06.150 | |ros|python|docker|jackal| | <p>I am trying to get ROS traffic from the local host to a Docker container on that same host but I get an error when I run my Docker container.</p>
<p>The Dockerfile is:</p>
<pre><code>FROM ros:noetic
ARG ROS_APP_CFG=ros_app.cfg
LABEL developer=jason@myemail.io
RUN set -xe \
&& apt-get update \
&& apt-get -y install python3-pip
RUN pip install --no-binary protobuf protobuf && \
pip install pyzmq
RUN mkdir -p /opt/my_server
COPY ./config-python /opt/my_server/config-python
RUN cd /opt/my_server/config-python && \
pip install .
EXPOSE 11311/udp
COPY src/${ROS_APP_CFG} /ros_app.cfg
COPY src/ros_app.py /
WORKDIR /
CMD ["python3", "ros_app.py"]
</code></pre>
<p>The Docker build and run commands are:</p>
<pre><code>docker image build --build-arg="ROS_APP_CFG=jakal_sub.cfg" -t jakal_sub:1.0.0 -f Dockerfile_sub .
docker container run --rm --name jakal-ros-sub -e ROS_MASTER_URI=http://0.0.0.0:11311 -p 11311:11311 jakal_sub:1.0.0
</code></pre>
<p>I run <code>roscore</code> on my local host. The port is 11311. The error message is:</p>
<pre><code>docker: Error response from daemon: driver failed programming external connectivity on endpoint jakal-ros-sub (7d200e24af39943cad71874c08a3e4ee63a22b8ade479a753f87ce0f9d3a86b3): Error starting userland proxy: listen tcp4 0.0.0.0:11311: bind: address already in use.
</code></pre>
<p>I assume it refers to the ROS master; but how do I get the Docker container to see the ROS traffic?</p>
| How to get a Docker container to see ROS traffic from the local host? |
<p>Its in the behavior tree XML. The BT is where the navigation behavior is defined and customizable. The current default has a RateController over the planner to limit it to a fixed rate (1 hz), though you can use any other type of BT logic to define replanning events.</p>
| 109824 | 2024-03-09T01:04:57.963 | |ros2|nav2|global-planner| | <p>I'm trying to increase the re-planning frequency of Nav2's A* global planner from 1 Hz to 10 Hz. In order to do this, I changed the <code>expected_planner_frequency</code> parameter from <code>1.0</code> to <code>10.0</code> in the <code>planner_server</code> section of <code>nav2_params.yaml</code>.</p>
<p>However, running <code>ros2 topic hz</code> on the global planner still shows a re-planning frequency of 1 Hz. Looking a little more into the code, it seems like changing <code>expected_planner_frequency</code> only affects whether a warning message will be displayed if the planner server is unable to compute a global path within <code>1/expected_planner_frequency</code> seconds, and doesn't actually affect the global planner's re-planning frequency (i.e. the number of times it actually computes a path from start to goal each second).</p>
<p>As such, I wanted to ask how I can update the global planner's re-planning frequency. Is it a parameter I can set in <code>nav2_params.yaml</code> or do I need to modify the XML files that control Nav2's behavior tree? Any guidance would be appreciated, thanks.</p>
| Increasing re-planning frequency of Nav2 global planner |
<p>I was able to figure out the issue- like some answers I saw online have said, I needed to uncomment "LIBRARIES ${PROJECT_NAME}" under catkin_package() as I was not actually adding a library named jackal_2dnav. The reason this didn't work before was due to issues with some of the source code.</p>
| 109829 | 2024-03-09T07:03:56.060 | |ros|cmake|package|custom-message| | <p>I have been trying to use a custom message called sPoses from one package (jackal_2dnav) in another (explore) in the same ROS workspace, but I have been unable to get it to work. I added jackal_2dnav as a dependency for explore in its package.xml, but when I would run <code>catkin build</code>, I would get the following error-</p>
<pre><code>In file included from /home/conlab/ssv2_ws/src/m-explore/explore/src/explore.cpp:38:
/home/conlab/ssv2_ws/src/m-explore/explore/include/explore/explore.h:54:10: fatal error: jackal_2dnav/sPoses.h: No such file or directory
54 | #include <jackal_2dnav/sPoses.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/explore.dir/build.make:95: CMakeFiles/explore.dir/src/explore.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2644: CMakeFiles/explore.dir/all] Error 2
make: *** [Makefile:160: all] Error 2
</code></pre>
<p>And when I try adding jackal_2dnav to explore_lite's CMakeLists.txt, under both <code>find_package</code> and <code>catkin_package</code>, I get the following error instead</p>
<pre><code>CMake Error at /home/conlab/ssv2_ws/devel/share/jackal_2dnav/cmake/jackal_2dnavConfig.cmake:173 (message):
Project 'explore_lite' tried to find library 'jackal_2dnav'. The library
is neither a target nor built/installed properly. Did you compile project
'jackal_2dnav'? Did you find_package() it before the subdirectory
containing its code is included?
Call Stack (most recent call first):
/opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
CMakeLists.txt:5 (find_package)
</code></pre>
<p>I've tried the fixes I've seen in similar questions, but they haven't worked. Does anyone know how I can fix this?</p>
<p>The file tree is something like this-</p>
<pre><code>-workspace
-src
-jackal_2dnav (the package whose message I would like to use)
-msg
-sPoses.msg (the message I would like to use)
-include
-launch
-params
-src
-CMakeLists.txt
-package.xml
-explore_lite (the package I would like to use the message in)
-m-explore
-explore
-include
-launch
-src
-CMakeLists.txt
-package.xml
-map_merge (an unrelated package)
</code></pre>
<p>As for the CMakeLists.txt, the one for explore is shown below</p>
<pre><code>cmake_minimum_required(VERSION 3.1)
project(explore_lite)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
costmap_2d
geometry_msgs
map_msgs
move_base_msgs
nav_msgs
roscpp
std_msgs
tf
visualization_msgs
jackal_2dnav
)
###################################
## catkin specific configuration ##
###################################
catkin_package(
CATKIN_DEPENDS
actionlib
actionlib_msgs
costmap_2d
geometry_msgs
map_msgs
move_base_msgs
nav_msgs
roscpp
std_msgs
tf
visualization_msgs
jackal_2dnav
)
###########
## Build ##
###########
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
## Specify additional locations of header files
include_directories(
${catkin_INCLUDE_DIRS}
include
)
add_executable(explore
src/costmap_client.cpp
src/explore.cpp
src/frontier_search.cpp
)
add_dependencies(explore <span class="math-container">${${PROJECT_NAME}_EXPORTED_TARGETS} $</span>{catkin_EXPORTED_TARGETS})
add_dependencies(explore ${catkin_EXPORTED_TARGETS})
target_link_libraries(explore ${catkin_LIBRARIES})
#############
## Install ##
#############
# install nodes
install(TARGETS explore
ARCHIVE DESTINATION <span class="math-container">${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION $</span>{CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# install roslaunch files
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
#############
## Testing ##
#############
if(CATKIN_ENABLE_TESTING)
find_package(roslaunch REQUIRED)
# test all launch files
roslaunch_add_file_check(launch)
endif()
</code></pre>
<p>And the package.xml file is</p>
<pre><code><?xml version="1.0"?>
<package format="2">
<name>explore_lite</name>
<version>2.1.4</version>
<description>Lightweight frontier-based exploration.</description>
<author email="laeqten@gmail.com">Jiri Horner</author>
<maintainer email="laeqten@gmail.com">Jiri Horner</maintainer>
<license>BSD</license>
<url>http://wiki.ros.org/explore_lite</url>
<!-- acknowledgements
<author>Charles DuHadway</author>
<url>http://ros.org/wiki/explore</url>
<author>Paul Bovbel</author>
<url>https://github.com/paulbovbel/frontier_exploration</url>
-->
<buildtool_depend>catkin</buildtool_depend>
<depend>jackal_2dnav</depend>
<depend>roscpp</depend>
<depend>std_msgs</depend>
<depend>move_base_msgs</depend>
<depend>visualization_msgs</depend>
<depend>geometry_msgs</depend>
<depend>map_msgs</depend>
<depend>nav_msgs</depend>
<depend>actionlib_msgs</depend>
<depend>tf</depend>
<depend>costmap_2d</depend>
<depend>actionlib</depend>
<test_depend>roslaunch</test_depend>
</package>
</code></pre>
<p>I would really appreciate it if someone could point out what I am doing wrong.</p>
| Unable to use custom message from another ROS package |
<p>idk why it doesn't find the world package, but after putting in the whole file route</p>
<pre><code><arg name="world_name" value="/home/rvl224/brian2lee/gazebo/forklift_test/src/ros1_wiki/world/test.world"/>
</code></pre>
<p>it works as I expect</p>
| 109851 | 2024-03-10T11:21:56.910 | |ros|gazebo|roslaunch|world| | <p>As the title mentioned, I made models with urdf files, find some public sdf models, and use the build editor in gazebo to generate walls. However I couldn't find a way to launch them other than launching the urdf model and manually putting sdf and walls in one by one. I've tried to save the built world and launched them but it showed</p>
<pre><code>Resource not found: The following package was not found in <arg name="world_name" value="$(find ros1_wiki)/world/test.world"/>: ros1_wiki ROS path
[0]=/opt/ros/noetic/share/ros ROS path
[1]=/home/rvl224/brian2lee/gazebo/forklift_test/src ROS path
[2]=/opt/ros/noetic/share
The traceback for the exception was written to the log file
</code></pre>
<p>Down below is my launch file and where I saved the world file. I've launched the urdf models successfully using the same launch file without the " arg name="world_name" " line which made me more confused why it showed package not found in the error.</p>
<blockquote>
<p>/home/rvl224/brian2lee/gazebo/forklift_test/src/ros1_wiki/world/test.world</p>
</blockquote>
<pre><code><?xml version="1.0"?>
<launch>
<param name="robot_description" command="xacro '<span class="math-container">$(find forklift)/urdf/forklift.urdf.xacro'"/>
<param name="pallet_description" command="xacro '$</span>(find forklift)/urdf/pallet.urdf.xacro'"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
<node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui"/>
<include file="<span class="math-container">$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$</span>(find ros1_wiki)/world/test.world"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<node name="spawning_forklift" pkg="gazebo_ros" type="spawn_model"
args="-urdf -model forklift -param robot_description -x -2 -y 0 -z 0 -Y 0"/>
<node name="spawning_pallet" pkg="gazebo_ros" type="spawn_model"
args="-urdf -model pallet -param pallet_description -x 0 -y 0 -z 0"/>
</launch>
</code></pre>
| How can I launched urdf, sdf models and walls in the same gazebo world? |
<p>Im working on the same problem and have found a workaround that lets you get parameters from a yaml file like you would in ROS1 without forward declaring them as is the default in ROS2.</p>
<p>You need to set the node options in your nodes constructor to accept undeclared parameters and to automatically declare parameters from overrides.</p>
<pre><code>rclcpp::NodeOptions().allow_undeclared_parameters(true).automatically_declare_parameters_from_overrides(true)
</code></pre>
<p>And your yaml file...</p>
<pre><code>/your_node_namespace:
your_node_name:
ros__parameters:
people:
Alice:
name: "Alice"
age: 30
grade: "A+"
Bob:
name: "Bob"
age: 25
grade: "B-"
</code></pre>
<p>You can then use the <a href="https://docs.ros2.org/dashing/api/rclcpp/classrclcpp_1_1Node.html#ae5ab12777100f65bd09163814dbbf486" rel="nofollow noreferrer">get_parameters()</a> ROS2 api to get all the people parameters by specifying people as a prefix. This puts the people key value pairs into a std::map as shown below.</p>
<pre><code>std::map<std::string, rclcpp::Parameter> people_map;
node->get_parameters("people", people_map);
</code></pre>
<p>So your params would be accessible from the map as a key value pair where the key is a string "Alice.age" and value is a rclcpp parameter which can be utilized with rclcpp built in methods .as_int() or .as_double() or .as_string() etc.</p>
<p>This isnt perfect as I'd prefer the people params in a struct rather than a map. You also have to be careful not to redeclare parameters that are specified in the yaml file as it will throw a ROS error. If you want to be able to forward declare parameters AND load them from a yaml file youll have to implement logic to check whether the node already has the parameter.</p>
<pre><code> if (!node->has_parameter("your_param")) {
node->declare_parameter("your_param", your_param_default);
}
</code></pre>
| 109909 | 2024-03-12T23:35:47.333 | |ros2|ros-humble|parameters| | <p>I would like to be able to read ROS2 parameters of the form:</p>
<pre><code>/**:
ros__parameters:
people:
- name: "Alice"
age: 30
grade: "A+"
- name: "Bob"
age: 25
grade: "B-"
</code></pre>
<p>From what I can tell, there doesn't seem to be a great way to do this in ROS2.</p>
<p>The workaround I've been using looks like this:</p>
<pre><code>/**:
ros__parameters:
people_id:
- "Alice"
- "Bob"
people:
Alice:
name: "Alice"
age: 30
grade: "A+"
Bob:
name: "Bob"
age: 25
grade: "B-"
</code></pre>
<p>This method works alright. However, It's a pain to need to forward declare all the <code>people</code> you want to configure. (In this example we could technically drop the name field since that's what we're using for the ID.)</p>
<p>In ROS1 I would just read the <code>people</code> parameter as yaml and parse it directly, without the need to forward declare.</p>
<p>Another option I've tried (and least like) is just declaring vectors of everything</p>
<pre><code>/**:
ros__parameters:
names: ["Alice", "Bob"]
ages: [30 , 25]
grades:["A+" , "B-" ]
</code></pre>
<p>for this simple example it's ok, however, I find it easy to get an "off by 1" error when your're configuring more complex objects. It also doesn't support default of name, age, grade if you don't want to specify in your config.</p>
| Reading a vector of structs as parameters in ROS2 |
<p>Probably you don't have the EM module installed, that is why the "Interpreter" attribute is not being found.</p>
<p>Try to install it and check if it fix</p>
<pre><code>pip3 install empy
</code></pre>
| 109912 | 2024-03-13T02:23:40.143 | |ros-humble|nav2| | <p>I try to build nav2_ws from tutorial on <a href="https://navigation.ros.org/development_guides/build_docs/index.html#released-distribution-binaries" rel="nofollow noreferrer">nav2 build and install</a>, and I get this error</p>
<pre><code>--- stderr: nav_2d_msgs
Error processing idl file: /home/uchi/nav2_ws/build/nav_2d_msgs/rosidl_adapter/nav_2d_msgs/msg/Path2D.idl
Traceback (most recent call last):
File "/home/uchi/ros2_humble/install/rosidl_generator_py/share/rosidl_generator_py/cmake/../../../lib/rosidl_generator_py/rosidl_generator_py", line 40, in <module>
sys.exit(main())
^^^^^^
File "/home/uchi/ros2_humble/install/rosidl_generator_py/share/rosidl_generator_py/cmake/../../../lib/rosidl_generator_py/rosidl_generator_py", line 36, in main
generate_py(args.generator_arguments_file, args.typesupport_impls.split(';'))
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_py/generate_py_impl.py", line 61, in generate_py
generated_files = generate_files(generator_arguments_file, mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 96, in generate_files
raise(e)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 87, in generate_files
expand_template(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 128, in expand_template
interpreter = em.Interpreter(
^^^^^^^^^^^^^^
AttributeError: module 'em' has no attribute 'Interpreter'
gmake[2]: *** [nav_2d_msgs__py/CMakeFiles/nav_2d_msgs__py.dir/build.make:167: rosidl_generator_py/nav_2d_msgs/_nav_2d_msgs_s.ep.rosidl_typesupport_fastrtps_c.c] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:590: nav_2d_msgs__py/CMakeFiles/nav_2d_msgs__py.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< nav_2d_msgs [2.83s, exited with code 2]
Aborted <<< nav2_msgs [2.24s]
</code></pre>
<p>It failed on building nav_2d_msgs. Does anyone know how to fix this?</p>
<p>SOLVED: To fix this, I uninstall <code>em</code>, which might cause the conflict, and install <code> pip install empy & lark</code>. But it lead to another error <code> AttributeError: module 'em' has no attribute "'BUFFERED_OPT'"</code>. The problem is new empy version doesn't have <code>BUFFTERD_OPT or RAW_OPT</code> anymore, from what I understand. I need to install old version of <code>pip install empy==3.3.4</code>. Solution found <a href="https://stackoverflow.com/questions/77642155/attributeerror-module-object-has-no-attribute-raw-opt/77656642#77656642">here</a></p>
| Problem with building Nav2 on Ros Humble |
<p>You'd have to <code>install</code> the launch directory into your install space - in your CMakeLists.txt file, you can add the following section :</p>
<pre><code>install(
DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)
</code></pre>
<p>This would now copy over the entire launch directory over to the install space.</p>
| 109984 | 2024-03-15T04:25:48.493 | |ros2|ros-humble|ament|ros2-launch| | <p>This question is almost similar to the other one which has the same issue of <code>_launch.py</code> was not found in the share package. What differs is i created the package using <code>ament_cmake</code>. So i created a urdf file for the robot and launch file attached below</p>
<pre><code>from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import ExecuteProcess
from ament_index_python.packages import get_package_share_directory
import os
def generate_launch_description():
package_name = 'round_bot'
pkg_share = get_package_share_directory(package_name)
urdf_file_path = os.path.join(pkg_share, 'description', 'round_bot.urdf')
with open(urdf_file_path, 'r') as urdf_file:
robot_description = urdf_file.read()
rviz_node = Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen'
)
robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='both',
parameters=[{'robot_description': robot_description}],
)
joint_state_publisher_gui = Node(
package='joint_state_publisher_gui',
executable='joint_state_publisher_gui',
name='joint_state_publisher_gui'
)
gazebo = ExecuteProcess(
cmd=['gazebo', '--verbose'],
output='screen'
)
return LaunchDescription([
rviz_node,
robot_state_publisher,
joint_state_publisher_gui,
gazebo
])
</code></pre>
<p>i went through the ros2 wiki documentation, but i don't know why this issue heads up. Do i have to modify something in the <code>CMakeLists.txt</code> or <code>package.xml</code>
file.</p>
| _launch.py was not found in the share directory of package |
<p>There are so many nice tutorials that you could follow. I am listing down some of them below:</p>
<p><a href="http://wiki.ros.org/image_proc" rel="nofollow noreferrer">http://wiki.ros.org/image_proc</a></p>
<p><a href="https://roboticsbackend.com/ros-import-python-module-from-another-package/" rel="nofollow noreferrer">https://roboticsbackend.com/ros-import-python-module-from-another-package/</a></p>
<p>And for the last part of your question, see this.</p>
<p><a href="https://gist.github.com/zkytony/fb7616b745d77025f6abe919c41f8ea4" rel="nofollow noreferrer">https://gist.github.com/zkytony/fb7616b745d77025f6abe919c41f8ea4</a></p>
| 109993 | 2024-03-15T10:22:55.900 | |ros|gazebo|rviz| | <p>I've made a gazebo envirnment and successfully visualized the cam image with rviz. However I wanted to do some post process to make it simulate the result of image segmentation and send it back to rviz. Is there any similiar methods or tutorials for this? Maybe a way to import the node to python?</p>
| How do I post-process rviz images? |
<p>It turned to be out that there was not enough time to set up and start receiving messages before the publisher in my node starts sending messages.
I fixed it by adding a delay between the subscription and publishing:</p>
<pre><code>self.sub = rospy.Subscriber(SUB_TOPIC, String, self.callback)
rospy.sleep(0.1)
self.pub.publish(self.bridge.cv2_to_imgmsg(self.img_data, encoding="bgr8"))
</code></pre>
| 110009 | 2024-03-15T19:08:04.487 | |rospy|ros-noetic|rostest| | <p>I am struggling with an example integration test for a ROS node (in Python). I have a node that somehow processes input data and outputs some messages based on this:</p>
<pre><code>#!/usr/bin/env python3
import rospy
from image_utils import ImageUtils
from sensor_msgs.msg import Image
from std_msgs.msg import String
class TemplateNode:
def __init__(self):
rospy.init_node("template_node", anonymous=True)
self.input_topic = rospy.get_param("~input_topic", "/input_topic")
self.output_topic = rospy.get_param("~output_topic", "/output_topic")
self.image_utils = ImageUtils()
self.input_sub = rospy.Subscriber(self.input_topic, Image, self.input_callback)
self.output_pub = rospy.Publisher(self.output_topic, String, queue_size=10)
def input_callback(self, data):
try:
img_shape = self.image_utils.get_imgmsg_shape(data)
result = str(img_shape)
rospy.loginfo(result)
self.publish_result(result)
except Exception as e:
rospy.logerr("Error processing image: {}".format(e))
def publish_result(self, data):
self.output_pub.publish(data)
def run(self):
rospy.spin()
if __name__ == "__main__":
try:
node = TemplateNode()
node.run()
except rospy.ROSInterruptException:
pass
</code></pre>
<p>I created the following test for it:</p>
<pre><code>#!/usr/bin/env python3
import sys
import time
import unittest
import numpy as np
import rospy
from cv_bridge import CvBridge
from sensor_msgs.msg import Image
from std_msgs.msg import String
PKG = "template_pkg"
NAME = "template_node_test"
PUB_TOPIC = "/input_topic"
SUB_TOPIC = "/output_topic"
TEST_NODE_NAME = "template_node"
class TemplateNodeTest(unittest.TestCase):
def setUp(self):
self.success = False
self.callback_data = None
self.bridge = CvBridge()
self.img_data = np.random.randint(0, 255, (200, 100, 3), dtype=np.uint8)
self.pub = rospy.Publisher(PUB_TOPIC, Image)
rospy.init_node(NAME, anonymous=True)
def callback(self, data):
self.callback_data = data
if data == str(self.img_data.shape):
self.success = True
def test_image_response(self):
timeout_t = time.time() + 5.0
while (
not rostest.is_subscriber(
rospy.resolve_name(PUB_TOPIC), rospy.resolve_name(TEST_NODE_NAME)
)
and time.time() < timeout_t # noqa: W503
):
time.sleep(0.1)
self.assert_(
rostest.is_subscriber(
rospy.resolve_name(PUB_TOPIC), rospy.resolve_name(TEST_NODE_NAME)
),
"%s is not up" % TEST_NODE_NAME,
)
self.sub = rospy.Subscriber(SUB_TOPIC, String, self.callback)
self.pub.publish(self.bridge.cv2_to_imgmsg(self.img_data, encoding="bgr8"))
timeout_t = time.time() + 1.0
while not rospy.is_shutdown() and not self.success and time.time() < timeout_t:
time.sleep(0.1)
self.assert_(self.success, "Wrong response: {}".format(self.callback_data))
if __name__ == "__main__":
import rostest
rostest.rosrun(PKG, NAME, TemplateNodeTest, sys.argv)
</code></pre>
<p>Launched using the following configuration:</p>
<pre><code><launch>
<node name="template_node" pkg="template_pkg" type="template_node.py" output="screen" />
<test test-name="template_node_test" pkg="template_pkg" type="template_node_test.py"/>
</launch>
</code></pre>
<p>It kinda works, but I the callback from the test is never called:</p>
<pre><code>[INFO] [1710528976.836281]: (200, 100, 3)
[Testcase: testtemplate_node_test] ... ok
[ROSTEST]-----------------------------------------------------------------------
[template_pkg.rosunit-template_node_test/test_image_response][FAILURE]----------
False is not true : Wrong response: None
File "/usr/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
yield
File "/usr/lib/python3.8/unittest/case.py", line 676, in run
self._callTestMethod(testMethod)
File "/usr/lib/python3.8/unittest/case.py", line 633, in _callTestMethod
method()
File "/catkin_ws/src/template_pkg/test/template_node_test.py", line 65, in test_image_response
self.assert_(self.success, "Wrong response: {}".format(self.callback_data))
File "/usr/lib/python3.8/unittest/case.py", line 1410, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib/python3.8/unittest/case.py", line 765, in assertTrue
raise self.failureException(msg)
--------------------------------------------------------------------------------
</code></pre>
<p>I am confused, because I can see the node reporting the shape via logging:</p>
<pre><code>[INFO] [1710528976.836281]: (200, 100, 3)
</code></pre>
<p>Apparently, the message published by the node is not received by the test callback, I just do not understand why.</p>
<p>Would be grateful for any hint, including the test design, maybe I shall do it differently?</p>
| ROS node testing (publish/subscribe) |
<p>My error went away after I ran the following commands:</p>
<ul>
<li>sudo apt update</li>
<li>sudo apt upgrade</li>
</ul>
<p>Running these commands updated the following packages which fixed my issue:</p>
<ul>
<li>python3-colcon-cd</li>
<li>python3-colcon-core</li>
<li>python3-colcon-installed-package-information</li>
</ul>
| 110021 | 2024-03-16T12:30:27.287 | |ros2|ros-humble|build|colcon|python3| | <p>I get the following error when trying to build my python package with Colcon build</p>
<pre><code> [0.235s] ERROR:colcon.colcon_core.package_augmentation:Exception in package augmentation extension 'python':
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/package_augmentation/__init__.py", line 97, in augment_packages
retval = extension.augment_packages(
File "/usr/lib/python3/dist-packages/colcon_installed_package_information/package_augmentation/python.py", line 44, in augment_packages
dist = next(iter(dists))
StopIteration
</code></pre>
<p>What could be the reason for this error and how can I solve it?</p>
| "colcon_core.package_augmentation" Error When Building Python Package With Colcon in ROS2 Humble |
<p>It turns out that I just had to remove <code><remap from="scan" to="base_scan"/></code> from slam_gmapping_pr2.launch. I found out from the fact that <code>rostopic echo /base_scan</code> didn't output anything.</p>
| 110036 | 2024-03-17T19:10:35.393 | |rviz|slam|gmapping|mapping|slam-gmapping| | <p>I am trying to implement autonomous navigation to my robot and have thus been working on the SLAM gmapping system. However, when I try to visualize the map on Rviz, two things happen: the odom frame switches rapidly between "Transform OK" and "No transform from [odom] to frame [map]" (when the fixed frame is map) and I just see a 400 x 400 black square with pixels of value 100 which should be the map. Here is some more information:
This is the file I use to launch everything (lidar_gmapping.launch):</p>
<pre><code><launch>
<!-- Launch SLAM GMapping -->
<include file="$(find lidar)/launch/slam_gmapping_pr2.launch" />
<!-- Launch your LiDAR driver -->
<include file="$(find lidar)/launch/X4.launch" />
<!-- Launch RViz with the desired configuration -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find lidar)/launch/mapping.rviz" />
</launch>
</code></pre>
<p>slam_gmapping_pr2.launch:</p>
<pre><code><launch>
<param name="use_sim_time" value="false"/>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<param name="base_frame" value="base_footprint"/>
<param name="odom_frame" value="odom" />
<remap from="scan" to="base_scan"/>
<param name="map_update_interval" value="3.0"/>
<param name="maxUrange" value="16.0"/>
<param name="sigma" value="0.05"/>
<param name="kernelSize" value="1"/>
<param name="lstep" value="0.05"/>
<param name="astep" value="0.05"/>
<param name="iterations" value="5"/>
<param name="lsigma" value="0.075"/>
<param name="ogain" value="3.0"/>
<param name="lskip" value="0"/>
<param name="srr" value="0.1"/>
<param name="srt" value="0.2"/>
<param name="str" value="0.1"/>
<param name="stt" value="0.2"/>
<param name="linearUpdate" value="1.0"/>
<param name="angularUpdate" value="0.5"/>
<param name="temporalUpdate" value="3.0"/>
<param name="resampleThreshold" value="0.5"/>
<param name="particles" value="30"/>
<param name="xmin" value="-50.0"/>
<param name="ymin" value="-50.0"/>
<param name="xmax" value="50.0"/>
<param name="ymax" value="50.0"/>
<param name="delta" value="0.05"/>
<param name="llsamplerange" value="0.01"/>
<param name="llsamplestep" value="0.01"/>
<param name="lasamplerange" value="0.005"/>
<param name="lasamplestep" value="0.005"/>
</node>
<node pkg="map_server" type="map_server" name="map_server" args="$(find lidar)/launch/map.yaml" />
<node pkg="tf" type="static_transform_publisher" name="map_to_odom"
args="0 0 0 0 0 0 /map /odom 100" />
<node pkg="tf" type="static_transform_publisher" name="base_footprint_to_map" args="0 0 0 0 0 0 /base_footprint /map 100" />
<node pkg="tf" type="static_transform_publisher" name="laser_frame_to_map" args="0 0 0 0 0 0 /laser_frame /map 100" />
<node pkg="tf" type="static_transform_publisher" name="base_footprint_to_odom"
args="0 0 0 0 0 0 /base_footprint /odom 100" />
</launch>
</code></pre>
<p>X4.launch:</p>
<pre><code><launch>
<node name="ydlidar_lidar_publisher" pkg="ydlidar_ros_driver" type="ydlidar_ros_driver_node" output="screen" respawn="false" >
<!-- string property -->
<param name="port" type="string" value="/dev/ydlidar"/>
<param name="frame_id" type="string" value="map"/>
<param name="ignore_array" type="string" value=""/>
<!-- int property -->
<param name="baudrate" type="int" value="128000"/>
<!-- 0:TYPE_TOF, 1:TYPE_TRIANGLE, 2:TYPE_TOF_NET -->
<param name="lidar_type" type="int" value="1"/>
<!-- 0:YDLIDAR_TYPE_SERIAL, 1:YDLIDAR_TYPE_TCP -->
<param name="device_type" type="int" value="0"/>
<param name="sample_rate" type="int" value="5"/>
<param name="abnormal_check_count" type="int" value="4"/>
<!-- bool property -->
<param name="resolution_fixed" type="bool" value="true"/>
<param name="auto_reconnect" type="bool" value="true"/>
<param name="reversion" type="bool" value="false"/>
<param name="inverted" type="bool" value="true"/>
<param name="isSingleChannel" type="bool" value="false"/>
<param name="intensity" type="bool" value="false"/>
<param name="support_motor_dtr" type="bool" value="true"/>
<param name="invalid_range_is_inf" type="bool" value="false"/>
<param name="point_cloud_preservative" type="bool" value="false"/>
<!-- float property -->
<param name="angle_min" type="double" value="-180" />
<param name="angle_max" type="double" value="180" />
<param name="range_min" type="double" value="0.1" />
<param name="range_max" type="double" value="12.0" />
<!-- frequency is invalid, External PWM control speed -->
<param name="frequency" type="double" value="10.0"/>
</node>
<node pkg="tf" type="static_transform_publisher" name="base_footprint_to_laser_frame"
args="0.0 0.0 0.0 0.0 0.0 0.0 /base_footprint /laser_frame 40" />
</launch>
</code></pre>
<p>mapping.rviz:</p>
<pre><code>Panels:
- Class: rviz/Displays
Help Height: 70
Name: Displays
Property Tree Widget:
Expanded: ~
Splitter Ratio: 0.5
Tree Height: 454
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.699999988079071
Class: rviz/Map
Color Scheme: map
Draw Behind: false
Enabled: true
Name: Map
Topic: /map
Unreliable: false
Use Timestamp: false
Value: true
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/TF
Enabled: true
Filter (blacklist): ""
Filter (whitelist): ""
Frame Timeout: 15
Frames:
All Enabled: true
base_footprint:
Value: true
laser_frame:
Value: true
map:
Value: true
odom:
Value: true
Marker Alpha: 1
Marker Scale: 1
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
base_footprint:
laser_frame:
{}
map:
odom:
{}
base_footprint:
map:
{}
laser_frame:
map:
{}
Update Interval: 0
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: map
Frame Rate: 30
Name: root
Tools:
- Class: rviz/MoveCamera
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 14.28176212310791
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.6503981351852417
Target Frame: <Fixed Frame>
Yaw: 1.3453978300094604
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 678
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000100000000000001560000024afc0200000001fb000000100044006900730070006c006100790073010000003e0000024a000000ca00ffffff000002c30000024a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Width: 1055
X: 50
Y: 50
</code></pre>
<p>map.yaml:</p>
<pre><code>image: map.pgm
resolution: 0.05
origin: [0.0, 0.0, 0.0]
negate: 0
occupied_thresh: 0.5
free_thresh: 0.1
</code></pre>
<p>And I created map.pgm by writing</p>
<pre><code>P2
400 400
255
</code></pre>
<p>in a text file.
Please someone help me.</p>
| Map not being displayed in Rviz (from LiDAR data) |
<p>If you don't have to use I2C, why don't you try Serial?
Here seems to be an example of an interface that can communicate serially with Ros2.</p>
<p><a href="https://github.com/AnrdyShmrdy/ros2_serial_interface" rel="nofollow noreferrer">https://github.com/AnrdyShmrdy/ros2_serial_interface</a></p>
| 110061 | 2024-03-19T06:39:44.803 | |ros2|arduino| | <p>I am using Arduino Mega.</p>
<p>I wanted to configure it to create a ros2 topic using the ros2arduino header.</p>
<p>However, I found out that the header cannot be used because it can only be supported from 32bit or higher</p>
<p>In this case, what idea can you recommend?</p>
<p>Currently, the board is connected to I2C communication, and it seems that the main board will also be connected to Arduino through I2C communication.
(Currently, I am connecting from Ubuntu installed on my PC for testing purposes.)</p>
<p>Thank you so much for reading.</p>
| What is the alternative to a <ros2arduino.h> |
<p>Yes you can process multiple msgs coming on the same topic in multiple threads and you do not need to handle thread spinning, it can be done using <code>callback group</code> and <code>executor</code> functionalities of ros2. To achieve this you can follow these steps</p>
<ul>
<li>Define a <a href="https://docs.ros.org/en/foxy/Concepts/About-Executors.html#callback-groups:%7E:text=The-,Multi%2DThreaded%20Executor,-creates%20a%20configurable" rel="nofollow noreferrer">multithreaded executor</a> in your main function</li>
</ul>
<blockquote>
<p><code>rclcpp::executors::MultiThreadedExecutor executor;</code></p>
</blockquote>
<ul>
<li>Add your node to this executor</li>
</ul>
<blockquote>
<p><code>executor->add_node(node);</code></p>
</blockquote>
<ul>
<li>Now inside your node define a reentrant callback group (this allows parallel execution) and give this callback group in your topic subscription
<ul>
<li><code>my_callback_group = create_callback_group(rclcpp::CallbackGroupType::Reentrant);</code></li>
<li><code>rclcpp::SubscriptionOptions options;</code></li>
<li><code>options.callback_group = my_callback_group;</code></li>
<li><code>my_subscription = create_subscription<type>("/topic",rclcpp::SensorDataQoS(),callback, options);</code></li>
</ul>
</li>
</ul>
<p>This should work for your use case. For further understanding check out the <a href="https://docs.ros.org/en/foxy/Concepts/About-Executors.html#callback-groups" rel="nofollow noreferrer">executor</a> concept on ros 2 wiki.</p>
| 110067 | 2024-03-19T09:05:15.230 | |ros|ros2|ros-humble| | <p>I have a camera_node publishing image to processer_node, images are published faster than they are processed.</p>
<p>When a new image appears in my image queue but the previous image is still processing, split a thread to bind a callback function to process the new image.</p>
<p>Is there any way to this?</p>
| How to executing a callback function with multiple threads in ROS2 |
<p>Make sure the Urdf file is a Xacro file and then add the Camera to the Robot Xacro file</p>
| 110075 | 2024-03-19T15:07:57.673 | |ros-humble|cameras|moveit2| | <p>Can anyone assist me in integrating the Zed2 Camera with my robot's URDF? Additionally, I aim to generate a Moveit2 configuration for my robot after integrating the camera. Could you please review the URDF code below? I am facing an error when trying to set up Moveit2 for my robot</p>
<pre><code>
<!-- Add one ZED Camera -->
<xacro:arg name="camera_name" default="zed" />
<xacro:arg name="camera_model" default="zed" />
<xacro:include filename="<span class="math-container">$(find zed_wrapper)/urdf/zed_macro.urdf.xacro" />
<xacro:zed_camera name="$</span>(arg camera_name)" model="<span class="math-container">$(arg camera_model)">
</xacro:zed_camera>
<joint name="$</span>(arg camera_name)_joint" type="fixed">
<origin xyz="0.12 0.0 0.25" rpy="0 0 0"/>
<parent link="panda_link0"/>
<child link="$(arg camera_name)_camera_link"/>
</joint>
</robot>
<span class="math-container">```</span>
</code></pre>
| ros2 humble integration with Zed2 Camera |
<p>Yes, each planner, controller, smoother, etc servers can load and use multiple plugins in their own unique context by sending which you'd like to use in your requests. This can be done using the behavior tree XML by having algorithm selector BT nodes, hardcoded values for algorithms to use in certain tree contexts, or other less trivial solutions to choose the right algorithm to use when you like. You can also call those servers directly from another executive / script and select them as well (i.e. not tied to the BT, but the BT is a good option that's well supported).</p>
<p>I don't believe you can run multiple in parallel, mostly because the way we launch the system is using single threaded executors that can only process one callback at a time. That is not an insurmountable barrier to adjust, but there may be other subtle details since the task servers were not designed to process multiple, parallel threads sharing state. I also don't think its an insurmountable problem, but care would need to be taken to review the servers that you want to run in parallel and make sure any global state that could change between requests is moved and stored into the callback's scope so that it doesn't mess with other parallel requests. It would probably be trivial, but I haven't reviewed those servers with this intention in mind.</p>
| 110095 | 2024-03-20T07:17:46.717 | |nav2| | <p>Is it feasible to load multiple planner plugins like NavFn and Smac planner into nav2 and utilize them in various scenarios? If so, what steps are involved in achieving this?</p>
| can Nav2 load multiple planners and controllers; Can the executive choose the appropriate one, or can he run many things in parallel? |
<p>You can use tools like <code>check_urdf test.urdf</code> or <code>gz sdf -p test.urdf > test.sdf</code> to analyze your URDF. You'll see that the SDF which will be used by gazebo classic does not have any links: The inertia tag of base_link is missing.</p>
| 110116 | 2024-03-20T20:07:09.153 | |ros-humble|ros2-control|gazebo-ros2-control| | <p>Following along with the ros2_control demonstration from ROSCon 2022, I am attempting to run <a href="https://github.com/ros-controls/roscon2022_workshop/tree/5-simulation" rel="nofollow noreferrer">step 5, simulation in Gazebo</a>. The system successfully responds to Joint Trajectory commands, both through publishing a goal to the action server, as well as using the <a href="https://index.ros.org/p/rqt_joint_trajectory_controller/" rel="nofollow noreferrer">rqt_joint_trajectory_controller package</a>, but the system does not seem to be operational for Gazebo. However, I have gotten the <a href="https://github.com/ros-controls/roscon2022_workshop/tree/master" rel="nofollow noreferrer">ROSCon 2022 Controlko robot package</a> to successfully load its model in Gazebo, so the issue appears to be with my URDF.</p>
<p>Launching Gazebo Classic is done with the following command:</p>
<pre><code>ros2 launch linear_slider_bringup linear_slider_sim_gazebo.launch.py sim_gazebo_classic:=true
</code></pre>
<p>I receive the following feedback after launch:</p>
<pre><code>[INFO] [robot_state_publisher-1]: process started with pid [84675]
[INFO] [gzserver-2]: process started with pid [84677]
[INFO] [gzclient-3]: process started with pid [84679]
[INFO] [spawn_entity.py-4]: process started with pid [84681]
[robot_state_publisher-1] [INFO] [1710962513.742943224] [robot_state_publisher]: got segment base
[robot_state_publisher-1] [INFO] [1710962513.743020949] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1710962513.743025336] [robot_state_publisher]: got segment flange
[robot_state_publisher-1] [INFO] [1710962513.743027819] [robot_state_publisher]: got segment moving_base
[robot_state_publisher-1] [INFO] [1710962513.743030104] [robot_state_publisher]: got segment tool0
[robot_state_publisher-1] [INFO] [1710962513.743032301] [robot_state_publisher]: got segment world
[spawn_entity.py-4] [INFO] [1710962513.982791564] [spawn_linear_slider]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1710962513.982982280] [spawn_linear_slider]: Loading entity published on topic robot_description
[spawn_entity.py-4] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-4] warnings.warn(
[spawn_entity.py-4] [INFO] [1710962513.984899469] [spawn_linear_slider]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1710962514.111381248] [spawn_linear_slider]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1710962514.111706169] [spawn_linear_slider]: Waiting for service /spawn_entity
[spawn_entity.py-4] [INFO] [1710962514.618182119] [spawn_linear_slider]: Calling service /spawn_entity
[spawn_entity.py-4] [INFO] [1710962514.801764666] [spawn_linear_slider]: Spawn status: SpawnEntity: Successfully spawned entity [linear_slider]
[gzserver-2] [INFO] [1710962514.816576069] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-2] [INFO] [1710962514.817868509] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
[gzserver-2] [INFO] [1710962514.817971930] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-2] [INFO] [1710962514.818000582] [gazebo_ros2_control]: Loading parameter files /home/user/ros2_ws/install/linear_slider_bringup/share/linear_slider_bringup/config/linear_slider_controllers.yaml
[gzserver-2] [INFO] [1710962514.819166614] [gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-2] [INFO] [1710962514.819530996] [gazebo_ros2_control]: Received urdf from param server, parsing...
[gzserver-2] [WARN] [1710962514.824922049] [gazebo_ros2_control]: Skipping joint in the URDF named 'joint1' which is not in the gazebo model.
[gzserver-2] [WARN] [1710962514.824944559] [gazebo_ros2_control]: Skipping sensor in the URDF named 'lim_switch_neg' which is not in the gazebo model.
[gzserver-2] [WARN] [1710962514.824972376] [gazebo_ros2_control]: Skipping sensor in the URDF named 'lim_switch_pos' which is not in the gazebo model.
[gzserver-2] [INFO] [1710962514.824985514] [resource_manager]: Initialize hardware 'linear_slider_ros2_control'
[gzserver-2] [INFO] [1710962514.825043669] [resource_manager]: Successful initialization of hardware 'linear_slider_ros2_control'
[gzserver-2] [INFO] [1710962514.825076663] [resource_manager]: 'configure' hardware 'linear_slider_ros2_control'
[gzserver-2] [INFO] [1710962514.825081268] [resource_manager]: Successful 'configure' of hardware 'linear_slider_ros2_control'
[gzserver-2] [INFO] [1710962514.825083439] [resource_manager]: 'activate' hardware 'linear_slider_ros2_control'
[gzserver-2] [INFO] [1710962514.825086273] [resource_manager]: Successful 'activate' of hardware 'linear_slider_ros2_control'
[gzserver-2] [INFO] [1710962514.825118472] [gazebo_ros2_control]: Loading controller_manager
[gzserver-2] [WARN] [1710962514.834426588] [gazebo_ros2_control]: Desired controller update period (0.01 s) is slower than the gazebo simulation period (0.001 s).
[gzserver-2] [INFO] [1710962514.834576721] [gazebo_ros2_control]: Loaded gazebo_ros2_control.
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 84681]
[INFO] [spawner-5]: process started with pid [84822]
[gzserver-2] [INFO] [1710962515.659723466] [controller_manager]: Loading controller 'joint_state_broadcaster'
[spawner-5] [INFO] [1710962515.676665510] [spawner_joint_state_broadcaster]: Loaded joint_state_broadcaster
[gzserver-2] [INFO] [1710962515.677689805] [controller_manager]: Configuring controller 'joint_state_broadcaster'
[gzserver-2] [INFO] [1710962515.677986019] [joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
[gzserver-2] [ERROR] [1710962515.705082392] [joint_state_broadcaster]: None of requested interfaces exist. Controller will not run.
[gzserver-2] [WARN] [1710962515.705154140] [joint_state_broadcaster]: Error occurred while doing error handling.
[gzserver-2] [ERROR] [1710962515.705205212] [controller_manager]: After activation, controller 'joint_state_broadcaster' is in state 'unconfigured' (1), expected 'active' (3).
[spawner-5] [INFO] [1710962515.715562559] [spawner_joint_state_broadcaster]: Configured and activated joint_state_broadcaster
[INFO] [spawner-5]: process has finished cleanly [pid 84822]
[INFO] [rviz2-6]: process started with pid [84938]
[rviz2-6] Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[rviz2-6] [INFO] [1710962516.049478468] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-6] [INFO] [1710962516.049587327] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[rviz2-6] [INFO] [1710962516.065913352] [rviz2]: Stereo is NOT SUPPORTED
[gzserver-2] [INFO] [1710963128.379637264] [controller_manager]: Loading controller 'joint_trajectory_controller'
[spawner-6] [INFO] [1710963128.402799383] [spawner_joint_trajectory_controller]: Loaded joint_trajectory_controller
[gzserver-2] [INFO] [1710963128.484252881] [controller_manager]: Configuring controller 'joint_trajectory_controller'
[gzserver-2] [INFO] [1710963128.484424061] [joint_trajectory_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
[gzserver-2] [INFO] [1710963128.484455242] [joint_trajectory_controller]: Command interfaces are [position] and state interfaces are [position].
[gzserver-2] [INFO] [1710963128.484473404] [joint_trajectory_controller]: Using 'splines' interpolation method.
[gzserver-2] [INFO] [1710963128.485896343] [joint_trajectory_controller]: Controller state will be published at 50.00 Hz.
[gzserver-2] [INFO] [1710963128.487285184] [joint_trajectory_controller]: Action status changes will be monitored at 21.00 Hz.
[gzserver-2] [ERROR] [1710963128.503798555] [resource_manager]: Not acceptable command interfaces combination:
[gzserver-2] Start interfaces:
[gzserver-2] [
[gzserver-2] joint1/position
[gzserver-2] ]
[gzserver-2] Stop interfaces:
[gzserver-2] [
[gzserver-2] ]
[gzserver-2] Not existing:
[gzserver-2] [
[gzserver-2] joint1/position
[gzserver-2] ]
[gzserver-2]
[gzserver-2] [ERROR] [1710963128.503825172] [controller_manager]: Could not switch controllers since prepare command mode switch was rejected.
[spawner-6] [ERROR] [1710963128.504372440] [spawner_joint_trajectory_controller]: Failed to activate controller
[ERROR] [spawner-6]: process has died [pid 91644, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_trajectory_controller -c /controller_manager --ros-args']
</code></pre>
<p>Most notable is the following line: <code>[gzserver-2] [WARN] [1710962514.824922049] [gazebo_ros2_control]: Skipping joint in the URDF named 'joint1' which is not in the gazebo model.</code> I am assuming this is the reason why the JointStateBroadcaster and the JointTrajectoryController are not able to load. However, I am confused as to why Gazebo does not like my URDF. The fully-formed URDF that is generated at launch time is as follows:</p>
<pre><code><robot name="linear_slider">
<!-- World link -->
<link name="world"/>
<!-- ================== -->
<!-- Properties -->
<!-- ================== -->
<!-- ================== -->
<!-- Materials -->
<!-- ================== -->
<material name="alpha_black">
<color rgba="0.6 0.6 0.6 1"/>
</material>
<material name="red_v">
<color rgba="1 0 0 1"/>
</material>
<!-- ================== -->
<!-- Links -->
<!-- ================== -->
<!-- base_link -->
<link name="base_link">
<visual>
<material name="alpha_black"/>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
<geometry>
<mesh filename="package://linear_slider_description/meshes/7thlink_fixed.STL" scale="0.001 0.001 0.001"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="1.0 0.3 0.10"/>
</geometry>
</collision>
</link>
<gazebo reference="base_link">
<material>Gazebo/Gray</material>
</gazebo>
<!-- moving_base link -->
<link name="moving_base">
<visual>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
<material name="red_v"/>
<geometry>
<mesh filename="package://linear_slider_description/meshes/7thlink_move.STL" scale="0.001 0.001 0.001"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="0.22 0.202 0.118"/>
</geometry>
</collision>
<inertial>
<mass value="10.0"/>
<origin xyz="0.0 0.0 0.0"/>
<inertia ixx="0.0915" ixy="0.0" ixz="0.0" iyy="0.975" iyz="0.0" izz="0.9915"/>
</inertial>
</link>
<gazebo reference="moving_base">
<material>Gazebo/Red</material>
</gazebo>
<!-- tool link -->
<link name="tool0"/>
<link name="base"/>
<!-- Frame for mounting EEF models to a manipulator. x+ axis points forward (REP 103). -->
<link name="flange"/>
<!-- ================== -->
<!-- Joints -->
<!-- ================== -->
<!-- base_joint fixes base_link to the environment -->
<joint name="base_joint" type="fixed">
<parent link="world"/>
<child link="base_link"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
</joint>
<!-- joint1 -->
<joint name="joint1" type="prismatic">
<parent link="base_link"/>
<child link="moving_base"/>
<axis xyz="1 0 0"/>
<limit effort="10" lower="-0.4" upper="0.4" velocity="0.25"/>
<!-- effort is attribute for enforcing maximum joint effort, between 0 and 100% -->
<origin xyz="0.0 0.0 0.0"/>
<!-- Define where the joint will be located, defined in terms of parent's reference frame -->
</joint>
<!-- Extra joints for ros-industrial standard compatability -->
<!-- tool frame to fixed frame -->
<joint name="moving_base-tool0" type="fixed">
<parent link="moving_base"/>
<child link="tool0"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
</joint>
<joint name="base_link-base_joint" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base_link"/>
<child link="base"/>
</joint>
<joint name="tool0-flange_joint" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="tool0"/>
<child link="flange"/>
</joint>
<!-- The caret ^ indicates to use the outer-scope property (with same name). The pipe | indicates to use the given fallback if the property is not defined in outer scope. -->
<!-- ================== -->
<!-- ros2_control -->
<!-- ================== -->
<ros2_control name="linear_slider_ros2_control" type="system">
<!-- Hardware -->
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
</hardware>
<!-- Joints -->
<joint name="joint1">
<!-- Command interface -->
<command_interface name="position">
<param name="min">-0.40</param>
<param name="max">0.40</param>
</command_interface>
<!-- State interface -->
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<!-- Sensors -->
<sensor name="lim_switch_neg">
<state_interface name="switch_val">
<param name="initial_value">0</param>
</state_interface>
<param name="frame_id">base_link</param>
</sensor>
<sensor name="lim_switch_pos">
<state_interface name="switch_val">
<param name="initial_value">0</param>
</state_interface>
<param name="frame_id">base_link</param>
</sensor>
</ros2_control>
<!-- ================== -->
<!-- Gazebo Classic -->
<!-- ================== -->
<gazebo reference="world"/>
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<robot_param>robot_description</robot_param>
<robot_param_node>robot_state_publisher</robot_param_node>
<parameters>/home/user/ros2_ws/install/linear_slider_bringup/share/linear_slider_bringup/config/linear_slider_controllers.yaml</parameters>
</plugin>
</gazebo>
</robot>
</code></pre>
<p>Several other users with similar errors to mine didn't appear to have mass and intertia tags present in their links, but I have defined them appropriately. For more context, I have included my launch file:</p>
<pre><code>#!/usr/bin/env python3
from launch import LaunchDescription
from launch.actions import (
DeclareLaunchArgument,
IncludeLaunchDescription,
RegisterEventHandler,
TimerAction,
LogInfo,
)
from launch.conditions import IfCondition
from launch.event_handlers import OnProcessExit, OnProcessStart
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import (
LaunchConfiguration,
PathJoinSubstitution,
PythonExpression,
Command,
FindExecutable,
)
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
declared_args = []
declared_args.append(
DeclareLaunchArgument(
"runtime_config_package",
default_value = "linear_slider_bringup",
description = 'Package with the controller\'s configuration in the "config" folder. Usually, the argument is not set; it enables the use of a custom setup.'
)
)
declared_args.append(
DeclareLaunchArgument(
"controllers_file",
default_value = "linear_slider_controllers.yaml",
description = "YAML file with the controllers description."
)
)
declared_args.append(
DeclareLaunchArgument(
"description_package",
default_value = "linear_slider_description",
description = "Description package with the robot URDF/xacro files. Usually, the argument is not sset; it enables the use of a custom setup."
)
)
declared_args.append(
DeclareLaunchArgument(
"description_file",
default_value = "linear_slider.urdf.xacro",
description = "URDF/xacro description file of the robot."
)
)
declared_args.append(
DeclareLaunchArgument(
"prefix",
default_value = '""',
description = "Prefix of the joint names, useful for multi-robot setup. If changed, then you need to update the joint names in the controllers' description."
)
)
declared_args.append(
DeclareLaunchArgument(
"use_mock_hardware",
default_value = "false",
choices=['true', 'false'],
description = "Start robot with fake hardware mirroring command to its states."
)
)
declared_args.append(
DeclareLaunchArgument(
"mock_sensor_commands",
default_value = "false",
description = "Enable fake command interfaces for sensors for simple simulation. Use only if `use_mock_hardware` parameter is true."
)
)
declared_args.append(
DeclareLaunchArgument(
"robot_controller",
default_value = "joint_trajectory_controller",
choices = ["velocity_controller", "joint_trajectory_controller"], # add another here if we want to switch between different controllers
description = "Robot controller"
)
)
declared_args.append(
DeclareLaunchArgument(
"sim_gazebo",
default_value="false",
description="Simulate within the Gazebo Ignition environment"
)
)
declared_args.append(
DeclareLaunchArgument(
"sim_gazebo_classic",
default_value="false",
description="Simulate within the Gazebo Classic environment."
)
)
# Initialize args
runtime_config_package = LaunchConfiguration("runtime_config_package")
controllers_file = LaunchConfiguration("controllers_file")
description_package = LaunchConfiguration("description_package")
description_file = LaunchConfiguration("description_file")
prefix = LaunchConfiguration("prefix")
robot_controller = LaunchConfiguration("robot_controller")
use_mock_hardware = LaunchConfiguration("use_mock_hardware")
mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
sim_gazebo = LaunchConfiguration("sim_gazebo")
sim_gazebo_classic = LaunchConfiguration("sim_gazebo_classic")
# Get URDF from xacro
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[FindPackageShare(description_package), "urdf", description_file]
),
" ",
"prefix:=",
prefix,
" ",
"use_mock_hardware:=",
use_mock_hardware,
" ",
"mock_sensor_commands:=",
mock_sensor_commands,
" ",
"sim_gazebo:=",
sim_gazebo,
" ",
"sim_gazebo_classic:=",
sim_gazebo_classic,
" ",
]
)
robot_description = {"robot_description": robot_description_content}
_log0 = LogInfo(msg=robot_description_content)
_log1 = LogInfo(msg=sim_gazebo)
_log2 = LogInfo(msg=sim_gazebo_classic)
robot_state_pub_node = Node(
package = "robot_state_publisher",
executable = "robot_state_publisher",
output = "both",
parameters = [robot_description],
)
joint_state_broadcaster_spawner = Node(
package = "controller_manager",
executable = "spawner",
arguments = [
"joint_state_broadcaster",
"-c",
"/controller_manager",
],
)
robot_controllers = [robot_controller]
robot_controller_spawners = []
for controller in robot_controllers:
robot_controller_spawners.append(
Node(
package = "controller_manager",
executable = "spawner",
arguments = [controller, "-c", "/controller_manager"],
)
)
gazebo_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
FindPackageShare("ros_ign_gazebo"),
"/launch",
"/ign_gazebo.launch.py"
]),
launch_arguments={"ign_args": " -r -v 3 empty.sdf"}.items(),
condition=IfCondition(sim_gazebo)
)
gazebo_classic_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
FindPackageShare("gazebo_ros"),
"/launch",
"/gazebo.launch.py"
]),
condition=IfCondition(sim_gazebo_classic)
)
gazebo_node_spawner = Node(
package="ros_ign_gazebo", #"ros_gz_sim"
executable="create",
name="spawn_linear_slider",
arguments=["-name", "linear_slider", "-topic", "robot_description"],
condition=IfCondition(sim_gazebo),
output="screen"
)
gazebo_classic_node_spawner = Node(
package="gazebo_ros",
executable="spawn_entity.py",
name="spawn_linear_slider",
arguments=["-entity", "linear_slider", "-topic", "robot_description"],
condition=IfCondition(sim_gazebo_classic),
output="screen"
)
rviz_config_file = PathJoinSubstitution([
FindPackageShare(description_package),
"rviz",
"linear_slider.rviz"
])
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
arguments=["-d", rviz_config_file],
)
delay_joint_state_broadcaster_spawner_after_gazebo_spawner = RegisterEventHandler(
event_handler=OnProcessStart(
target_action=gazebo_node_spawner,
on_start=[joint_state_broadcaster_spawner],
),
condition=IfCondition(sim_gazebo)
)
delay_joint_state_broadcaster_spawner_after_gazebo_classic_spawner = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=gazebo_classic_node_spawner,
on_exit=[joint_state_broadcaster_spawner],
),
condition=IfCondition(sim_gazebo_classic)
)
delay_rviz_after_joint_state_broadcaster = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=joint_state_broadcaster_spawner,
on_exit=[rviz_node],
)
)
delay_robot_controller_spawners_after_joint_state_broadcaster_spawner = []
for controller in robot_controller_spawners:
delay_robot_controller_spawners_after_joint_state_broadcaster_spawner += [
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=joint_state_broadcaster_spawner,
on_exit=[controller]
)
)
]
return LaunchDescription(
declared_args
+ [
_log0,
_log1,
_log2,
robot_state_pub_node,
gazebo_launch,
gazebo_classic_launch,
gazebo_node_spawner,
gazebo_classic_node_spawner,
delay_joint_state_broadcaster_spawner_after_gazebo_classic_spawner,
delay_joint_state_broadcaster_spawner_after_gazebo_spawner,
delay_rviz_after_joint_state_broadcaster
]
+ delay_robot_controller_spawners_after_joint_state_broadcaster_spawner
)
</code></pre>
<p>Finally, here is my <code>linear_slider_controllers.yaml</code> file:</p>
<pre><code>controller_manager:
ros__parameters:
update_rate: 100 # hz
joint_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
joint_trajectory_controller:
ros__parameters:
joints:
- joint1
command_interfaces:
- position
state_interfaces:
- position
state_publish_rate: 50.0 # defaults to 50
action_monitor_rate: 21.0 # defaults to 20
allow_partial_joints_goal: false # defaults to false
constraints:
stopped_velocity_tolerance: 0.01 # Defaults to 0.01
goal_time: 0.0 # defaults to 0.0 (start immediately)
allow_nonzero_velocity_at_trajectory_end: false
</code></pre>
<p>I do not know how to make my URDF compatible with Gazebo Classic. I know there are more Gazebo tags, but they do not appear to be mandatory.</p>
| gazebo_ros2_control does not load joints or sensors from URDF |
<p>That's a pretty good approach. RPP is also a constant speed controller that sets the linear velocity as constant and computes the appropriate angular velocity to track the path. The "Regulated" in that approach's name includes some heuristics to adjust that velocity, but you can disable them all if you want to charge forward at full speed all the time, all other constraints be damned. It might overshoot some turns by the nature of RPP like that if your robot isn't highly dynamic and while driving fast, where as DWB/MPPI might be better.</p>
<p>Something like MPPI/DWB where you can remove other constraints and highly weight that also seem like logical choices, assuming you wanted to also have other controls than just max speed.</p>
| 110121 | 2024-03-20T21:59:21.343 | |ros2|control|nav2| | <p>I need to follow a given global path with a certain speed. For now, my plan would have been to use the MPPI controller in NAV2 with a custom critic for speed.</p>
<p>Is this a good approach? Are there other simpler solutions?</p>
| Which NAV2 controller for following a given path with a certain speed? |
<p>My solution to this question is slightly different to the solutions I proposed in my question. Instead of creating a new <code>RotorVelocitiesComponent.hh</code> component to store the rotor velocity values, I modified the <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.hh" rel="nofollow noreferrer"><code>MulticopterVelocityControl.hh</code></a> and <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.cc" rel="nofollow noreferrer"><code>MulticopterVelocityControl.cc</code></a> files to advertise the rotor velocity data through a Gazebo topic.</p>
<h2>Method</h2>
<p>I copied the plugin source files into my package, similar to how it is done in Gazebo's <a href="https://github.com/gazebosim/ros_gz_project_template" rel="nofollow noreferrer"><code>ros_gz_project_template</code></a>. My <code>src</code> directory now looks something like this.</p>
<pre><code>src
βββ ros_gz
βββ sdformat_urdf
βββ my_package_application
βββ my_package_bringup
βββ my_package_description
β βββ CMakeLists.txt
β βββ hooks
β βββ include
β β βββ my_package_description
β β βββ Common.hh
β β βββ LeeVelocityController.hh
β β βββ MulticopterVelocityControl.hh
β β βββ Parameters.hh
β βββ models
β β βββquadcopter
β β βββ model.config
β β βββ model.sdf
β βββ package.xml
β βββ src
β βββ Common.cc
β βββ LeeVelocityController.cc
β βββ MulticopterVelocityControl.cc
βββ my_package_gazebo
</code></pre>
<p>The next step is to change the package <code>CMakeLists.txt</code> file to build the plugin correctly.</p>
<pre><code>cmake_minimum_required(VERSION 3.8)
project(my_package_description)
# other ROS 2 CMakeLists.txt template code
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(Eigen3 REQUIRED)
# find the needed plugin dependencies
find_package(gz-cmake3 REQUIRED)
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER <span class="math-container">${gz-plugin2_VERSION_MAJOR})
find_package(gz-common5 REQUIRED COMPONENTS profiler)
set(GZ_COMMON_VER $</span>{gz-common5_VERSION_MAJOR})
find_package(gz-transport12 REQUIRED)
set(GZ_TRANSPORT_VER <span class="math-container">${gz-transport12_VERSION_MAJOR})
find_package(gz-msgs9 REQUIRED)
set(GZ_MSGS_VER $</span>{gz-msgs9_VERSION_MAJOR})
# set the right variables for gazebo garden
find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
message(STATUS "Compiling against Gazebo Garden")
# define a library target named 'MyModifiedPlugin'.
add_library(MyModifiedPlugin
SHARED
src/MulticopterVelocityControl.cc
src/Common.cc
src/LeeVelocityController.cc
)
# specify 'include' as the include directory for compiling
# the 'MyModifiedPlugin' target.
target_include_directories(
MyModifiedPlugin PRIVATE include
)
# specify the gazebo libraries needed when linking the 'MyModifiedPlugin' target.
target_link_libraries(MyModifiedPlugin PRIVATE
gz-transport<span class="math-container">${GZ_TRANSPORT_VER}::gz-transport$</span>{GZ_TRANSPORT_VER}
gz-msgs<span class="math-container">${GZ_MSGS_VER}::gz-msgs$</span>{GZ_MSGS_VER}
gz-plugin<span class="math-container">${GZ_PLUGIN_VER}::gz-plugin$</span>{GZ_PLUGIN_VER}
gz-common<span class="math-container">${GZ_COMMON_VER}::gz-common$</span>{GZ_COMMON_VER}
gz-sim<span class="math-container">${GZ_SIM_VER}::gz-sim$</span>{GZ_SIM_VER}
Eigen3::Eigen
)
# copy the compiled libraries of 'MyModifiedPlugin' targets to the
# subfolder 'lib/my_package_description' of the install directory.
install(TARGETS MyModifiedPlugin
DESTINATION lib/${PROJECT_NAME}
)
# other ROS 2 CMakeLists.txt template code
# any other custom CMakeLists.txt code
# I also use hooks to guide gazebo concerning where to look
# for resources and plugins
ament_package()
</code></pre>
<p>Now it's just a matter of correctly modifying the pre-existing plugin source files and correctly using the plugin in the <code>model.sdf</code> file.</p>
<p>Make sure to change any file inclusion directives to specify the correct locations of the header files. An example for this case would be changing the following inclusion directives</p>
<pre class="lang-cpp prettyprint-override"><code>#include "Common.hh"
#include "LeeVelocityController.hh"
#include "MulticopterVelocityControl.hh"
#include "Parameters.hh"
</code></pre>
<p>to the following inclusion directives.</p>
<pre class="lang-cpp prettyprint-override"><code>#include "my_package_description/Common.hh"
#include "my_package_description/LeeVelocityController.hh"
#include "my_package_description/MulticopterVelocityControl.hh"
#include "my_package_description/Parameters.hh"
</code></pre>
<p>The majority of plugin modifications were done in the <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.hh" rel="nofollow noreferrer"><code>MulticopterVelocityControl.hh</code></a> and <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.cc" rel="nofollow noreferrer"><code>MulticopterVelocityControl.cc</code></a> files. Useful inclusion directives were added to the <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.hh" rel="nofollow noreferrer"><code>MulticopterVelocityControl.hh</code></a>.</p>
<pre class="lang-cpp prettyprint-override"><code>// Pre-existing `MulticopterVelocityControl.hh` inclusion directives
#include <string>
// New msg header for rotor velocity variables
#include <gz/msgs/float_v.pb.h>
#include <gz/msgs/actuators.pb.h>
// Remaining pre-existing `MulticopterVelocityControl.hh` inclusion directives
</code></pre>
<p>Additional variables were added for the plugin modification.</p>
<pre class="lang-cpp prettyprint-override"><code>namespace gz
{
namespace sim
{
inline namespace GZ_SIM_VERSION_NAMESPACE
{
namespace systems
{
class MulticopterVelocityControl
: public System,
public ISystemConfigure,
public ISystemPreUpdate
{
// Pre-existing `MulticopterVelocityControl.hh` declarations
/// \brief Gazebo communication node.
private: transport::Node node;
/// \brief New topic for rotor velocities.
private: std::string rotorVelocityPubTopic{"rotor_velocities"};
/// \brief New rotor velocities publisher.
private: transport::Node::Publisher rotorVelocityPub;
/// \brief New variable that holds rotor velocities
/// computed by the controller to later be published.
private: gz::msgs::Float_V rotorVelocityPubMsg;
// Remaining pre-existing `MulticopterVelocityControl.hh` declarations
};
}
}
}
}
#endif
</code></pre>
<p>The rest of the changes were made in <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.cc" rel="nofollow noreferrer"><code>MulticopterVelocityControl.cc</code></a>. First, add new logic to the <code>MulticopterVelocityControl::Configure</code> method to initialise the topic advertiser.</p>
<pre class="lang-cpp prettyprint-override"><code>void MulticopterVelocityControl::Configure(const Entity &_entity,
const std::shared_ptr<const sdf::Element> &_sdf,
EntityComponentManager &_ecm,
EventManager & /*_eventMgr*/)
{
// Pre-existing Configure method logic
sdfClone->Get<std::string>("enableSubTopic",
this->enableSubTopic, this->enableSubTopic);
this->enableSubTopic = transport::TopicUtils::AsValidTopic(
this->enableSubTopic);
if (this->enableSubTopic.empty())
{
gzerr << "Invalid enable sub-topic." << std::endl;
return;
}
// New code for rotor velocity publisher topic name
sdfClone->Get<std::string>("rotorVelocityPubTopic",
this->rotorVelocityPubTopic, this->rotorVelocityPubTopic);
this->rotorVelocityPubTopic = transport::TopicUtils::AsValidTopic(
this->rotorVelocityPubTopic);
if (this->rotorVelocityPubTopic.empty())
{
gzerr << "Invalid rotor velocity pub-topic." << std::endl;
return;
} // New code ends here
// Pre-existing code to subscribe to actuator command messages
// New initialise the publisher for rotor velocities
std::string rotorVelocityTopic{this->robotNamespace + "/" + this->rotorVelocityPubTopic};
this->rotorVelocityPub = this->node.Advertise<gz::msgs::Float_V>(rotorVelocityTopic);
gzmsg << "MulticopterVelocityControl publishing Double messages on ["
<< rotorVelocityTopic << "]" << std::endl; // New code ends here
// Remaining pre-existing Configure method logic
this->initialized = true;
}
</code></pre>
<p>Finally, add additional logic to <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.cc" rel="nofollow noreferrer"><code>MulticopterVelocityControl.cc</code></a> to publish the rotor velocities. I chose to do this in the <code>MulticopterVelocityControl::PublishRotorVelocities</code> function to prevent the simulation from breaking as much as possible.</p>
<pre class="lang-cpp prettyprint-override"><code>void MulticopterVelocityControl::PublishRotorVelocities(
EntityComponentManager &_ecm,
const Eigen::VectorXd &_vels)
{
// Pre-existing PublishRotorVelocities method logic
// New code to clear previous data in the message
// to prepare for new rotor velocities
this->rotorVelocityPubMsg.clear_data();
for (int i = 0; i < this->rotorVelocities.size(); ++i)
{
// Pre-existing logic to set rotorVelocitiesMsg velocities
// New code to add each velocity value to the rotorVelocityPubMsg
this->rotorVelocityPubMsg.add_data(_vels(i));
}
// New code to publish rotor velocities using rotorVelocityPub publisher
this->rotorVelocityPub.Publish(this->rotorVelocityPubMsg);
// Remaining pre-existing PublishRotorVelocities method logic
}
</code></pre>
<p>The new plugin implementation can be done by directly specifying the plugin <code>.so</code> file location, similarly as described in one of the <a href="https://robotics.stackexchange.com/a/110132/40013">answers</a> to this question.</p>
<pre class="lang-xml prettyprint-override"><code><plugin
filename="libMyModifiedPlugin"
name="gz::sim::v7::systems::MulticopterVelocityControl">
</plugin>
</code></pre>
<p>Gazebo can also easily find the plugin in the <code>lib/my_package_description</code> folder if you use hook files to widen Gazebo's search. The hook files will need to be specified in <code>CMakeLists.txt</code>. You can also expand Gazebo's search by setting the GZ_SIM_SYSTEM_PLUGIN_PATH environment variable using the command.</p>
<pre><code>export GZ_SIM_SYSTEM_PLUGIN_PATH=${GZ_SIM_SYSTEM_PLUGIN_PATH}:<path-to-your-plugin-library>
</code></pre>
<p>So far the simulation has been running well, without breaking.</p>
| 110126 | 2024-03-20T23:47:02.963 | |gazebo|quadcopter|ros-humble|gazebo-plugin|gz-sim| | <h2>Question</h2>
<p>Is it possible to modify or extend a pre-existing Gazebo Sim (Garden) plugin, such as the <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/src/systems/multicopter_control" rel="nofollow noreferrer"><code>gz-sim-multicopter-control-system</code></a> plugin to publish the quadcopter rotor velocities as Gazebo topics? How can this be done?</p>
<h2>Summary</h2>
<p>I am using Gazebo Garden (<code>gz-sim7</code>) to simulate a quadcopter. I have implemented two of Gazebo's pre-existing plugins for the quadcopter model flight. The plugins are <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/src/systems/multicopter_control" rel="nofollow noreferrer"><code>gz-sim-multicopter-motor-model-system</code></a> and <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/src/systems/multicopter_motor_model" rel="nofollow noreferrer"><code>gz-sim-multicopter-control-system</code></a>, and their use in the <code>model.sdf</code> file is shown below. You can also find a more detailed version of the plugin implementation at <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/examples/worlds/multicopter_velocity_control.sdf" rel="nofollow noreferrer"><code>multicopter_velocity_control.sdf</code></a>.</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0"?>
<sdf version="1.8">
<model name="quadcopter">
<!-- The links of the quadcopter model -->
<!-- The links of the quadcopter model -->
<!-- Multicopter Motor Model plugin for each rotor -->
<!-- Rotor 0 -->
<plugin
filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<robotNamespace>quadcopter</robotNamespace>
<jointName>rotor_0_joint</jointName>
<linkName>rotor_0</linkName>
<!-- More Multicopter Motor Model plugin components -->
<commandSubTopic>gazebo/command/motor_speed</commandSubTopic>
<actuator_number>0</actuator_number>
<motorSpeedPubTopic>motor_speed/0</motorSpeedPubTopic>
<motorType>velocity</motorType>
</plugin>
<!-- Similarly define Rotor 1, Rotor 2 and Rotor 3 -->
<!-- Multicopter Control plugin -->
<plugin
filename="gz-sim-multicopter-control-system"
name="gz::sim::systems::MulticopterVelocityControl">
<robotNamespace>quadcopter</robotNamespace>
<comLinkName>base_link</comLinkName>
<commandSubTopic>gazebo/command/twist</commandSubTopic>
<enableSubTopic>enable</enableSubTopic>
<!-- More Multicopter Control plugin components -->
<rotorConfiguration>
<rotor>
<jointName>rotor_0_joint</jointName>
<!-- More Multicopter Control plugin rotor configuration components -->
</rotor>
<!-- Similarly configure Rotor 1, Rotor 2 and Rotor 3 -->
</rotorConfiguration>
</plugin>
</model>
</sdf>
</code></pre>
<p>Is it possible to publish the rotor velocities using Gazebo topics? If not, is it possible to modify or extend the functionalities of the pre-existing plugins to publish the rotor velocities to topics after calculating them?</p>
<h2>Further Info</h2>
<p>I am using Gazebo Garden and ROS 2 Humble for this project. I have used the Gazebo's <a href="https://github.com/gazebosim/ros_gz_project_template" rel="nofollow noreferrer"><code>ros_gz_project_template</code></a> as a starting framework for my project. There are four main packages in the workspace (<code>my_package_application</code>, <code>my_package_bringup</code>, <code>my_package_description</code> and <code>my_package_gazebo</code>), and the <code>src</code> directory looks something like this.</p>
<pre><code>src
βββ ros_gz
βββ sdformat_urdf
βββ my_package_application
βββ my_package_bringup
βββ my_package_description
β βββ CMakeLists.txt
β βββ hooks
β βββ include
β β βββ my_package_description
β β βββ MotorVelocityPublisher.hh
β βββ models
β β βββquadcopter
β β βββ model.config
β β βββ model.sdf
β βββ package.xml
β βββ src
β βββ MotorVelocityPublisher.cc
βββ my_package_gazebo
βββ CMakeLists.txt
βββ hooks
βββ include
βββ package.xml
βββ src
βββ worlds
βββ quadcopter.sdf
</code></pre>
<p>My initial idea was to create a custom plugin called <code>MotorVelocityPublisher</code> which would access the rotor velocity data from the <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/src/systems/multicopter_control" rel="nofollow noreferrer"><code>gz-sim-multicopter-control-system</code></a> but the plugin doesn't make the rotor velocity data easily accessible.</p>
<p>I have also thought about modifying or extending the existing <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/src/systems/multicopter_control" rel="nofollow noreferrer"><code>gz-sim-multicopter-control-system</code></a> plugin to publish the rotor velocity data. More specifically, creating a new <code>RotorVelocitiesComponent.hh</code> component to store the rotor velocity values.</p>
<pre class="lang-cpp prettyprint-override"><code>// RotorVelocitiesComponent.hh
#ifndef ROTOR_VELOCITIES_COMPONENT_HH_
#define ROTOR_VELOCITIES_COMPONENT_HH_
#include <gz/sim/components/Component.hh>
namespace multicopter_control
{
// Define a new Gazebo component to store rotor velocities
GZ_SIM_DEFINE_COMPONENT(RotorVelocities, std::vector<double>)
}
#endif // ROTOR_VELOCITIES_COMPONENT_HH_
</code></pre>
<p>Extending the <code>PreUpdate</code> method in the <a href="https://github.com/gazebosim/gz-sim/blob/gz-sim7/src/systems/multicopter_control/MulticopterVelocityControl.cc" rel="nofollow noreferrer"><code>MulticopterVelocityControl.cc</code></a> library to save the rotor velocity values into the component.</p>
<pre class="lang-cpp prettyprint-override"><code>// Add the component header in MulticopterVelocityControl.cc
#include "RotorVelocitiesComponent.hh"
// Existing Multicopter Velocity Control methods
void MulticopterVelocityControl::PreUpdate(
const UpdateInfo &_info,
EntityComponentManager &_ecm)
{
GZ_PROFILE("MulticopterVelocityControl::PreUpdate");
// Existing code for the Multicopter Velocity Control Pre-Update
this->velocityController->CalculateRotorVelocities(*frameData, cmdVel,
this->rotorVelocities);
// New code to store the rotor velocities in the component
auto rotorVelocitiesComp = _ecm.Component<multicopter_control::RotorVelocities>(this->model.Entity());
if (!rotorVelocitiesComp)
{
_ecm.CreateComponent(this->model.Entity(), multicopter_control::RotorVelocities(this->rotorVelocities));
}
else
{
rotorVelocitiesComp->Data() = this->rotorVelocities;
} // New code ends here
this->PublishRotorVelocities(_ecm, this->rotorVelocities);
}
</code></pre>
<p>The problem with this solution is that I don't know how to correctly save the extended <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/src/systems/multicopter_control" rel="nofollow noreferrer"><code>gz-sim-multicopter-control-system</code></a> plugin, build it, link it, etc. I'm not sure if this method will work or not.</p>
| Is it possible to modify or extend pre-existing Gazebo Sim plugins? |
<p>Solved(?)
Turns out, rosbags-convert didn't like the /tf topic for some reason, which appears to be published from two connections. I'm not sure if it's because it's the /tf topic or because there were two connections. The rosbags that converted fine had no /tf topic.
Removing the /tf topic as given in the answers to <a href="https://answers.ros.org/question/228676/exclude-some-topics-from-rosbag-play/" rel="nofollow noreferrer">this question</a> seems to have solved the problem.
EDIT: On further investigation, it's not the presence of the /tf topic, it appears to have something to do with rosbag filter. Bags recorded on the robot won't convert, but once I run them through filter on the computer, they do. No idea why though.</p>
| 110130 | 2024-03-21T06:26:19.350 | |ros-melodic|rosbag|ros-humble|rosbag2| | <p>I am trying to convert some fairly large (~50GB) bag files recorded in melodic so that I can use it with humble. I'm using the rosbags python library.
It fails with <code>ERROR: Converting rosbag: AssertionError()</code></p>
<p>There is no other information. I have tried reindexing the bag file, but that doesn't solve the problem and I can't think of anything else that could cause this issue. I couldn't find any information on this issue and I can't think of a solution.</p>
<p>The files are in an external flash drive.</p>
<p>A ros2 bag file is created, but it is either empty or has a few messages.</p>
<p>What could be causing this issue, and is there any solution/workaround which would help me convert these bag files?</p>
<p>UPDATES:
I have been working on the problem, and so far, I have discovered the following:</p>
<ol>
<li>This seems to be unique to rosbags generated on the mobile robot. bag files generated on a computer running melodic, recorded from mostly the same sensors, seem to work fine. This seems to be the case regardless of the size of the file (I couldn't generate 50GB files on the computer, but a ~300MB file recorded on the robot failed to convert as well).</li>
<li>There is also no dependence on batch size used in rosbag record and on whether messages are dropped.</li>
<li>Trying to read the bag files on rosbags1.reader results in <code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdb in position 9: invalid continuation byte</code>
But this doesn't seem unique to the bags that fail so that might be user error. Still working on that one. Incidentally, the bags that I managed to convert can be played with ros2 bag play and read with rosbags2.reader with no issues.</li>
</ol>
| rosbags-convert fails with assertion error |
<p>I think you have misunderstood how TF are supposed to work. Normally, the frames you can see in the TF tree, are the equivalent of the links that you have defined inside your URDF. In URDF format, you connect links through joints, specifying the type of the joint used. In TF, you do this by publishing transforms from one frame to another. You could publish yourself the tfs from each frame and it would work, but luckily, you have some packages to help you with that.</p>
<p>For static transformations (which are the equivalent to fixed joints) you can use <code>robot_state_publisher</code>. For non static ones, like a revolute joint, robot_state_publisher can't determine the state of that joint only reading the URDF data, so you need something else. One solution could be <code>joint_state_publisher</code> which searches which joints are not type fixed, and let's you change their state using its GUI. But in reality, you won't be the one controlling the joint, but any controller you use for it. Then, it would be that controller the one which should be publishing the tf representing that joint in the /tf topic.</p>
<p>It would be great if you could tell us what is the purpose of that TF and what are you trying to do.</p>
<p>If I didn't explain correctly, please do not hesitate to ask again and I will try to edit my answer.</p>
| 110133 | 2024-03-21T08:16:54.157 | |ros2|rviz|urdf|xacro| | <p>I created and ran a urdf file by combining several examples.</p>
<p>When simply launched to view in rviz, tf_tree was produced normally.</p>
<p>However, since I added a controller and output it to joint_state_broadcaster,</p>
<p>It was confirmed that tf_tree was split.</p>
<p>Below is the tf_tree structure.</p>
<p><a href="https://i.stack.imgur.com/KgBYA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KgBYA.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/MUvkQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MUvkQ.png" alt="enter image description here" /></a></p>
<p>What more is needed to determine the cause of this data?</p>
<p>add1) Additionally, it wasn't completely non-functional.
As a result of modifying the joint to fixed, it was confirmed that it was connected normally.
So, I believe this is not a urdf problem.
What's the problem?</p>
<p>add2) /static_tf msgs are found and I cannot see anything in /tf</p>
<p>add 3)) From <code>ros2 topic echo /joint_states</code>
I got this msgs
<a href="https://i.stack.imgur.com/cyxXh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cyxXh.png" alt="enter image description here" /></a></p>
| A problem occurs in tf while outputting robot_description to rviz |
<p>I found the solution thanks to @ssarkar. What you should do to fix this error is first you need to open the file called launches.py and go to line 203. To simply do it run the ros2 launch command with --debug.</p>
<p>After opening it you need to reverse commit the changes mentioned <a href="https://github.com/ros-planning/moveit2/pull/2697/commits/b634e96c2f080ab38780668e85e974351978106d" rel="nofollow noreferrer">here</a>. What I mean is copy,</p>
<pre><code>ld.add_action(DeclareLaunchArgument("capabilities", default_value=""))
</code></pre>
<p>and then paste it instead of</p>
<pre><code>ld.add_action(
DeclareLaunchArgument(
"capabilities",
default_value=moveit_config.move_group_capabilities["capabilities"],
)
)
</code></pre>
<p>After that save the file with ctrl+s and then rebuild you colcon space. Done.</p>
| 110134 | 2024-03-21T08:35:44.377 | |moveit|launch| | <p>Hi I am using ROS2 humble with moveit2. I created a configuration with setup_assistant of moveit2. However, when I try to launch the demo launch file created by it. It gaves me the error:</p>
<p>[ERROR] [launch]: Caught exception in launch (see debug for traceback): 'capabilities'</p>
<p>I could not find anything related to capabilities. What does it mean? May someone please help me?</p>
| Trouble launching moveit2 configurations |
<p>I was able to convert it with,</p>
<pre><code>xacro model.xacro > model.urdf
</code></pre>
<p>However what you must do is open the xacro file and copy and past the necessary path for you description folder. Otherwise you will get an error that says can't find the path of description folder.</p>
| 110138 | 2024-03-21T10:51:52.460 | |ros2|urdf|xacro| | <p>I have a .xacro file exported from Fusion360. I want to convert it to .urdf to use at moveit2. How can I do this?</p>
| How to convert xacro file to urdf at ROS2? |
<p>Yes, you can modify it from its URDF file. Look for the <em>joint</em> tag:</p>
<pre><code><joint name="your_joint_name" ...>
...
<axis xyz="0 0 1"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
...
</joint>
</code></pre>
<p>Modify the value of <code>axis</code> tag and <code>origin</code> tag as you wish. Refer to the <a href="http://wiki.ros.org/urdf/XML/joint" rel="nofollow noreferrer">URDF joint documentation</a> for their meanings.</p>
| 110166 | 2024-03-22T08:56:21.520 | |urdf|joint|rotation| | <p>I have a custom robot that is exported from fusion 360. In fusion I have no problems about the rotation of the joints. However when I export it to ros2 and use setup_assistant of the moveit2. The axis of rotation are different than 3D drawing. I would like to change them from the urdf file. Is there a way to this?</p>
<p><a href="https://i.stack.imgur.com/MqAjT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MqAjT.jpg" alt="Example" /></a></p>
| Can I change the axis of rotation of the joints from urdf file? |
<p>This <em>seems</em> to be a duplicate of <a href="https://answers.gazebosim.org//question/24566/difference-between-reset_simulation-and-reset_world/" rel="nofollow noreferrer">difference between reset_simulation and reset_world</a>, which has (apparently) been migrated here, but I can not locate it<sup>1</sup>.</p>
<p>The answer to that question states:</p>
<blockquote>
<p>These services correspond to the options under Edit in the GUI:</p>
<ul>
<li>/gazebo/reset_world <-> Edit > Reset Model Poses</li>
<li>/gazebo/reset_simulation <-> Edit > Reset World</li>
</ul>
</blockquote>
<p>From the linked <a href="https://classic.gazebosim.org/tutorials?tut=guided_b2&cat=" rel="nofollow noreferrer">Beginner: GUI - User interface</a>, under the section <a href="https://classic.gazebosim.org/tutorials?tut=guided_b2&cat=#TheMenu" rel="nofollow noreferrer">The Menu</a>, there is a little more information:</p>
<p><a href="https://i.stack.imgur.com/lralm.png" rel="nofollow noreferrer" title="Menu options"><img src="https://i.stack.imgur.com/lralm.png" alt="Menu options" title="Menu options" /></a></p>
<p>In text form:</p>
<ul>
<li>Reset Model Poses (Reset models to original poses; do not reset time)</li>
<li>Reset world (Reset everything in world; reset time)</li>
</ul>
<p>So, the resetting of the time seems to be the major difference.</p>
<hr />
<p><sup>1</sup> See meta question, <a href="https://robotics.meta.stackexchange.com/q/1515/9176">Has answers.gazebosim.org also been migrated to here?</a></p>
| 110177 | 2024-03-22T15:10:43.347 | |ros|gazebo|rosservice| | <p><strong>What is the clear difference between /reset_simulation and /reset_world.</strong> I initially was using /reset_simulation to reset the state of my environment periodically (in the context of RL).</p>
<p>This worked well until I added the functionality of deleting and spawning a new goal model when. From my observation the physical location of the model seems to "glitch". I understand that it has something to do with my condition to when I respawn (/delete_entity , /spawn_entity) the model. But it is clear that I am misunderstanding the process of /reset_simulation.</p>
<p>Often the model is just is not present in the gazebo world when it should be. I guess this could be /reset_simulation resetting the state of gazebo to when the model was not spawned.</p>
<p>I then looked into /reset_world which I believe is the better use case. But it doesn't work well with the slam_toolbox which is a crucial component of my package. The slam_toolbox complains about out of data TF frames (or something to that effect).</p>
<p><strong>So to summarise I'm looking for clarification on the two services. The /reset ... service that I'm looking for is more to reset the robots to their original position in the world.</strong></p>
<p>Currently using ROS2 Humble</p>
| Clear difference between /reset_world and /reset_simulation |
<p>Welcome at RSE.</p>
<p>You have two options: Give the type in the ros2_control-yaml which you pass to the ros2_control_node</p>
<pre><code>controller_manager:
ros__parameters:
update_rate: 10 # Hz
gpio_controller:
type: gpio_controller/YourCustomController
</code></pre>
<p>or add it as argument to the spawner</p>
<pre><code>gpio_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["gpio_controller",
"-c", "/controller_manager",
"-t", "gpio_controller/YourCustomController"
],
)
</code></pre>
| 110188 | 2024-03-22T23:40:47.950 | |ros2-control| | <ul>
<li>OS: Ubuntu 22.04.4 LTS</li>
<li>ROS2 Version: Humble</li>
<li>ros2_control install: used apt</li>
</ul>
<p>I am writing a custom gpio controller for ros2_control with the purpose of controlling the outputs of some Beckhoff modules. I am using <a href="https://github.com/ICube-Robotics/ethercat_driver_ros2" rel="nofollow noreferrer">ICube Robotics' ethercat_driver_ros2</a> library to help me do that.</p>
<p>I am getting my hardware to load just fine (seemingly) but something is wrong with controller itself. The error output I get is:
<code>[ros2_control_node-1] [ERROR] [1711149739.531915015] [controller_manager]: The 'type' param was not defined for 'gpio_controller'</code> when I launch my controller using the controller_manager node</p>
<pre><code>gpio_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["gpio_controller", "-c", "/controller_manager"],
)
</code></pre>
<p>The full output when I run my launch file:</p>
<pre><code>robot_state_publisher-2] [INFO] [1711149738.143327788] [robot_state_publisher]: got segment world
[ros2_control_node-1] [WARN] [1711149738.485011909] [controller_manager]: 'update_rate' parameter not set, using default value.
[ros2_control_node-1] [INFO] [1711149738.485111066] [controller_manager]: Subscribing to '~/robot_description' topic for robot description file.
[ros2_control_node-1] [INFO] [1711149738.485943022] [controller_manager]: update rate is 100 Hz
[ros2_control_node-1] [INFO] [1711149738.486074460] [controller_manager]: RT kernel is recommended for better performance
[ros2_control_node-1] [INFO] [1711149738.496322482] [controller_manager]: Received robot description file.
[ros2_control_node-1] [INFO] [1711149738.496425888] [resource_manager]: Loading hardware 'gpio_controller'
[ros2_control_node-1] [INFO] [1711149738.498364129] [resource_manager]: Initialize hardware 'gpio_controller'
[ros2_control_node-1] [INFO] [1711149738.498691880] [EthercatDriver]: gpios
[ros2_control_node-1] [INFO] [1711149738.501715351] [EthercatDriver]: Got 1 modules
[ros2_control_node-1] [INFO] [1711149738.501750608] [resource_manager]: Successful initialization of hardware 'gpio_controller'
[ros2_control_node-1] [INFO] [1711149738.501911633] [resource_manager]: 'configure' hardware 'gpio_controller'
[ros2_control_node-1] [INFO] [1711149738.501920924] [resource_manager]: Successful 'configure' of hardware 'gpio_controller'
[ros2_control_node-1] [INFO] [1711149738.501926968] [resource_manager]: 'activate' hardware 'gpio_controller'
[ros2_control_node-1] [INFO] [1711149738.501931699] [EthercatDriver]: Starting ...please wait...
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7000, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7010, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7020, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7030, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7040, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7050, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7060, 0x1}
[ros2_control_node-1] {0, 1, 0x2, 0xaf93052, 0x7070, 0x1}
[ros2_control_node-1] [INFO] [1711149738.502484001] [EthercatDriver]: Activated EcMaster!
[ros2_control_node-1] [INFO] [1711149739.502662949] [EthercatDriver]: updated!
[ros2_control_node-1] [INFO] [1711149739.502700507] [EthercatDriver]: System Successfully started!
[ros2_control_node-1] [INFO] [1711149739.502712129] [resource_manager]: Successful 'activate' of hardware 'gpio_controller'
[ros2_control_node-1] [ERROR] [1711149739.531915015] [controller_manager]: The 'type' param was not defined for 'gpio_controller'.
[spawner-3] [FATAL] [1711149739.532788019] [spawner_gpio_controller]: Failed loading controller gpio_controller
</code></pre>
<p>Here is my config .yaml</p>
<pre><code>controller_manager:
ros__parameters:
update_rate: 100 # Hz
gpio_controller_name:
type: gpio_controller/GPIOController
gpio_controller_name:
ros__parameters:
inputs:
- gpio_0/dig_output.1
- gpio_0/dig_output.2
- gpio_0/dig_output.3
- gpio_0/dig_output.4
- gpio_0/dig_output.5
- gpio_0/dig_output.6
- gpio_0/dig_output.7
- gpio_0/dig_output.8
outputs:
- gpio_0/dig_output.1
- gpio_0/dig_output.2
- gpio_0/dig_output.3
- gpio_0/dig_output.4
- gpio_0/dig_output.5
- gpio_0/dig_output.6
- gpio_0/dig_output.7
- gpio_0/dig_output.8
</code></pre>
<p>and my description file for good measure</p>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="gpio_controller">
<link name = "world">
<origin xyz="0 0 0" rpy="0 0 0" />
</link>
<ros2_control name="gpio_controller" type="system">
<hardware>
<plugin>ethercat_driver/EthercatDriver</plugin>
<param name="master_id">0</param>
<param name="control_frequency">100</param>
</hardware>
<gpio name="gpio_0">
<command_interface name="dig_output.1"/>
<command_interface name="dig_output.2"/>
<command_interface name="dig_output.3"/>
<command_interface name="dig_output.4"/>
<command_interface name="dig_output.5"/>
<command_interface name="dig_output.6"/>
<command_interface name="dig_output.7"/>
<command_interface name="dig_output.8"/>
<state_interface name="dig_output.1"/>
<state_interface name="dig_output.2"/>
<state_interface name="dig_output.3"/>
<state_interface name="dig_output.4"/>
<state_interface name="dig_output.5"/>
<state_interface name="dig_output.6"/>
<state_interface name="dig_output.7"/>
<state_interface name="dig_output.8"/>
<ec_module name="EL2809">
<plugin>ethercat_generic_plugins/GenericEcSlave</plugin>
<param name="alias">0</param>
<param name="position">1</param>
<param name="slave_config">$(find gpio_controller)/config/EL2809.yaml</param>
</ec_module>
</gpio>
</ros2_control>
</robot>
</code></pre>
| How do I resolve the issue "The 'type' param was not defined for 'gpio_controller'" for my custom ontroller gpio_controller? |
<p>It is expecting the name of the executable, not the source file cpp:</p>
<p>Try:</p>
<pre><code>ros2 run pcl_ros bag_to_pcd /data/myrosbag.db3 /kiss/local_map /data/map1
</code></pre>
<p>You need to include your node bag_to_pcd node in the build and installation process, in other words, add the node to the CMakeLists.txt file of the package to ensure it gets compiled and linked properly.</p>
| 110214 | 2024-03-24T17:00:08.563 | |ros2|slam|mapping|pcl|bag-to-pcd| | <p>I've been trying to convert a rosbag which i've generated after running the <a href="https://github.com/PRBonn/kiss-icp" rel="nofollow noreferrer">kiss-icp</a> algorithm (so output is sensor_msg/msg/PointCloud2) into a 3D map of the environment, by converting it into a .pcd format using the humble-pcl-ros library. For some reason it recognises other .cpp files as executables in the pcl_ros library (filter_cropbox_node, pcd_to_pointlcloud etc.) but not bag_to_pcd, leading to:</p>
<pre><code>ros2 run pcl_ros bag_to_pcd.cpp /data/myrosbag.db3 /kiss/local_map /data/map1
No executable found
</code></pre>
<p>Is there any way to fix this or is there perhaps an easier method or package to use to convert my rosbag.db3 file into a 3D map? Thanks.</p>
| Converting a rosbag.db3 file to .pcd |
<p>I am the author of <code>freefloating-gazebo</code>. It is not maintained anymore since many other packages now simulate hydrodynamics and thrusters through Gazebo plugins. They also have much better names than my initial package!</p>
<p>Anyway, the installation is quite straightforward as it is a ROS package. Besides the ROS dependencies, it depends on the Gazebo libs and Eigen headers. Cloning the repo inside a ROS 1 workspace and running <code>catkin build</code> should do the trick.</p>
<p>Note that as we are in 2024 I would suggest simulating the BlueROV2 with ROS 2 and the "new" Gazebo. We use the <a href="https://github.com/CentraleNantesROV/bluerov2" rel="nofollow noreferrer">package here</a> but I am sure there are many other instances of BlueROV2 models with modern Gazebo plugins.</p>
| 110252 | 2024-03-26T12:16:30.213 | |ros-noetic|gazebo-simulator| | <p>Iβm trying to simulate bluerov2 with gazebo 11 in ubuntu 20.04 in ros noetic.</p>
<p>I tried the famous <a href="https://github.com/patrickelectric/bluerov_ros_playground" rel="nofollow noreferrer">bluerov_ros_playground</a> but it's not working as it should.<br>
My guess is that <a href="https://github.com/freefloating-gazebo/freefloating_gazebo" rel="nofollow noreferrer">freefloating_gazebo</a> is not properly installed. The github creator does not provide any installation guide so I'm not sure I did the process correctly. <br>
When I start the gazebo the bluerov just falls down and never really float.</p>
| Simulating BlueROV2 with Gazebo 11 in ubuntu 20.04 and ROS Noetic |
<p><a href="https://index.ros.org/p/tf2_server/github-peci1-tf2_server/#noetic" rel="nofollow noreferrer">tf2_server</a> is the solution for ROS 1. It has several modes of working. In one, you can set a list of transforms of interest (or whole subtrees) and it will start publishing just the subtree on a namespaced tf topic. On the client side, you just remap <code>/tf</code> to the namespaced topic and you're done.</p>
<p>Search for the "streams" functionality in the readme.</p>
<p>Don't hesitate to ask for details if you face any problems using the package.</p>
| 110257 | 2024-03-26T16:14:15.727 | |ros2|ros-humble|tf-tree|tf| | <p>I'm calculating inverse kinematics for a low latency system but my robot's tf tree is so large, the time it takes to update the whole tf tree affects the calculation time significantly for my application. Is there an implementation or feature to have just the frames I need to calculate IK to have a priority in the tree and update and a much higher rate? Would this idea even be effective?</p>
<p>Maybe creating a mini tf tree with just the frames I need to calculate IK, then feed that info into the original tf tree? Maybe do something with namespacing to have another tf topic? For example: <code>/mini/tf</code>.</p>
<p>Do I just need a stronger computer?</p>
<p>I'm looking for some inspiration or for anyone to point me in a direction. Thanks.</p>
| Separate your tf tree to have crucial frames update at a high frequency |
<p><em>Update</em> - I've made a simple example project that has a lidar, a camera, and box with wheels vehicles that have twist and ackermann control inputs:
<a href="https://github.com/lucasw/o3de_ros_example" rel="nofollow noreferrer">https://github.com/lucasw/o3de_ros_example</a></p>
<p>So far building the latest O3DE entirely from source seems like the best method instead of using the snap or .deb.</p>
<p>The key is to have the o3de-extras ROS2 gem added to the project, then rebuild the project, then relaunch the Editor, after that ROS2 components including the lidar will be available under the right hand panel after clicking 'add component'.</p>
<p><a href="https://www.youtube.com/watch?v=i9g27hR9TWU" rel="nofollow noreferrer">https://www.youtube.com/watch?v=i9g27hR9TWU</a></p>
<p>(I'll clean up the following text into a better answer)</p>
<hr />
<p>Following the advice in <a href="https://github.com/o3de/o3de/discussions/17652#discussioncomment-8923103" rel="nofollow noreferrer">https://github.com/o3de/o3de/discussions/17652#discussioncomment-8923103</a> I installed the latest nightly o3de deb build a day or so after the mentioned PRs were merged.</p>
<p><a href="https://o3debinaries.org/download/linux.html" rel="nofollow noreferrer">https://o3debinaries.org/download/linux.html</a></p>
<pre><code>e3193b2a7aaafba0d82eba2c6f25f49ad5321e9a2c3924f6e59f2fc790be3bbd /data/workspace/o3de/build/linux/_CPack_Packages/Linux/DEB/o3de_4.2.0.deb
</code></pre>
<p><a href="https://o3debinaries.org/development/Latest/Linux/o3de_latest.deb" rel="nofollow noreferrer">https://o3debinaries.org/development/Latest/Linux/o3de_latest.deb</a></p>
<p><a href="https://o3debinaries.org/development/Latest/Linux/o3de_latest.deb.sha256" rel="nofollow noreferrer">https://o3debinaries.org/development/Latest/Linux/o3de_latest.deb.sha256</a></p>
<p>(not sure how to browse older nightly builds, so it'll be different tomorrow)</p>
<hr />
<p>On one system I had to remove the o3de snap which was easy (but I had to remove paths to it in ~/.o3de/o3de_manifest.json), on another I had installed the 2310.2 released deb (which was causing problems with regular apt updates, I expect the nightly debs will be similar) and removed it like this:</p>
<pre><code>sudo dpkg --remove --force-all o3de
</code></pre>
<p>(and then I dpkg installed the new nightly deb)</p>
<hr />
<p>I had <a href="https://github.com/o3de/o3de-extras" rel="nofollow noreferrer">https://github.com/o3de/o3de-extras</a> updated to latest version (from March 20th) and the manifest gem paths were already pointing at the ROS2 and other gems within it.</p>
<p>I deleted my old ros2 projects and start o3de, then created a new ros2 project. Running the build from the project manager failed the first time because something couldn't be downloaded, but worked on the second try. After that I clicked 'open editor' and it appeared to work, then failed for unexplained reasons (the output is going to <code>user/log/Editor.log</code> or another log adjacent to that, not the terminal that o3de was run in), but on the 3rd attempt it made it all the way into the editor.</p>
<p>The DemoLevel partially opens with a panoramic background image but is missing elements like the floor, and I think a warehouse environment? Wheels and a lidar to the robot are there (but no robot chassis). Pressing 'simulate' or 'play game' results in the editor exiting (because it crashed? No error messages because the stdout went somewhere else).</p>
<p>There are a lot of upper right pop-up messages from the Asset Manager when the project loads, probably those are related to the missing scene elements.</p>
<p>Next I ran the built project executable directly and it mostly worked- a ros2 node was started and there was a LaserScan published out (which came installed on that default robot), but because there was no ground the robot was falling through empty spacing forever (which /tf was reflecting). Publishing to cmd_vel didn't have any effect on wheel rotations.</p>
<pre><code>cd ~/O3DE/Projects/ros2_2024_03_28/build/linux/bin/profile
./ros2_2024_03_28.UnifiedLauncher
</code></pre>
<p>I then tried making a new level (which has a floor by default), and pressing play doesn't crash. Then found and added a ros2 lidar component in the right hand panel, but now pressing play crashes like DemoLevel. Perhaps if I can make that new level the default starting level the UnifiedLauncher executable will load it and I'll have succeeded at fully answering this question, I'll update it when/if I do. Or perhaps I could run the Editor directly for my project, and will see useful console output, or maybe it won't crash when the scene is run if launched directly.</p>
<hr />
<p>Update - by editing the DemoLevel instead of creating a new level I was able to get working lidar, view it in rviz2:</p>
<p><a href="https://i.stack.imgur.com/V9ddg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V9ddg.png" alt="enter image description here" /></a></p>
| 110258 | 2024-03-26T16:37:17.120 | |ros2|simulation|o3de| | <p>I'm using <a href="https://docs.o3de.org/docs/welcome-guide/setup/installing-linux/" rel="nofollow noreferrer">O3DE 2310.2 from the .deb download</a> in Ubuntu 23.10 and have sourced my ros2 install/setup.bash, then launched o3de. Next I created a new project using the <code>ROS2 Project</code> template, then made a new level and have the <code>Atom Default Environment</code> with the checkerboard ground, outdoor background image, and shaderball.</p>
<p>What I'd like to do is add a lidar from the ros2 gem, press play game or simulate and then see a ros2 topic appear with a point cloud that could be echoed, bagged, visualized in rviz and so on.</p>
<p>If I make a new entity with a transform there's a drop down list of standard components to add to it- should the ros2 sensors be in that list?</p>
<p>If I instantiate prefab there's <code>LidarOS2.prefab</code> which has makes a nice lidar model appear in the scene, but it's not clear there's any lidar simulation attached to it.</p>
| Add a lidar to O3DE ros2 project |
null | 110287 | 2024-03-27T17:33:15.783 | |gazebo|moveit|ros-humble|spawn-model|moveit2| | <p>anyone has an example on how to combine Moveit2 and Gazebo and to make the robot move in Gazebo using the Rviz2 from Moveit2</p>
| How to combine Moveit2 and Gazebo in Ros-Humble |
null | 110337 | 2024-03-31T08:05:17.253 | |ros-humble|camera|raspberry-pi| | <p>I am trying to create a simple, repeatable recipe for setting up IMX219 picam2 using ROS2 Humble on a Rasberry Pi 4. I am trying to install as much from binaries as possible, starting from the Ubuntu Server 22.04.4 (64 bit) image for rpi loaded by rpi-imager.</p>
<p>The camera sometimes works, and can send video to a pc running rqt on Lubuntu 22.04 with ROS2 Humble. However only the compressed topic works (and it sometimes seg faults). The raw topic <em>always</em> causes a seg fault when viewed in rqt.</p>
<pre><code>locale
LANG=en_GB.UTF.8
LANGUAGE=
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8
</code></pre>
<p>ROS2 installation:</p>
<pre><code>sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=<span class="math-container">$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $</span>(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-ros-base
sudo apt install ros-dev-tools
</code></pre>
<p>Camera packages:</p>
<pre><code>sudo apt-install ros-humble-camera-ros
sudo apt install libcamera0
sudo apt install libcamera-tools
sudo apt install v4l-utils
</code></pre>
<p>/boot/firmware/config.txt</p>
<pre><code>[all]
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel
[pi4]
max_framebuffers=2
arm_boost=1
[all]
# Enable the audio output, I2C and SPI interfaces on the GPIO header. As these
# parameters related to the base device-tree they must appear *before* any
# other dtoverlay= specification
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on
# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1
# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2
# Enable the serial pins
enable_uart=1
# Autoload overlays for any recognized cameras or displays that are attached
# to the CSI/DSI ports. Please note this is for libcamera support, *not* for
# the legacy camera stack
camera_auto_detect=1
display_auto_detect=1
# Config settings specific to arm64
arm_64bit=1
dtoverlay=dwc2
dtoverlay=imx219
[cm4]
# Enable the USB2 outputs on the IO board (assuming your CM4 is plugged into
# such a board)
dtoverlay=dwc2,dr_mode=host
[all]
</code></pre>
<p>Firmware version:</p>
<pre><code>vcgencmd version
Oct 26 2022 11:09:05
Copyright (c) 2012 Broadcom
version c72ad6b26ff40c91ef776b847436094ee63fabee (clean) (release) (start)
</code></pre>
<p>camera_ros output:</p>
<pre><code>ros2 run camera_ros camera_node --ros-args -p width:=800 -p height:=600
[0:28:24.511215089] [1463] INFO Camera camera_manager.cpp:284 libcamera v0.2.0
[0:28:24.553139433] [1473] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:28:24.555477392] [1473] WARN RPI vc4.cpp:347 Mismatch between Unicam and CamHelper for embedded data usage!
[0:28:24.557771815] [1473] INFO RPI vc4.cpp:401 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media1
[INFO] [1711872566.638805828] [camera]:
>> cameras:
0: imx219 (/base/soc/i2c0mux/i2c@1/imx219@10)
[WARN] [1711872566.639101421] [camera]: no camera selected, using default: "/base/soc/i2c0mux/i2c@1/imx219@10"
[INFO] [1711872566.639756086] [camera]:
>> stream formats:
- Pixelformat: NV21 (64x64 - 3280x2464)
- Pixelformat: YUV420 (64x64 - 3280x2464)
- Pixelformat: NV12 (64x64 - 3280x2464)
- Pixelformat: YVU420 (64x64 - 3280x2464)
- Pixelformat: XBGR8888 (64x64 - 3280x2464)
- Pixelformat: BGR888 (64x64 - 3280x2464)
- Pixelformat: RGB888 (64x64 - 3280x2464)
- Pixelformat: XRGB8888 (64x64 - 3280x2464)
- Pixelformat: RGB565 (64x64 - 3280x2464)
- Pixelformat: YVYU (64x64 - 3280x2464)
- Pixelformat: YUYV (64x64 - 3280x2464)
- Pixelformat: VYUY (64x64 - 3280x2464)
- Pixelformat: UYVY (64x64 - 3280x2464)
[WARN] [1711872566.639910716] [camera]: no pixel format selected, using default: "XBGR8888"
[WARN] [1711872566.640076993] [camera]: stream configuration adjusted from "800x600-XBGR8888" to "800x600-XBGR8888"
[0:28:24.559400738] [1463] INFO Camera camera.cpp:1183 configuring streams: (0) 800x600-XBGR8888
[0:28:24.560070756] [1473] INFO RPI vc4.cpp:559 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
[INFO] [1711872566.642433915] [camera]: camera "/base/soc/i2c0mux/i2c@1/imx219@10" configured with 800x600-XBGR8888 stream
[WARN] [1711872566.643301081] [camera]: control HdrMode (41) not handled
[WARN] [1711872566.643996246] [camera]: control StatsOutputEnable (20001) not handled
[WARN] [1711872566.644086783] [camera]: control NoiseReductionMode (10002) not handled
[WARN] [1711872566.644522357] [camera]: control AeFlickerPeriod (10) not handled
[WARN] [1711872566.645119689] [camera]: control AeFlickerMode (9) not handled
[INFO] [1711872567.003914049] [camera]: using default calibration URL
[INFO] [1711872567.004107790] [camera]: camera calibration URL: file:///home/paul/.ros/camera_info/imx219__base_soc_i2c0mux_i2c_1_imx219_10_800x600.yaml
[ERROR] [1711872567.004371067] [camera_calibration_parsers]: Unable to open camera calibration file [/home/paul/.ros/camera_info/imx219__base_soc_i2c0mux_i2c_1_imx219_10_800x600.yaml]
[WARN] [1711872567.004472419] [camera]: Camera calibration file /home/paul/.ros/camera_info/imx219__base_soc_i2c0mux_i2c_1_imx219_10_800x600.yaml not found
</code></pre>
| ROS2 Humble camera_ros camera_node gives sporadic segmentation faults. How can I fix this? |
null | 110338 | 2024-03-31T13:40:02.490 | |imu|robot-localization|ros-noetic| | <p>I'm trying to fuse gps and imu data through the robot_localization package. According to the package description, the robot_localization package assumes an ENU frame for IMU data, which I don't understand very well. If IMU data assumes an ENU frame, does it get an absolute orientation value where yaw value becomes 0 when looking east? Also, I'm not sure which sensor to buy for this. Currently I have a 6-axis IMU that publishes only the acceleration and angular velocity values, do I need to buy a new IMU?</p>
| What is ENU frame in IMU? |