use_sim_time and rosserial for Arduino
Hello,
In my project (in ROS melodic), I have to use simulation time for carla_ros_bridge and CARLA and have to control a real mobile robot that gets its movement commands from my /ackermann_cmd topic.
The problem is, with "use_sim_time=true", the ackermann_cmd messages are not executed by the robot and the robot also doesn't publish its state to the topic /atv_state (with "use_sim_time=false", both work just fine). I suspect that the robot's Arduino code doesn't sufficiently synchronize the time with ROS, but I haven't found any examples on how to do that for ROS simulation time.
Arduino code: https://github.com/Lapland-Robotics/m...
It could be that something like "ros::Time begin = nh.now();" is missing in the Arduino code, but I've also seen examples without, and again - none that explicitly deal with ROS simulation time in Arduino code.
For the sake of completeness, here is the launch file I used for testing my problem:
<launch>
<!-- ************** Global Parameters *************** -->
<param name="use_sim_time" value="false"/>
<node pkg="rostopic" type="rostopic" name="ackermann_cmd"
args="pub /ackermann_cmd ackermann_msgs/AckermannDriveStamped '{header: auto, drive:{speed: 1.0}}' --rate 10 -s" />
<!-- ****** rosserial ***** -->
<node pkg="rosserial_python" type="serial_node.py" name="serial_node">
<param name="port" value="/dev/ATV_Interface_Port"/>
<param name="baud" value="57600"/>
</node>
</launch>
Since the robot architecture makes it quite complicated to change the Arduino code, it would be very helpful to know if the problem is indeed in the Arduino code or if it is something else. Any help is greatly appreciated!
Thanks in advance, cst