Simulator: Speed signal of the ego vehicle

Created on 14 Jul 2020  路  22Comments  路  Source: lgsvl/simulator

Hello,

I would like to get the speed of the ego vehicle from the simulation and send it to a camera that has a GPS receiver (2.5mm jack). Is this possible to get the speed of the simulated vehicle?

The reason why I need this: This camera has ADAS functions like lane departure and forward collision warning. For these features to work, I need this speed of the simulated ego vehicle. I place this camera in front of the simulator.

answered

All 22 comments

@ashwinsarvesh You can enable the sensor visualizations and have any value you need. If you need a different UI implementation, you will need to edit simulator code or make a sensor that displays UI data. It could even be as simple as an OnGUI().

SpeedHelp

You could also monitor (on ROS, ROS2, or CyberRT) the CAN Bus messages (including speed).

For example, in /apollo/canbus/chassis you will see the speed in meters per second labeled as "speed_mps". You could monitor this data programmatically and then determine how to present it to your ADAS camera.

You mentioned a GPS antenna, but generating fake GPS radio signals to trick a stationary ADAS camera into thinking it is moving is non-trivial, and not something the simulator will be able to help you with. If you can figure out how to inject the speed into the ADAS camera (or whatever it is connected to) that would be much easier.

Hello,

Thank you for your reply.
I need to extract the following signals of the ego vehicle from the Simulator/Apollo to connect it to the ADAS camera.

  • The vehicle speed,
  • The vehicle ignition signal (12/24V),
  • The Vehicle CAN bus (High/Low),
  • The vehicle left turn signal and right turn signal.
    Is it possible to extract this information from the ego vehicle to give it to the camera?

The attached picture contains the wiring of the camera.
Wiring

On the real car, these signals will be passed to your camera driver via those wires.
When you use our simulator, you may implement a bridge plugin (please refer to our ROS/ROS2/Cyber bridges). So the bridge will receive all messages from our simulator, and send the useful ones (e.g. ego speed) to your camera driver.

Thank you for your reply
Are these data which I listed above given by the simulator or Apollo?

Regarding your idea, Unfortunately, this camera does not have a ROS driver. :/ So I guess this idea will not work.
What do you say?

I believe we have all those information available in the simulator (may need more information on that ignition signal -- what does it mean? Is it just an on/off status?)
Even if the camera dose not have a ROS driver, it must have some driver, right? You can build a bridge plugin working with that driver.

ok, I will check on the driver part.
Ignition is a (12/24V) signal. When the vehicle ignition switch is turned to ACC (Accessory) position, this 12/24V is passed to this signal which powers on the camera.

I believe we have all those information available in the simulator (may need more information on that ignition signal -- what does it mean? Is it just an on/off status?)
Even if the camera dose not have a ROS driver, it must have some driver, right? You can build a bridge plugin working with that driver.

How do I access this data from the simulator?

Please read the code to understand how the current sensors access data and send out messages.

Yes, I will do that.
But can you tell me whether I have to read lgsvl code or Apollo code to know how to access data and send out messages?
It would be helpful if you can guide me to a specific part to read.

Look at sensors and bridge code to see how we send data. They are in their respective folders in Assets/Scripts/Sensors or /Bridge

Hello,

I am planning to use socketcan_bridge to send simulator CAN messages received on a ROS topic to the SocketCAN device which is a CAN hardware connected to a PC.

This socketcan_bridge only processes "can_msgs/Frame" messages. To convert CanBusData type to "can_msgs/Frame" messages, I need to modify this code right?
https://github.com/lgsvl/simulator/blob/master/Assets/Scripts/Bridge/Ros/RosBridge.cs#L267

Also, Where can I find more information about the CanBusData type and its message frame format?

@ashwinsarvesh We don't support Socketcan bridge currently but you can create a custom bridge to subscribe to the messages. Right @hadiTab ?

@EricBoiseLGSVL Can you elaborate what you mean by not support Socketcan_bridge?
I thought I could install socketcan_bridge and then use it to send the "can_msgs/Frame" messages from the simulator (after converting from CanBusData type). I mean, I thought both were independent and Socketcan_bridge doesn't have to do anything with the simulator.

And by a custom bridge, you mean custom bridge plugin?

@ashwinsarvesh Yes we support ROS, ROS2 and CyberRT. This new bridge type will need to be added or create a custom solution.

@EricBoiseLGSVL I get it now. ROS bridges and Cyber RT bridges are adapted to be supported by LGSVL but socketcan_bridge is not adapted. Is my understanding correct?

@hadiTab is the expert on this but yes you are correct

Can you tell me what I have to refer to implement a custom bridge plugin?
In this link, I am not able to find any instructions to create bridge plugins.

Sorry, this feature has not released yet but it should be soon. @hadiTab might have a workaround that would help you better.

@ashwinsarvesh from what I can tell from what you have described you don't need a new bridge plugin, you need to add a new ROS1 message of type can_msgs/Frame. You would then run the rosbridge and socketcan_bridge on the same machine. rosbridge will publish the can_msgs/Frame message which I believe socketcan_bridge will subscribe to and will then pass along to your device.

To publish the new message you need to:

  • Add the can_msgs/Frame to the list of message types supported here. This defines the ros side of the message.
  • Add a conversion function to convert CanBusData to can_msgs/Frame type message. See similar conversion functions here.
  • Add a condition here for the writer function to use the conversion function when using ROS1.

Now make sure you add the CanBus sensor to your vehicle json config, and that you select the ROS1 bridge. You should now recieve the can_msgs/Frame message on the topic defined in the json. If you run the rosbridge on the machine connected to your CAN device you will be publishing the can_msgs/Frame message on that machine and the socketcan_bridge should be able to subscribe to it and communicate with your CAN device.

Thank you for your reply.
I'll check this method
Where can I find the below details for the individual signals(for eg. Speed, left turn signal, right turn signal)
As the "can_msgs/Frame" asks for the below details. It would be helpful if I can find these.
image

Hello,

I am sorry if I was not clear with my previous question.
For each can signal produced by the simulator(eg. speed, left and right turn signal),

  • where can I find It's message information like CAN identifiers and so on.
  • Is the data sent out in bytes?

I need this info to convert to the can_msgs/Frame type. As of now, I can just see the can bus data here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dr563105 picture dr563105  路  4Comments

nniranjhana picture nniranjhana  路  5Comments

mehmetdogru picture mehmetdogru  路  7Comments

ntutangyun picture ntutangyun  路  4Comments

InitialDuan picture InitialDuan  路  5Comments