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

ROS2 client receive from co-simulator #142

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mantkiew
Copy link
Collaborator

@mantkiew mantkiew commented Mar 4, 2025

The ROS client now listens to /gs/tick_from_client topic and writes that to the client shared memory.
Implemented a simple mock_co_simulator.py that simply reposts information from /gs/tick (aka "tick from server") to /gs/tick_from_client.

It turns out that the shared memory for client layout is different than that of the server:
Client shared memory:

tick_count delta_time n_vehicles n_pedestrians
vid x y z vx vy active
pid x y z vx vy active

Server shared memory:

tick_count simulation_time delta_time n_vehicles n_pedestrians
origin_lat origin_lon origin_alt
vid v_type x y z vx vy yaw steering_angle
pid p_type x y z vx vy yaw

In particular, the field active is not available in the messages Vehicle and Pedestrian. It might have to be added.

Testing (the exact order does not matter):
0. install ROS2 and build the client

$ bash scripts/setup-conda-forge-env.bash --ros2
  1. start a scenario
$ micromamba -n gss run python3 GSServer.py -s scenarios/coretest_scenarios/straightdrive.gs.osm --no-dash -wi
  1. start the mock co-simulator
$ micromamba -n gss run bash -c 'source /home/ma/geoscenarioserver/colcon_ws/install/setup.bash && ros2 run geoscenario_client mock_co_simulator'
  1. start the ROS2 client
$ micromamba -n gss run bash -c 'source /home/ma/geoscenarioserver/colcon_ws/install/setup.bash && ros2 run geoscenario_client geoscenario_client'

Observe rqt topics.
image

Additional changes:

  • clean shutdown to handle SIGINT and SIGTERM

@mantkiew mantkiew requested review from icolwell-as and zhengc84 March 4, 2025 16:23
@mantkiew mantkiew self-assigned this Mar 4, 2025
@mantkiew mantkiew requested a review from rodrigoqueiroz March 4, 2025 16:33
@mantkiew
Copy link
Collaborator Author

mantkiew commented Mar 4, 2025

@rodrigoqueiroz @icolwell-as should we unify the shared memory layout for the client and the server?

Why the active bit is only coming from the client? Should this be added to Vehicle and Pedestrian?

Copy link
Collaborator

@icolwell-as icolwell-as left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@icolwell-as
Copy link
Collaborator

@rodrigoqueiroz @icolwell-as should we unify the shared memory layout for the client and the server?

Why the active bit is only coming from the client? Should this be added to Vehicle and Pedestrian?

We don't use the client shared memory, we only read from the server. But I think the two shared memory spaces serve slightly different purposes. The server memory shares the state of everything simulated by the GSS, whereas the client memory is only for reporting back the state of any ego or co-simulated vehicles right?
If that is true, I think it's totally fine to keep them different, since they have different purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants