Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting destination of apollo not from DreamView / How to create record file #14809

Closed
Kim-mins opened this issue Mar 7, 2023 · 15 comments
Closed
Labels
Type: Help wanted Indicates that a maintainer wants help on an issue/pull request from the rest of the community

Comments

@Kim-mins
Copy link

Kim-mins commented Mar 7, 2023

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 18.04): Linux Ubuntu 20.04
  • Apollo installed from (source or binary): source, built in docker container
  • Apollo version (3.5, 5.0, 5.5, 6.0): 7.0
  • Output of apollo.sh config if on master branch:
[INFO] Apollo Environment Settings:
[INFO]     APOLLO_ROOT_DIR: /apollo
[INFO]     APOLLO_CACHE_DIR: /apollo/.cache
[INFO]     APOLLO_IN_DOCKER: true
[INFO]     APOLLO_VERSION: guardstrike/apollo_carla_bridge-2022-11-23-653b3e953
[INFO]     DOCKER_IMG: dev-x86_64-18.04-20210914_1336
[INFO]     APOLLO_ENV:  STAGE=dev USE_ESD_CAN=false
[INFO]     USE_GPU: USE_GPU_HOST=1 USE_GPU_TARGET=1
[INFO] Usage: /apollo/scripts/apollo_config.sh [Options]
[INFO] Options:
[INFO]     -i|--interactive      Run in interactive mode
[INFO]     -n|--noninteractive   Run in non-interactive mode
[INFO]     -h|--help             Show this message and exit

Questions:

HI I'm new to apollo and I followed the installation instructions and successfully ran the record file(of the tutorial!)
I'm currently using bridge(from: https://github.com/guardstrikelab/carla_apollo_bridge) with apollo, and I got two questions on apollo

1. How can I set the destination for apollo? (other than via DreamView)

To the best of my knowledge, the only way I found for the destination setting is providing destination from DreamView, with Route Editing -> Add Point of interest. But I believe there is the way to provide the destination point via command line or some other way. Could you please tell me how I can set the destination?

2. How can I create record file?

I could know I can run a record file from the tutorial, but I wonder how can I create a record file. There seems a tab for recording on DreamView, but I don't know how to use it. Could you please help?

@daohu527 daohu527 added the Type: Help wanted Indicates that a maintainer wants help on an issue/pull request from the rest of the community label Mar 9, 2023
@Kim-mins
Copy link
Author

Kim-mins commented Mar 9, 2023

What I've tried for the questions until now:

Destination setting -> Help Wanted

After the investigation, I got to know the way to set destination via websocket:

import json
from websocket import create_connection

ip = 'xxx.xxx.xxx.xxx'
port = 'yyyy'
url = "ws://" + ip + ":" + port + "/websocket"
msg = {
    "type": "SendRoutingRequest",
    "start": {
        "x": 92.36650848388672,
        "y": -36.36920928955078,
        "z": 0,
        "heading": -3.141588392532049,
    },
    "end": {"x": 92.82344955910465, "y": -38.1568439287467, "z": 0},
    "waypoint": "[]",
}
ws = create_connection(url)
ws.send(json.dumps(msg))
print(ws.recv())

However, there are no changes on Dreamview UI.
In order to test if the connection is bad, I also made a request of changing a current map. The data I sent was:

msg = {"type": "HMIAction", "action": "CHANGE_MAP", "value": 'Carla Town01'}

and it worked properly. But I could not know why that routing request doesn't work!!

Creating record file -> RESOLVED

I could find the link on the cyber_recorder tutorial: https://github.com/ApolloAuto/apollo/blob/93f69712269da572206e021cc7419b21c6feb595/docs/04_CyberRT/CyberRT_Developer_Tools.md
I tested and this works fine for me.

@Kim-mins
Copy link
Author

I found the reason: starting point and heading should be same with the current location of ego vehicle.

@Cyrus-k
Copy link

Cyrus-k commented Mar 16, 2023

Hi,Kim-mins, I also use the carla-apollo-bridge like u. I want to know whether you get the start point by using the cyber_monitor to get the ego vehicle pose. I also want to know how you get the heading. Thanks for your patience.

@Kim-mins
Copy link
Author

Hi @Cyrus-k!
Well, there could be some nice ways to do this, but actually I added an alert to print the current position and the heading of the start position, above this line.
But maybe directly inserting the statement does not work, so I found another file by ctrl + shift + f (in visual studio code) with WS.requestRoute as a keyword, which contains a serialized version of the code above, with anonymized(?) variables and inserted alert statement there.

@Cyrus-k
Copy link

Cyrus-k commented Mar 17, 2023

Thank you for your reply. Now I can get the exact point of the ego vehicle. And I still have a question. Could you tell me how to start the simulation without clicking on the 'setup' button? When I send routing request, the dreamview shows a red line just like I click on the dreamview. But if I want to move the car in Carla simulator, I have to turn on the sim control and the control module. Then the car in Apollo and the car in Carla cannnot move together, it looks like there's something wrong with sim control in the guardstrike bridge.(from: https://github.com/guardstrikelab/carla_apollo_bridge). Can you tell me how you start the simulation by using command line? Thank you very much again!

@Kim-mins
Copy link
Author

@Cyrus-k Good news!
I did not experienced your situation, but maybe you mean switching up every module of Apollo.
You can refer to these two codes:
https://github.com/lgsvl/PythonAPI/blob/a1d1524f684d48b3633d60e9d5e9b325932b84b0/lgsvl/dreamview/dreamview.py#L111
https://github.com/lgsvl/PythonAPI/blob/13c92096e7b0ba3c4ac9ad3ea5fee95b56efd234/examples/SampleTestCases/random-traffic.py#L92

I do have a question to you. Did you successfully run Apollo 8.0 on Carla? or just 7.0? If it is 8.0, could you please describe the way to run it with Carla to me?

@Cyrus-k
Copy link

Cyrus-k commented Mar 17, 2023

Sorry, I just run Apollo 7.0 with Carla 0.9.13. I haven't tried this bridge with Apollo 8.0 till now.

@Kim-mins
Copy link
Author

@Cyrus-k I see.. same situation.. thanks.
Anyway, if you have any further question, please tell me. My experience can help you, I guess.

@Cyrus-k
Copy link

Cyrus-k commented Mar 17, 2023

@Kim-mins Thanks for your helping. I do have a question for you. Do you mean that you write some codes like https://github.com/lgsvl/PythonAPI/blob/a1d1524f684d48b3633d60e9d5e9b325932b84b0/lgsvl/dreamview/dreamview.py so that you can run the whole simulation without any click on dreamview? I know I can set_destination but I am now puzzled of starting the co-simulation. Can you tell me your experience?

@Kim-mins
Copy link
Author

@Cyrus-k What I understood was, you cannot enable modules automatically when you initialized apollo.
In more detail, line 92 defines module names and line 113 pass those module names.
Each module name eventually reaches here. So you can use websocket to enable each module as the code does.
As an example, you can enable Routing module by sending the message below to the websocket:

{"type": "HMIAction", "action": "START_MODULE", "value": "Routing"}

@Cyrus-k
Copy link

Cyrus-k commented Mar 17, 2023

Sorry, maybe I don't explain the question very well. But according to your description, It seems that if I set the modules right and set ego vehicle,destination and send routing request, then the co-simulation will start. But I read the instructions in guardstrike respository, after it sent the routing request, I have to click the 'setup' button. Is that true that when I set the modules, ego vehicle, destination and send the routing request, carla and apollo will work together and I will see the car moving in the dreamview?

@Kim-mins
Copy link
Author

@Cyrus-k Yes I remember that I could run it without clicking the setup button.

@fpeanut
Copy link

fpeanut commented May 22, 2023

@Kim-mins Hello, I also encountered similar problems after installing carla0.9.1 and apollo7. I just use the following steps:

  1. Open dreamview, carla and bridge
  2. I select the start point and end point on the dremview interface, send a routing request, and configure the corresponding modules (routing, planning, contorl) in the settings.
    Problem: The ego car will not drive, there is only one red planned route. But before I open the sim control, it will run, but the speed trajectory of the car on the dremview is different from that on the carla, and the carla always runs for a short period of time and then stops.

@Kim-mins
Copy link
Author

Hi @fpeanut.
I think we are on a bit different situations.
What I understood on your situation is, the ego-vehicle does not move after sending the routing request on DreamView UI.
But after following the instruction from carla-apollo bridge, I could successfully make the ego-vehicle drive via DreamView UI.
Unlike your situation, my ego-vehicle did not move when I gave the starting/destination points via websocket this way, and I could resolve it by correcting the value for heading.
Regardless of the difference on the situation, I've never experienced your situation.. sorry for no help.

@cfs4819
Copy link

cfs4819 commented Dec 29, 2023

Hi @fpeanut. I think we are on a bit different situations. What I understood on your situation is, the ego-vehicle does not move after sending the routing request on DreamView UI. But after following the instruction from carla-apollo bridge, I could successfully make the ego-vehicle drive via DreamView UI. Unlike your situation, my ego-vehicle did not move when I gave the starting/destination points via websocket this way, and I could resolve it by correcting the value for heading. Regardless of the difference on the situation, I've never experienced your situation.. sorry for no help.

I just open a PR for carla_apollo_bridge, adding a feature to set destination by dreamview websocket.
The heading can be caculated by heading = math.radians(-ego_vehilce.get_transform().rotation.yaw).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Help wanted Indicates that a maintainer wants help on an issue/pull request from the rest of the community
Projects
None yet
Development

No branches or pull requests

5 participants